-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
95 lines (89 loc) · 2.49 KB
/
index.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import tseslint from 'typescript-eslint'
import eslint from '@eslint/js'
import reactPlugin from 'eslint-plugin-react'
import jestPlugin from 'eslint-plugin-jest'
import reactHooksPlugin from 'eslint-plugin-react-hooks'
import stylistic from '@stylistic/eslint-plugin'
export default tseslint.config(
{
settings: {
react: {
version: 'detect'
}
}
},
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}']
},
{
ignores: ['**/dist/**', '**/coverage/**']
},
eslint.configs.recommended,
reactPlugin.configs.flat.recommended,
...tseslint.configs.recommendedTypeChecked,
stylistic.configs.customize({
indent: 2,
quote: 'single',
braceStyle: '1tbs',
arrowParens: true,
semi: false,
jsx: true
}),
{
plugins: {
'@typescript-eslint': tseslint.plugin,
'@stylistic': stylistic,
'react-hooks': reactHooksPlugin,
jest: jestPlugin
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname
}
},
rules: {
...reactHooksPlugin.configs.recommended.rules,
'@stylistic/comma-dangle': ['error', 'never'],
'@stylistic/jsx-quotes': ['error', 'prefer-single'],
'react/react-in-jsx-scope': 'off',
'@stylistic/no-multiple-empty-lines': ['warn', {
max: 2,
maxEOF: 1
}],
'@stylistic/quote-props': ['error', 'as-needed'],
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true
}
],
// These should be enabled as they add great value
// Only level warn for now
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
// Disable prop-types rule as we're using TypeScript
'react/prop-types': 'off',
'@typescript-eslint/consistent-type-imports': 'error'
}
},
{
// disable type-aware linting on JS files
files: ['**/*.mjs', '**/*.cjs', '**/*.js'],
...tseslint.configs.disableTypeChecked
},
{
// enable jest rules on test files
files: ['test/**'],
...jestPlugin.configs['flat/recommended']
}
)