Skip to content

Commit

Permalink
chore: eslint v9 - simplified config (#2185)
Browse files Browse the repository at this point in the history
* simplified to the extreme

* cleaning
  • Loading branch information
abernier authored Nov 10, 2024
1 parent da21df3 commit bdd1511
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 331 deletions.
103 changes: 4 additions & 99 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import _import from 'eslint-plugin-import'
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
Expand All @@ -20,117 +18,24 @@ const compat = new FlatCompat({

export default [
{
ignores: ['.storybook/public/draco-gltf/', '**/dist/', '**/node_modules/', '**/storybook-static/'],
ignores: ['.storybook/public', '**/dist/', '**/node_modules/', '**/storybook-static/'],
},
...fixupConfigRules(
compat.extends(
'plugin:import/recommended',
// 'plugin:import/errors',
// 'plugin:import/warnings',
'plugin:import/typescript',
'plugin:react-hooks/recommended',
'plugin:storybook/recommended',
'prettier'
)
),
...fixupConfigRules(compat.extends('plugin:react-hooks/recommended', 'plugin:storybook/recommended', 'prettier')),
{
plugins: {
'@typescript-eslint': typescriptEslint,
react,
'react-hooks': fixupPluginRules(reactHooks),
import: fixupPluginRules(_import),
},

languageOptions: {
globals: {
...globals.browser,
...globals['shared-node-browser'],
...globals.node,
},
files: ['{src,.storybook}/**/*.{js,jsx,ts,tsx}'],

languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: 'module',

parserOptions: {
ecmaFeatures: {
ecmaVersion: 2018,
jsx: true,
},
},
},

settings: {
react: {
version: 'detect',
},

'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],

'import/parsers': {
'@typescript-eslint/parser': ['.js', '.jsx', '.ts', '.tsx'],
},

'import/resolver': {
typescript: true,
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
paths: ['src'],
},
},
},

rules: {
curly: ['error', 'multi-line', 'consistent'],
'no-console': 'off',
'no-empty-pattern': 'error',
'no-duplicate-imports': 'error',
'prefer-const': 'error',

'import/no-unresolved': [
'error',
{
commonjs: true,
amd: true,
},
],

'import/export': 'error',
'import/named': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'import/namespace': 'off',
'import/default': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'no-unused-vars': ['off'],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react-hooks/exhaustive-deps': 'off',

'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],

'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
files: ['**/src'],

languageOptions: {
ecmaVersion: 5,
sourceType: 'script',

parserOptions: {
project: ['./tsconfig.json', './storybook/tsconfig.json'],
},
},
},
]
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,9 @@
"copyfiles": "^2.4.1",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-storybook": "^0.10.2",
"globals": "^15.12.0",
"husky": "^6.0.0",
"json": "^11.0.0",
"prettier": "^3.3.3",
Expand Down
1 change: 0 additions & 1 deletion src/core/Bounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ type GoalT = {
target: THREE.Vector3 | undefined
}

// eslint-disable-next-line no-shadow
enum AnimationState {
NONE = 0,
START = 1,
Expand Down
1 change: 0 additions & 1 deletion src/core/MeshDistortMaterial.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react'
import { IUniform, MeshPhysicalMaterial, MeshPhysicalMaterialParameters } from 'three'
import { useFrame } from '@react-three/fiber'
// eslint-disable-next-line
// @ts-ignore
import distort from '../helpers/glsl/distort.vert.glsl'
import { ForwardRefComponent } from '../helpers/ts-utils'
Expand Down
1 change: 0 additions & 1 deletion src/core/MotionPathControls.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable prettier/prettier */
import * as THREE from 'three'
import * as React from 'react'
import { useFrame, useThree } from '@react-three/fiber'
Expand Down
1 change: 0 additions & 1 deletion src/core/SpotLight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { useFrame, useThree } from '@react-three/fiber'
import { FullScreenQuad } from 'three-stdlib'
import { SpotLightMaterial } from '../materials/SpotLightMaterial'

// eslint-disable-next-line
// @ts-ignore
import SpotlightShadowShader from '../helpers/glsl/DefaultSpotlightShadowShadows.glsl'
import { ForwardRefComponent } from '../helpers/ts-utils'
Expand Down
1 change: 0 additions & 1 deletion src/core/Stars.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as THREE from 'three'
import * as React from 'react'
// eslint-disable-next-line
import { ReactThreeFiber, useFrame } from '@react-three/fiber'
import { Points, Vector3, Spherical, Color, AdditiveBlending, ShaderMaterial } from 'three'
import { ForwardRefComponent } from '../helpers/ts-utils'
Expand Down
1 change: 0 additions & 1 deletion src/core/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ type Props = JSX.IntrinsicElements['mesh'] & {
onSync?: (troika: any) => void
}

// eslint-disable-next-line prettier/prettier
export const Text: ForwardRefComponent<Props, any> = /* @__PURE__ */ React.forwardRef(
(
{
Expand Down
1 change: 0 additions & 1 deletion src/core/useAnimations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export function useAnimations<T extends AnimationClip>(
): Api<T> {
const ref = React.useRef<Object3D>()
const [actualRef] = React.useState(() => (root ? (root instanceof Object3D ? { current: root } : root) : ref))
// eslint-disable-next-line prettier/prettier
const [mixer] = React.useState(() => new AnimationMixer(undefined as unknown as Object3D))
React.useLayoutEffect(() => {
if (root) actualRef.current = root instanceof Object3D ? root : root.current
Expand Down
Loading

0 comments on commit bdd1511

Please sign in to comment.