-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
.eslintrc.js
71 lines (69 loc) · 2.51 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
/**
* @type {import('@types/eslint').Linter.BaseConfig}
*/
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:prettier/recommended',
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
node: true,
},
},
settings: {
react: {
version: 'detect',
},
},
plugins: ['react-hooks'],
rules: {
// typescript
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
// 不限制
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/explicit-function-return-type': [
'off',
{ allowExpressions: true, allowTypedFunctionExpressions: true },
],
// hooks
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// misc
'no-implicit-coercion': 'off',
'no-useless-escape': 'off',
'array-callback-return': 'off',
'no-useless-constructor': 'off',
'no-empty-function': ['error', { allow: ['constructors'] }],
quotes: ['error', 'single', { allowTemplateLiterals: true }],
'no-undef': 'off',
},
overrides: [
{
files: ['**/*.js'],
excludedFiles: ['node_modules', './dist/**/*'],
rules: {
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/camelcase': 'off',
},
},
{
files: ['**/*.test.tsx'],
excludedFiles: ['node_modules', './dist/**/*'],
env: {
node: true,
},
},
],
};