-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patheslint.config.js
66 lines (61 loc) · 2.07 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import js from '@eslint/js'
import globals from 'globals'
import ts from 'typescript-eslint'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import cypress from 'eslint-plugin-cypress/flat'
/*
This config is a combination of the basic recommended React configs from Vite:
- https://github.com/vitejs/vite/blob/main/packages/create-vite/template-react/eslint.config.js
- https://github.com/vitejs/vite/blob/main/packages/create-vite/template-react-ts/eslint.config.js
This is required since the project uses both JSX and TSX. The only other settings that are configured are:
- setting the ecmaVersion to match the one in the tsconfig.json
- setting the react version to match the one in package.json
- adding the cypress plugin
- matching the typescript behavior for unused variables ( https://typescript-eslint.io/rules/no-unused-vars/ )
- disabling the react/prop-types rule
*/
export default ts.config(
{ ignores: ['build'] },
{
extends: [cypress.configs.recommended, js.configs.recommended, ts.configs.recommended],
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
ecmaVersion: 2022,
globals: {
...globals.browser,
...globals.node,
}
},
settings: { react: { version: '18.3' } },
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true
}
],
'react/prop-types': 'off',
},
},
)