Skip to content

Commit

Permalink
chore: sb 8.4 (pmndrs#2173)
Browse files Browse the repository at this point in the history
* sb 8.4

* eslint9

* fixing storybook eslint issues
  • Loading branch information
abernier authored Nov 2, 2024
1 parent cd107a0 commit 41b4331
Show file tree
Hide file tree
Showing 37 changed files with 934 additions and 1,827 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

72 changes: 0 additions & 72 deletions .eslintrc.json

This file was deleted.

3 changes: 1 addition & 2 deletions .storybook/stories/Adaptive.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { ComponentProps, Suspense } from 'react'
import { Vector3 } from 'three'
import { Vector3, type Material, type Mesh } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { useGLTF, AdaptiveDpr, AdaptiveEvents, OrbitControls } from '../../src'

import type { Material, Mesh } from 'three'
import type { GLTF } from 'three-stdlib'

export default {
Expand Down
3 changes: 1 addition & 2 deletions .storybook/stories/ArcballControls.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { createPortal, useFrame } from '@react-three/fiber'
import React, { ComponentProps, useRef, useState } from 'react'
import { Scene } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
import { ArcballControls, Box, PerspectiveCamera, Plane, useFBO } from '../../src'

import type { OrthographicCamera, PerspectiveCamera as PerspectiveCameraType } from 'three'
import { Scene, type OrthographicCamera, type PerspectiveCamera as PerspectiveCameraType } from 'three'

export default {
title: 'Controls/ArcballControls',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/CameraControls.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPortal, useFrame } from '@react-three/fiber'
import React, { Component, ComponentProps, useRef, useState } from 'react'
import React, { ComponentProps, useRef, useState } from 'react'
import { Scene } from 'three'
import { Meta, StoryObj } from '@storybook/react'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/CurveModifier.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component, ComponentProps } from 'react'
import React, { ComponentProps } from 'react'
import { BufferGeometry, CatmullRomCurve3, LineBasicMaterial, LineLoop, Vector3 } from 'three'
import { FontLoader, TextGeometry, TextGeometryParameters } from 'three-stdlib'
import { extend, useFrame, useLoader } from '@react-three/fiber'
Expand Down
4 changes: 2 additions & 2 deletions .storybook/stories/Decal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
import { Sampler, Decal, useTexture, useSurfaceSampler, PerspectiveCamera, OrbitControls } from '../../src'
import { Euler, InstancedBufferAttribute, Matrix4, Mesh, Quaternion, Vector3 } from 'three'
import { Euler, InstancedBufferAttribute, Matrix4, Quaternion, Vector3 } from 'three'
import { ComponentProps } from 'react'

function LoopOverInstancedBufferAttribute({ children, buffer }: { buffer?: InstancedBufferAttribute; children: any }) {
Expand Down Expand Up @@ -39,7 +39,7 @@ export default {

type Story = StoryObj<typeof Sampler>

function DecalScene(props: ComponentProps<typeof Sampler>) {
function DecalScene(_props: ComponentProps<typeof Sampler>) {
const ref = React.useRef<any>()

const [reactMap, threeMap] = useTexture(['/decals/react.png', '/decals/three.png'])
Expand Down
3 changes: 1 addition & 2 deletions .storybook/stories/Example.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as THREE from 'three'
import * as React from 'react'
import { Vector3 } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Example, ExampleApi, Sparkles } from '../../src'
import { Example, ExampleApi } from '../../src'

export default {
title: 'Misc/Example',
Expand Down
1 change: 0 additions & 1 deletion .storybook/stories/FaceControls.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint react-hooks/exhaustive-deps: 1 */
import * as THREE from 'three'
import * as React from 'react'
import { Meta, StoryObj } from '@storybook/react'

Expand Down
5 changes: 2 additions & 3 deletions .storybook/stories/Float.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { ComponentProps, forwardRef, Suspense, useRef } from 'react'
import React, { ComponentProps, Suspense, useRef } from 'react'
import * as THREE from 'three'
import { useFrame } from '@react-three/fiber'

import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Float } from '../../src'
import { float } from 'three/examples/jsm/nodes/Nodes.js'

export default {
title: 'Staging/Float',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/GizmoHelper.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { Vector3 } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { GizmoHelper, OrbitControls, useGLTF, GizmoViewcube, TrackballControls, GizmoViewport } from '../../src'
import { GizmoHelper, OrbitControls, useGLTF, GizmoViewcube, GizmoViewport } from '../../src'
import { Setup } from '../Setup'
import { ComponentProps } from 'react'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Gltf.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { Mesh, Vector3 } from 'three'
import { Vector3 } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
Expand Down
4 changes: 2 additions & 2 deletions .storybook/stories/Helper.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default {

type Story = StoryObj<typeof Helper>

const HelperScene1 = (props: ComponentProps<typeof Helper>) => {
const HelperScene1 = (_props: ComponentProps<typeof Helper>) => {
return (
<Sphere>
<meshBasicMaterial />
Expand All @@ -39,7 +39,7 @@ export const HelperSt1 = {
name: 'Default',
} satisfies Story

const HelperScene2 = (props: ComponentProps<typeof Helper>) => {
const HelperScene2 = (_props: ComponentProps<typeof Helper>) => {
const camera = React.useRef<THREE.PerspectiveCamera>(null)

useFrame(({ clock }) => {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Image.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {

type Story = StoryObj<typeof Image>

function ImageScene({ texture, url, ...props }: React.ComponentProps<typeof Image>) {
function ImageScene({ url, ...props }: React.ComponentProps<typeof Image>) {
const texture1 = useTexture('/images/living-room-1.jpg')
const texture2 = useTexture('/images/living-room-3.jpg')

Expand Down
19 changes: 5 additions & 14 deletions .storybook/stories/Instances.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import * as React from 'react'
import { Euler, MathUtils, Mesh, Quaternion, ShaderMaterial, Vector3 } from 'three'
import { Meta, StoryObj } from '@storybook/react'
import { Euler, MathUtils, Mesh, ShaderMaterial, Vector3 } from 'three'
// import { StoryObj } from '@storybook/react'
import { Setup } from '../Setup'

import {
Html,
useGLTF,
Loader,
Instances,
Instance,
createInstances,
InstancedAttribute,
PositionMesh,
} from '../../src'
import { useGLTF, Instances, Instance, createInstances, InstancedAttribute } from '../../src'
import { useFrame } from '@react-three/fiber'
import { clamp } from 'maath/misc'

Expand All @@ -28,7 +19,7 @@ export default {
],
}

type Story = StoryObj
// type Story = StoryObj

// function Helmet() {

Expand Down Expand Up @@ -61,7 +52,7 @@ const [SuzaneInstances, SuzaneInstnace] = createInstances<SuzaneInstnaceProps>()

const Suzanne = () => {
const randomShift = React.useMemo(() => Math.random() * Math.PI, [])
const [_isPending, startTransition] = React.useTransition()
const [_isPending] = React.useTransition()

const instancePosition = React.useMemo(
() => [MathUtils.randFloatSpread(100), MathUtils.randFloatSpread(100), MathUtils.randFloatSpread(100)] as const,
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/KeyboardControls.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useFrame } from '@react-three/fiber'
import * as React from 'react'
import { useMemo, useRef } from 'react'
import { useRef } from 'react'
import { MathUtils, Mesh, Vector3 } from 'three'
import { Cone, KeyboardControls, useKeyboardControls } from '../../src'
import { Setup } from '../Setup'
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Loader.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Helmet() {

//

function LoaderScene(props: React.ComponentProps<typeof Loader>) {
function LoaderScene(_props: React.ComponentProps<typeof Loader>) {
return (
<React.Suspense
fallback={
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/MarchingCubes.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { Color, Group, Vector3 } from 'three'
import { Color, Vector3 } from 'three'

import { Setup } from '../Setup'

Expand Down
7 changes: 2 additions & 5 deletions .storybook/stories/OrbitControls.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { createPortal, useFrame } from '@react-three/fiber'
import React, { ElementRef, useRef, useState } from 'react'
import React, { useRef, useState } from 'react'
import { Scene } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
import { Box, OrbitControls, PerspectiveCamera, Plane, useFBO } from '../../src'

import type { Camera } from 'three'
import type { OrbitControlsProps } from '../../src'
import { Box, OrbitControls, PerspectiveCamera, Plane, useFBO, type OrbitControlsProps } from '../../src'

export default {
title: 'Controls/OrbitControls',
Expand Down
3 changes: 1 addition & 2 deletions .storybook/stories/OrthographicCamera.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from 'react'
import { Canvas } from '@react-three/fiber'
import { Meta, StoryObj } from '@storybook/react'

import { Icosahedron, OrthographicCamera, OrbitControls } from '../../src'
import { Icosahedron, OrthographicCamera } from '../../src'
import { Setup } from '../Setup'

export default {
Expand Down
3 changes: 1 addition & 2 deletions .storybook/stories/PerspectiveCamera.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from 'react'
import { Canvas } from '@react-three/fiber'
import { Meta, StoryObj } from '@storybook/react'

import { Icosahedron, PerspectiveCamera, OrbitControls } from '../../src'
import { Icosahedron, PerspectiveCamera } from '../../src'
import { Setup } from '../Setup'

export default {
Expand Down
1 change: 0 additions & 1 deletion .storybook/stories/PointerLockControls.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react'
import { Vector3 } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
Expand Down
4 changes: 2 additions & 2 deletions .storybook/stories/Points.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function PointEvent({ color, ...props }) {
{...props}
color={clicked ? 'hotpink' : hovered ? 'red' : color}
onPointerOver={(e) => (e.stopPropagation(), setHover(true))}
onPointerOut={(e) => setHover(false)}
onPointerOut={() => setHover(false)}
onClick={(e) => (e.stopPropagation(), setClick((state) => !state))}
/>
)
Expand Down Expand Up @@ -156,7 +156,7 @@ export const BasicPointsInstances = {

function BasicPointsInstancesSelectionScene(props: React.ComponentProps<typeof Points>) {
const [points] = React.useState(() =>
Array.from({ length: 100 }, (i) => [
Array.from({ length: 100 }, () => [
MathUtils.randFloatSpread(10),
MathUtils.randFloatSpread(10),
MathUtils.randFloatSpread(10),
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Progress.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function CustomLoader() {
)
}

function ProgressScene(props: React.ComponentProps<typeof Progress>) {
function ProgressScene(_props: React.ComponentProps<typeof Progress>) {
return (
<React.Suspense fallback={<CustomLoader />}>
<Shoe />
Expand Down
1 change: 0 additions & 1 deletion .storybook/stories/Resize.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as THREE from 'three'
import * as React from 'react'
import { Meta, StoryObj } from '@storybook/react'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Sky.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const SkySt2 = {

function SkyScene3(props: React.ComponentProps<typeof Sky>) {
// NOT the right way to do it...
const [inclination, setInclination] = React.useState(0)
const [, setInclination] = React.useState(0)
useFrame(() => {
setInclination((a) => a + 0.002)
})
Expand Down
3 changes: 1 addition & 2 deletions .storybook/stories/SpriteAnimator.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as React from 'react'
import { Vector3 } from 'three'
import { Meta, StoryObj } from '@storybook/react'
import { Setup } from '../Setup'
import { SpriteAnimator } from '../../src'
import { useSpriteLoader } from '../../src'
import { SpriteAnimator, useSpriteLoader } from '../../src'

const SPRITE_IMAGE = 'story.png'
const SPRITE_DATA = 'story.json'
Expand Down
4 changes: 2 additions & 2 deletions .storybook/stories/Trail.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Sphere, Trail, useTrail, Html, Stats, Float, PerspectiveCamera } from '../../src'
import { Sphere, Trail, useTrail, Float, PerspectiveCamera } from '../../src'
import { useFrame } from '@react-three/fiber'
import { Group, InstancedMesh, Mesh, Object3D, Vector3 } from 'three'

Expand Down Expand Up @@ -129,7 +129,7 @@ function UseTrailScene() {
}

export const UseTrailSt = {
render: (args) => <UseTrailScene />,
render: () => <UseTrailScene />,
name: 'useTrail with Instances',
} satisfies StoryObj<React.ComponentProps<typeof UseTrailScene>>

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Tube.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {

type Story = StoryObj<typeof Tube>

function TubeScene({ args, ...props }: React.ComponentProps<typeof Tube>) {
function TubeScene(props: React.ComponentProps<typeof Tube>) {
// curve example from https://threejs.org/docs/#api/en/geometries/TubeGeometry
const path = React.useMemo(() => {
class CustomSinCurve extends THREE.Curve<THREE.Vector3> {
Expand Down
Loading

0 comments on commit 41b4331

Please sign in to comment.