-
Notifications
You must be signed in to change notification settings - Fork 6
/
.eslintrc.js
executable file
·94 lines (92 loc) · 2.58 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
// last update 2022/5/26
// https://gist.github.com/ken20001207/dcf9e4e5f10d44a3faa511bebd55437f/
// eslint-disable-next-line max-len
// pnpm i -D typescript eslint eslint-plugin-react @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import
module.exports = {
env: { browser: true },
extends: ['plugin:react/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 12,
sourceType: 'module',
project: './tsconfig.json',
},
settings: { react: { version: 'detect' } },
plugins: ['react', '@typescript-eslint', 'import'],
rules: {
'no-unused-vars': 'off',
'no-invalid-this': 'off',
'require-jsdoc': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'max-len': [
'warn',
80,
{
ignorePattern: '^import\\s.+\\sfrom\\s.+;$',
ignoreUrls: true,
},
],
'quote-props': ['warn', 'consistent-as-needed'],
'indent': ['warn', 2, { SwitchCase: 1 }],
'react/jsx-indent': ['warn', 2],
'react/jsx-indent-props': ['warn', 2],
'quotes': ['warn', 'single'],
'semi': ['warn', 'always'],
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/naming-convention': [
'warn',
{
selector: 'memberLike',
modifiers: ['private'],
format: ['camelCase'],
leadingUnderscore: 'require',
},
{
selector: 'variable',
types: ['boolean'],
format: ['PascalCase'],
prefix: ['is', 'should', 'has', 'can', 'did', 'will', 'ok'],
},
],
'object-curly-newline': ['warn', { multiline: true }],
'object-curly-spacing': ['warn', 'always'],
'comma-spacing': ['warn', {
before: false,
after: true
}],
'no-multi-spaces': ['warn'],
'import/order': [
'warn', {
groups: [
'index',
'sibling',
'parent',
'internal',
'external',
'builtin',
'object',
'type'
]
}
],
'react/react-in-jsx-scope': 'off',
'no-multiple-empty-lines': ['warn', {
max: 1,
maxEOF: 1,
maxBOF: 0
}],
'eol-last': 1,
'react/jsx-first-prop-new-line': ['warn', 'multiline'],
'react/jsx-max-props-per-line': ['warn', {
maximum: 1,
when: 'multiline'
}],
'array-element-newline': ['warn', 'consistent'],
'jsx-quotes': ['warn', 'prefer-double'],
'array-bracket-newline': ['warn', { multiline: true }],
'no-trailing-spaces': 'warn',
'space-in-parens': ['warn', 'never'],
},
};