Skip to content

Commit

Permalink
fix: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeTorrealba committed Sep 7, 2024
1 parent 471bd0d commit 2ccd6c4
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 22 deletions.
9 changes: 6 additions & 3 deletions docs/advanced/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,12 @@ To avoid errors and unwanted sideeffects, resources created programatically with
import { dispose } from '@tresjs/core'
import { useGLTF } from '@tresjs/cientos'
const { nodes } = await useGLTF('https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/blender-cube.glb', {
draco: true,
})
const { nodes } = await useGLTF(
'https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/blender-cube.glb',
{
draco: true,
},
)
const model = nodes.Cube
onUnmounted(() => {
Expand Down
6 changes: 5 additions & 1 deletion docs/advanced/primitive.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ The same pointer events available on the TresJS components are available on the

```html
<template>
<primitive :object="meshWithMaterial" @click="onClick" @pointermove="onPointerMove" />
<primitive
:object="meshWithMaterial"
@click="onClick"
@pointermove="onPointerMove"
/>
</template>
```

Expand Down
2 changes: 1 addition & 1 deletion playground/vue/src/pages/basic/Primitives.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
Mesh,
MeshToonMaterial,
NoToneMapping,
SphereGeometry,
SRGBColorSpace,
SphereGeometry,
TorusGeometry,
TorusKnotGeometry,
} from 'three'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useLoop } from '@tresjs/core'
import { ref, type ShallowRef, shallowRef } from 'vue'
import { type ShallowRef, ref, shallowRef } from 'vue'
const isCalled = ref(false)
Expand Down
4 changes: 2 additions & 2 deletions playground/vue/src/pages/basic/ready/OnTresReadyWatcher.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { onTresReady, type TresContext } from '@tresjs/core'
import { ref, type ShallowRef, shallowRef } from 'vue'
import { type TresContext, onTresReady } from '@tresjs/core'
import { type ShallowRef, ref, shallowRef } from 'vue'
const isCalled = ref(false)
Expand Down
2 changes: 1 addition & 1 deletion src/components/TresCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import { PerspectiveCamera, Scene } from 'three'
import * as THREE from 'three'
import {
Fragment,
computed,
createRenderer,
defineComponent,
Fragment,
getCurrentInstance,
h,
onMounted,
Expand Down
4 changes: 2 additions & 2 deletions src/composables/useRenderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@vueuse/core'
import { ACESFilmicToneMapping, Color, WebGLRenderer } from 'three'

import { computed, type MaybeRef, onUnmounted, shallowRef, watch, watchEffect } from 'vue'
import { type MaybeRef, computed, onUnmounted, shallowRef, watch, watchEffect } from 'vue'

import type { ColorSpace, Scene, ShadowMapType, ToneMapping, WebGLRendererParameters } from 'three'
// Solution taken from Thretle that actually support different versions https://github.com/threlte/threlte/blob/5fa541179460f0dadc7dc17ae5e6854d1689379e/packages/core/src/lib/lib/useRenderer.ts
Expand All @@ -15,10 +15,10 @@ import { get, merge, set, setPixelRatio } from '../../utils'
import { normalizeColor } from '../../utils/normalize'

import { useLogger } from '../useLogger'
import { rendererPresets } from './const'

import type { EmitEventFn, TresColor } from '../../types'
import type { TresContext } from '../useTresContextProvider'
import { rendererPresets } from './const'
import type { RendererPresetsType } from './const'

type TransformToMaybeRefOrGetter<T> = {
Expand Down
2 changes: 1 addition & 1 deletion src/composables/useSeek/useSeek.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Object3D } from 'three'
import { useSeek } from '.'
import { withSetup } from '../../utils/test-utils'
import { useSeek } from '.'

const [composable, app] = withSetup(() => useSeek())

Expand Down
2 changes: 1 addition & 1 deletion src/composables/useTresReady/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTresContext } from '../useTresContextProvider'
import { createReadyEventHook } from './createReadyEventHook'
import type { TresContext } from '../useTresContextProvider'
import { createReadyEventHook } from './createReadyEventHook'

const ctxToUseTresReady = new WeakMap<
TresContext,
Expand Down
2 changes: 1 addition & 1 deletion src/core/loop.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { afterEach, beforeEach, it } from 'vitest'
import { createRenderLoop } from './loop'
import type { TresContext } from '../composables/useTresContextProvider'
import { createRenderLoop } from './loop'

let renderLoop

Expand Down
2 changes: 1 addition & 1 deletion src/core/nodeOps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { beforeAll, describe, expect, it, vi } from 'vitest'
import { shallowRef } from 'vue'
import type { TresContext } from 'src/composables'
import type { Vector3 } from 'three'
import type { TresObject } from '../types'
import { extend } from './catalogue'
import { nodeOps as getNodeOps } from './nodeOps'
import type { TresObject } from '../types'

let nodeOps = getNodeOps(mockTresContext())
const pool = []
Expand Down
6 changes: 2 additions & 4 deletions src/core/nodeOps.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { BufferAttribute, Object3D } from 'three'
import { isRef, type RendererOptions } from 'vue'
import { type RendererOptions, isRef } from 'vue'
import { useLogger } from '../composables'
import { attach, deepArrayEqual, doRemoveDeregister, doRemoveDetach, invalidateInstance, isHTMLTag, kebabToCamel, noop, prepareTresInstance, setPrimitiveObject, unboxTresPrimitive } from '../utils'
import * as is from '../utils/is'
import { createRetargetingProxy } from '../utils/primitive/createRetargetingProxy'
import { catalogue } from './catalogue'
import type { TresContext } from '../composables'
import type { DisposeType, LocalState, TresInstance, TresObject, TresObject3D, TresPrimitive, WithMathProps } from '../types'
import { catalogue } from './catalogue'

const { logError } = useLogger()

Expand Down Expand Up @@ -218,7 +218,6 @@ export const nodeOps: (context: TresContext) => RendererOptions<TresObject, Tres
node.dispose()
}

// eslint-disable-next-line unused-imports/no-unused-vars
catch (e) {
// NOTE: We must try/catch here. We want to remove/dispose
// Vue/THREE children in bottom-up order. But THREE objects
Expand Down Expand Up @@ -342,7 +341,6 @@ export const nodeOps: (context: TresContext) => RendererOptions<TresObject, Tres
invalidateInstance(node as TresObject)
}

// eslint-disable-next-line unicorn/consistent-function-scoping
function parentNode(node: TresObject): TresObject | null {
return node?.__tres?.parent || null
}
Expand Down
2 changes: 1 addition & 1 deletion src/devtools/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type {
import { createHighlightMesh, editSceneObject } from '../utils'
import * as is from '../utils/is'
import { bytesToKB, calculateMemoryUsage } from '../utils/perf'
import { toastMessage } from './utils'
import type { TresContext } from '../composables'
import { toastMessage } from './utils'
import type { TresObject } from './../types'

export interface Tags {
Expand Down
3 changes: 1 addition & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { nodeOps } from 'src/core/nodeOps'
import type { AttachType, LocalState, TresInstance, TresObject, TresPrimitive } from 'src/types'
import type { Material, Mesh, Object3D, Texture } from 'three'
import { HightlightMesh } from '../devtools/highlight'
import * as is from './is'
import type { TresContext } from '../composables/useTresContextProvider'
import * as is from './is'

export function toSetMethodName(key: string) {
return `set${key[0].toUpperCase()}${key.slice(1)}`
Expand Down Expand Up @@ -451,7 +451,6 @@ export function invalidateInstance(instance: TresObject) {
}

export function noop(fn: string): any {
// eslint-disable-next-line ts/no-unused-expressions
fn
}

Expand Down

0 comments on commit 2ccd6c4

Please sign in to comment.