-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
89 lines (87 loc) · 2.24 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
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
module.exports = {
root: true,
extends: [
'prettier',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'react-app',
// 'react-app/jest',
'airbnb',
],
// parser: '@typescript-eslint/parser',
plugins: [
'prettier',
// '@typescript-eslint',
],
globals: {
// 这里填入你的项目需要的全局变量
// 这里值为 false 表示这个全局变量不允许被重新赋值,比如:
//
// React: false,
// ReactDOM: false
},
settings: {
'import/resolver': { node: { extensions: ['.mjs', '.js', '.json', '.ts', '.tsx'] } },
// 'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx'],
},
rules: {
// 这里填入你的项目需要的个性化配置
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
mjs: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'no-unused-vars': 'warn',
'no-shadow': 'off',
'max-len': [
'warn',
{
code: 120,
ignoreComments: true,
ignoreStrings: true,
},
],
yoda: ['error', 'always'],
'no-undefined': 1,
'no-debugger': 1,
'arrow-body-style': ['off', 'as-needed'],
'object-curly-newline': [
'error',
{
ObjectExpression: { consistent: true },
ObjectPattern: { consistent: true },
ImportDeclaration: { consistent: true },
ExportDeclaration: { consistent: true },
},
],
'prefer-promise-reject-errors': 'warn',
'implicit-arrow-linebreak': 'off',
'operator-linebreak': 'off',
indent: 'warn',
'react/jsx-wrap-multilines': [
'error',
{
declaration: 'parens',
assignment: 'parens',
return: 'parens',
arrow: 'parens',
condition: 'parens',
logical: 'parens',
prop: 'ignore',
},
],
'react/jsx-curly-newline': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.tsx', '.ts'] }],
'react/require-default-props': 'off',
'react/function-component-definition': 'off',
'react/jsx-indent': ['warn', 2],
// '@typescript-eslint/no-unused-vars': 'error',
// '@typescript-eslint/no-shadow': 'error',
},
};