-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheslint.config.ts
More file actions
70 lines (65 loc) · 2.25 KB
/
eslint.config.ts
File metadata and controls
70 lines (65 loc) · 2.25 KB
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
67
68
69
70
import { defineConfig, globalIgnores } from 'eslint/config'
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 stylistic from '@stylistic/eslint-plugin'
import cypress from 'eslint-plugin-cypress'
/*
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 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 stylistic and cypress plugins
- a few overrides to the recommended rules:
- matching the typescript behavior for unused variables ( https://typescript-eslint.io/rules/no-unused-vars/ )
- disabling the react/prop-types rule
- allowing more than one JSX expression per line
*/
export default defineConfig([
globalIgnores(['build/**', 'server/dist/**']),
{
extends: [
js.configs.recommended,
ts.configs.recommended,
react.configs.flat.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
stylistic.configs.recommended,
cypress.configs.recommended,
],
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
ecmaVersion: 2022,
globals: {
...globals.browser,
...globals.node,
},
},
settings: { react: { version: '18.3' } },
plugins: {
'@stylistic': stylistic,
},
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'react/prop-types': 'off',
'@stylistic/jsx-one-expression-per-line': ['off'],
},
},
])