-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.eslintrc.js
162 lines (162 loc) · 4.6 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'google',
'plugin:react/recommended',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
plugins: ['react', '@typescript-eslint', 'unused-imports'],
env: {
browser: true,
es2021: true,
node: true,
},
globals: {
window: true,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
rules: {
'@typescript-eslint/type-annotation-spacing': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': [
'warn',
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowDirectConstAssertionInArrowFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: false,
},
],
'@typescript-eslint/explicit-module-boundary-types': [
'warn',
{
allowArgumentsExplicitlyTypedAsAny: true,
allowDirectConstAssertionInArrowFunctions: true,
allowedNames: [],
allowHigherOrderFunctions: true,
allowTypedFunctionExpressions: true,
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-invalid-this': ['error'],
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '_' }],
'@typescript-eslint/no-empty-function': ['warn'],
'@typescript-eslint/no-non-null-assertion': ['off'],
'func-call-spacing': 'off',
camelcase: 'off',
'arrow-parens': ['error', 'always'],
indent: [
'error',
2,
{
ignoredNodes: [
'FunctionExpression > .params[decorators.length > 0]',
'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
'ClassBody.body > PropertyDefinition[decorators.length > 0] > .key',
],
},
],
// https://github.com/typescript-eslint/typescript-eslint/issues/1824
// "@typescript-eslint/indent": ["error", 2],
'max-len': [
1,
{
code: 110,
ignoreComments: true,
ignorePattern:
"^(\\s*[a-zA-Z_]+: '[^']+'[,;]*)|(.*interpolate.*)|(.*require.*)|(.*_\\.template.*)|(<svg .*)|(<rect .*)|(<polygon .*)$",
ignoreRegExpLiterals: true,
ignoreTrailingComments: true,
ignoreUrls: true,
tabWidth: 2,
},
],
'no-console': 'warn',
'no-invalid-this': 'off',
'no-mixed-operators': 'error',
'no-multiple-empty-lines': ['warn', { max: 1 }],
'no-nested-ternary': 'error',
'no-param-reassign': 'error',
'no-plusplus': 'error',
'object-curly-spacing': ['warn', 'always'],
'quote-props': ['error', 'as-needed'],
quotes: ['error', 'single'],
radix: [1, 'as-needed'],
'react/display-name': 'off',
'react/jsx-wrap-multilines': [
'warn',
{
arrow: 'parens',
assignment: 'parens',
condition: 'parens',
declaration: 'parens',
logical: 'parens',
prop: 'parens',
return: 'parens-new-line',
},
],
'react/sort-comp': [
'warn',
{
groups: {
lifecycle: [
'statics',
'displayName',
'propTypes',
'contextTypes',
'childContextTypes',
'mixins',
'defaultProps',
'constructor',
'getDefaultProps',
'state',
'getInitialState',
'getChildContext',
'getDerivedStateFromProps',
'componentWillMount',
'UNSAFE_componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'UNSAFE_componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'UNSAFE_componentWillUpdate',
'getSnapshotBeforeUpdate',
'componentDidUpdate',
'componentDidCatch',
'componentWillUnmount',
],
},
order: ['static-methods', 'instance-variables', 'lifecycle', 'everything-else', 'render'],
},
],
'require-jsdoc': 'off',
semi: ['error', 'always'],
'space-infix-ops': ['error', { int32Hint: false }],
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
args: 'after-used',
argsIgnorePattern: '^_',
vars: 'all',
varsIgnorePattern: '^_',
},
],
eqeqeq: ['error', 'always'],
},
settings: {
react: {
version: 'detect',
},
},
};