forked from YTKN28/spark-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
63 lines (62 loc) · 2.22 KB
/
.eslintrc.cjs
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
/* eslint-env node */
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: ['typestrict', 'plugin:react/recommended', 'plugin:react-hooks/recommended', 'plugin:react/jsx-runtime'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: true,
tsconfigRootDir: __dirname,
},
plugins: ['react-refresh', 'simple-import-sort', 'unused-imports', 'import'],
rules: {
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
'no-throw-literal': 'error',
'func-style': ['error', 'declaration'],
'react-refresh/only-export-components': ['error', { allowConstantExport: true }],
'@typescript-eslint/explicit-function-return-type': [
'error',
{ allowExpressions: true, allowDirectConstAssertionInArrowFunctions: true },
],
'@typescript-eslint/no-useless-constructor': 'error',
// this rule can't find automatically mistakes and needs to be guided
// 'import/no-internal-modules': ['error', { forbid: ['**/utils/*'] }],
'import/no-useless-path-segments': ['error', { noUselessIndex: true }],
'no-console': 'error',
'no-debugger': 'error',
'no-duplicate-imports': 'error',
'no-with': 'error',
'one-var': ['error', { initialized: 'never' }],
'prefer-const': ['error', { destructuring: 'all' }],
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'unused-imports/no-unused-imports-ts': 'error',
'no-restricted-imports': ['error', {
'patterns': [{
'group': ['../../../**/*'],
'message': 'consider using @ instead of going too many folders up.'
}]
}],
'react/prop-types': 'off',
'react/no-unescaped-entities': 'off',
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
},
overrides: [
{
// react components don't have to have explicit return type
files: ['*.tsx'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
{
// react components don't have to have explicit return type
files: ['*.stories.tsx'],
rules: {
'react-refresh/only-export-components': ['off'],
},
},
],
}