-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.eslintrc.js
98 lines (98 loc) · 2.75 KB
/
.eslintrc.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
96
97
98
module.exports = {
root: true,
extends: [
'eslint:recommended',
'airbnb-base',
'airbnb-typescript/base',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/recommended',
'plugin:import/typescript',
],
env: {
browser: true,
node: true,
es6: true,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
// 尝试解析 @types packages
alwaysTryTypes: true,
},
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2022,
project: [
'./tsconfig.eslint.json',
'./packages/*/tsconfig.json',
],
},
plugins: ['import', '@typescript-eslint'],
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
// https://typescript-eslint.io/rules/indent/#how-to-use
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/no-unused-vars': 0,
'no-unused-expressions': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-unused-expressions': 2,
'@typescript-eslint/consistent-type-imports': [2, { disallowTypeAnnotations: false }],
},
},
{
files: ['*.js', '*.cjs', '*.json'],
rules: {
indent: ['error', 2],
'no-shadow': 1,
},
},
],
rules: {
'node/no-unsupported-features/es-syntax': 0,
'global-require': 0,
'consistent-return': 0,
'no-process-exit': 0,
'no-param-reassign': 0,
'class-methods-use-this': 0,
'eol-last': 0,
'no-undef': 0,
'no-unused-vars': 0,
'max-len': 0,
indent: 0,
'no-shadow': 'off',
'no-use-before-define': 0,
'react/no-unstable-nested-components': 0,
'react/react-in-jsx-scope': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/prefer-namespace-keyword': 0,
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
'@typescript-eslint/no-floating-promises': 0,
'@typescript-eslint/no-unsafe-member-access': 0,
'@typescript-eslint/no-unsafe-call': 0,
'@typescript-eslint/no-unsafe-return': 0,
'@typescript-eslint/no-unsafe-assignment': 0,
'@typescript-eslint/no-misused-promises': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unsafe-argument': 0,
'space-infix-ops': 1,
'keyword-spacing': ['error', {
before: true,
after: true,
}],
'object-curly-spacing': ['error', 'always'],
'import/no-extraneous-dependencies': 0,
'import/prefer-default-export': 0,
'import/extensions': 0,
'no-console': 0,
},
};