Skip to content

Commit 1ea91b8

Browse files
TinooooTino Koch
andauthored
feat: 50 similar linting rules throughout the tresjs packages (#51)
* feature: added eslint rules to have homogeneous rules in the tres ecosystem * chore: applied eslint fixes * chore: moved linting rules to correct position --------- Co-authored-by: Tino Koch <[email protected]>
1 parent ab56b2d commit 1ea91b8

23 files changed

+1303
-130
lines changed

.eslintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dist
2+
**.spec.js
3+
**.test.ts
4+
**.test.js
5+
**.cy.js
6+
**/cypress/**
7+
docs/.vitepress/cache
8+
docs/.vitepress/dist

.eslintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "@tresjs/eslint-config-vue",
3+
"rules": {
4+
"@typescript-eslint/no-use-before-define": "off",
5+
"vue/valid-template-root": "off"
6+
}
7+
}

.prettierrc.cjs

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@tresjs/eslint-config-vue"
3+
}

docs/.vitepress/theme/TresLayout.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup>
2+
// eslint-disable-next-line import/no-named-as-default
23
import DefaultTheme from 'vitepress/theme'
34
import LoveVueThreeJS from './components/LoveVueThreeJS.vue'
45

docs/.vitepress/theme/components/BloomDemo.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ const bloomParams = reactive({
2424

2525
<template>
2626
<TresCanvas v-bind="gl">
27-
<TresPerspectiveCamera :position="[5, 5, 5]" :look-at="[0, 0, 0]" />
27+
<TresPerspectiveCamera
28+
:position="[5, 5, 5]"
29+
:look-at="[0, 0, 0]"
30+
/>
2831
<TresMesh>
2932
<TresSphereGeometry :args="[2, 32, 32]" />
3033
<TresMeshStandardMaterial
31-
ref="materialRef"
3234
color="hotpink"
3335
:emissive="new Color('hotpink')"
3436
:emissive-intensity="1.2"
@@ -37,10 +39,13 @@ const bloomParams = reactive({
3739
<TresGridHelper />
3840

3941
<TresAmbientLight :intensity="2" />
40-
<TresDirectionalLight :position="[3, 3, 3]" :intensity="1" />
42+
<TresDirectionalLight
43+
:position="[3, 3, 3]"
44+
:intensity="1"
45+
/>
4146
<Suspense>
4247
<EffectComposer>
43-
<Bloom v-bind="bloomParams"> </Bloom>
48+
<Bloom v-bind="bloomParams" />
4449
</EffectComposer>
4550
</Suspense>
4651
</TresCanvas>

docs/.vitepress/theme/components/GlitchDemo.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ const gl = {
1515

1616
<template>
1717
<TresCanvas v-bind="gl">
18-
<TresPerspectiveCamera :position="[0, 1, 5]" :look-at="[0, 0, 0]" />
18+
<TresPerspectiveCamera
19+
:position="[0, 1, 5]"
20+
:look-at="[0, 0, 0]"
21+
/>
1922
<Suspense>
2023
<Text3D
2124
:position="[0, 1, 0]"
2225
text="Post-processing"
2326
font="https://raw.githubusercontent.com/Tresjs/assets/main/fonts/FiraCodeRegular.json"
2427
>
2528
<TresMeshStandardMaterial
26-
ref="materialRef"
2729
color="hotpink"
2830
:emissive="new Color('hotpink')"
2931
:emissive-intensity="1.2"
@@ -33,7 +35,10 @@ const gl = {
3335
<TresGridHelper />
3436

3537
<TresAmbientLight :intensity="2" />
36-
<TresDirectionalLight :position="[3, 3, 3]" :intensity="1" />
38+
<TresDirectionalLight
39+
:position="[3, 3, 3]"
40+
:intensity="1"
41+
/>
3742
<Suspense>
3843
<EffectComposer>
3944
<Glitch />

docs/.vitepress/theme/components/LoveVueThreeJS.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<script setup lang="ts">
22
///<reference types="vite-svg-loader" />
3+
// eslint-disable-next-line import/no-named-as-default
4+
import gsap from 'gsap'
5+
import { onMounted, ref } from 'vue'
36
import Triangle from '../assets/triangle.svg'
47
import SecondRow from '../assets/second-row.svg'
58
import ThirdRow from '../assets/third-row.svg'
6-
import gsap from 'gsap'
7-
import { onMounted, ref } from 'vue'
89
910
const triangleRef = ref()
1011
const secondRowRef = ref()
@@ -19,13 +20,13 @@ async function restartAnimation() {
1920
gsap.to(secondRowRef.value.$el, {
2021
duration: 1,
2122
y: 0,
22-
ease: "elastic.out(0.7, 0.2)",
23+
ease: 'elastic.out(0.7, 0.2)',
2324
})
2425
await gsap.to(thirdRowRef.value.$el, {
2526
delay: 0.65,
2627
duration: 1,
2728
y: 0,
28-
ease: "steps(4)",
29+
ease: 'steps(4)',
2930
})
3031
3132
tl2r.restart()
@@ -43,13 +44,16 @@ onMounted(() => {
4344
delay: 1.25,
4445
duration: 2,
4546
y: -(12 * heightOfSignleSvg),
46-
ease: "power1.out",
47+
ease: 'power1.out',
4748
})
4849
})
4950
</script>
5051

5152
<template>
52-
<div class="grid items-center w-full min-w-370px -translate-x-20px md:translate-x-20px h-full scale-75" @click="restartAnimation">
53+
<div
54+
class="grid items-center w-full min-w-370px -translate-x-20px md:translate-x-20px h-full scale-75"
55+
@click="restartAnimation"
56+
>
5357
<div class="grid grid-cols-3 gap-8 overflow-hidden h-93px">
5458
<Triangle ref="triangleRef" />
5559
<SecondRow ref="secondRowRef" />

docs/.vitepress/theme/components/OutlineDemo.vue

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script lang="ts" setup>
2-
import { ref } from 'vue'
2+
import { ref, shallowRef } from 'vue'
33
import { watchOnce } from '@vueuse/core'
4-
import { shallowRef } from 'vue'
54
import { TresCanvas } from '@tresjs/core'
65
import { KernelSize } from 'postprocessing'
76
import { EffectComposer, Outline } from '/@'
8-
import { Color, Intersection, Object3D } from 'three'
7+
import type { Intersection, Object3D } from 'three'
8+
import { Color } from 'three'
99
1010
const boxWidth = 2
1111
const outlinedObjects = ref<Object3D[]>([])
@@ -25,21 +25,36 @@ watchOnce(meshes, () => {
2525
</script>
2626

2727
<template>
28-
<TresCanvas clear-color="#121212" :alpha="false" :shadows="true" :disable-render="true">
29-
<TresPerspectiveCamera :position="[3, 3, 4]" :look-at="[0, 0, 0]" />
28+
<TresCanvas
29+
clear-color="#121212"
30+
:alpha="false"
31+
:shadows="true"
32+
:disable-render="true"
33+
>
34+
<TresPerspectiveCamera
35+
:position="[3, 3, 4]"
36+
:look-at="[0, 0, 0]"
37+
/>
3038
<TresMesh
31-
ref="meshes"
3239
v-for="i in 3"
40+
ref="meshes"
3341
:key="i.toString()"
3442
:position="[(i - 2) * boxWidth, 0.5, 1]"
3543
@click="toggleMeshSelectionState"
3644
>
3745
<TresBoxGeometry />
38-
<TresMeshStandardMaterial color="hotpink" :emissive="new Color('hotpink')" :emissive-intensity="1" />
46+
<TresMeshStandardMaterial
47+
color="hotpink"
48+
:emissive="new Color('hotpink')"
49+
:emissive-intensity="1"
50+
/>
3951
</TresMesh>
4052
<TresGridHelper />
4153
<TresAmbientLight :intensity="2" />
42-
<TresDirectionalLight :position="[-4, 4, 3]" :intensity="2" />
54+
<TresDirectionalLight
55+
:position="[-4, 4, 3]"
56+
:intensity="2"
57+
/>
4358

4459
<Suspense>
4560
<EffectComposer>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"preview": "vite preview",
3838
"release": "release-it",
3939
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue",
40+
"lint:fix": "pnpm run lint --fix",
4041
"docs:dev": "vitepress dev docs",
4142
"docs:build": "vitepress build docs",
4243
"docs:preview": "vitepress preview docs"
@@ -52,8 +53,8 @@
5253
"three-stdlib": "^2.23.10"
5354
},
5455
"devDependencies": {
55-
"@alvarosabu/prettier-config": "^1.3.0",
5656
"@release-it/conventional-changelog": "^5.1.1",
57+
"@tresjs/eslint-config-vue": "^0.1.1",
5758
"@types/three": "^0.152.1",
5859
"@vitejs/plugin-vue": "^4.2.3",
5960
"gsap": "^3.12.1",

0 commit comments

Comments
 (0)