eslint-config-entva-typescript-base 2.18.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +181 -176
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ignoreRule, mainRule, testRule } from 'eslint-config-entva-base';
|
|
1
|
+
import { ignoreRule, mainRule as baseMainRule, testRule as baseTestRule } from 'eslint-config-entva-base';
|
|
2
2
|
import importPlugin from 'eslint-plugin-import';
|
|
3
3
|
import globals from 'globals';
|
|
4
4
|
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
@@ -12,196 +12,201 @@ const getOverrides = (base, rules, overridePrefix) => rules.reduce((acc, rule) =
|
|
|
12
12
|
return acc;
|
|
13
13
|
}, {});
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'@typescript-eslint': typescriptEslint,
|
|
23
|
-
'@stylistic/ts': stylisticTs,
|
|
24
|
-
},
|
|
15
|
+
export const mainRule = {
|
|
16
|
+
files: ['**/*.{ts,tsx}'],
|
|
17
|
+
plugins: {
|
|
18
|
+
import: importPlugin,
|
|
19
|
+
'@typescript-eslint': typescriptEslint,
|
|
20
|
+
'@stylistic/ts': stylisticTs,
|
|
21
|
+
},
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
languageOptions: {
|
|
24
|
+
globals: {
|
|
25
|
+
...globals.browser,
|
|
26
|
+
...globals.node,
|
|
27
|
+
},
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
parser: tsParser,
|
|
30
|
+
ecmaVersion: 'latest',
|
|
31
|
+
sourceType: 'module',
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
parserOptions: {
|
|
34
|
+
parser: '@typescript-eslint/parser',
|
|
35
|
+
project: './tsconfig.json',
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
37
|
+
ecmaFeatures: {
|
|
38
|
+
generators: false,
|
|
39
|
+
objectLiteralDuplicateProperties: false,
|
|
40
|
+
jsx: true,
|
|
45
41
|
},
|
|
46
42
|
},
|
|
43
|
+
},
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
settings: {
|
|
46
|
+
'import/parsers': {
|
|
47
|
+
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
48
|
+
},
|
|
52
49
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
50
|
+
'import/resolver': {
|
|
51
|
+
node: {
|
|
52
|
+
extensions: ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
|
|
57
53
|
},
|
|
54
|
+
},
|
|
58
55
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
react: {
|
|
65
|
-
pragma: 'React',
|
|
66
|
-
version: 'detect',
|
|
67
|
-
},
|
|
56
|
+
'import/extensions': ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
|
|
57
|
+
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
58
|
+
'import/core-modules': [],
|
|
59
|
+
'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
|
|
68
60
|
|
|
69
|
-
|
|
61
|
+
react: {
|
|
62
|
+
pragma: 'React',
|
|
63
|
+
version: 'detect',
|
|
70
64
|
},
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
...mainRule.rules,
|
|
74
|
-
...getOverrides(
|
|
75
|
-
mainRule.rules,
|
|
76
|
-
[
|
|
77
|
-
'no-array-constructor',
|
|
78
|
-
'no-useless-constructor',
|
|
79
|
-
'no-empty-function',
|
|
80
|
-
'no-dupe-class-members',
|
|
81
|
-
'default-param-last',
|
|
82
|
-
'dot-notation',
|
|
83
|
-
'naming-convention',
|
|
84
|
-
'no-shadow',
|
|
85
|
-
'no-unused-vars',
|
|
86
|
-
],
|
|
87
|
-
'@typescript-eslint',
|
|
88
|
-
),
|
|
89
|
-
...getOverrides(
|
|
90
|
-
mainRule.rules,
|
|
91
|
-
[
|
|
92
|
-
'space-before-function-paren',
|
|
93
|
-
'lines-between-class-members',
|
|
94
|
-
'space-before-blocks',
|
|
95
|
-
'brace-style',
|
|
96
|
-
'indent',
|
|
97
|
-
'keyword-spacing',
|
|
98
|
-
'space-infix-ops',
|
|
99
|
-
'comma-spacing',
|
|
100
|
-
'comma-dangle',
|
|
101
|
-
'object-curly-spacing',
|
|
102
|
-
'quotes',
|
|
103
|
-
],
|
|
104
|
-
'@stylistic/ts',
|
|
105
|
-
),
|
|
106
|
-
|
|
107
|
-
'@typescript-eslint/no-implied-eval': ['error'],
|
|
108
|
-
'@typescript-eslint/no-loss-of-precision': ['error'],
|
|
109
|
-
'@typescript-eslint/no-loop-func': ['error'],
|
|
110
|
-
'@typescript-eslint/no-magic-numbers': ['off', {
|
|
111
|
-
ignore: [],
|
|
112
|
-
ignoreArrayIndexes: true,
|
|
113
|
-
enforceConst: true,
|
|
114
|
-
detectObjects: false,
|
|
115
|
-
}],
|
|
116
|
-
|
|
117
|
-
'@typescript-eslint/no-redeclare': ['error'],
|
|
118
|
-
'@typescript-eslint/no-unused-expressions': ['error', {
|
|
119
|
-
allowShortCircuit: false,
|
|
120
|
-
allowTernary: false,
|
|
121
|
-
allowTaggedTemplates: false,
|
|
122
|
-
enforceForJSX: false,
|
|
123
|
-
}],
|
|
124
|
-
|
|
125
|
-
'@typescript-eslint/no-use-before-define': ['error', {
|
|
126
|
-
functions: true,
|
|
127
|
-
classes: true,
|
|
128
|
-
variables: true,
|
|
129
|
-
}],
|
|
130
|
-
|
|
131
|
-
'@typescript-eslint/require-await': ['off'],
|
|
132
|
-
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
|
|
133
|
-
|
|
134
|
-
'@typescript-eslint/no-explicit-any': ['error', {
|
|
135
|
-
ignoreRestArgs: true,
|
|
136
|
-
}],
|
|
137
|
-
|
|
138
|
-
'@typescript-eslint/naming-convention': ['error', {
|
|
139
|
-
selector: 'variable',
|
|
140
|
-
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
141
|
-
leadingUnderscore: 'allowSingleOrDouble',
|
|
142
|
-
}, {
|
|
143
|
-
selector: 'function',
|
|
144
|
-
format: ['camelCase', 'PascalCase'],
|
|
145
|
-
leadingUnderscore: 'allowSingleOrDouble',
|
|
146
|
-
}, {
|
|
147
|
-
selector: 'typeLike',
|
|
148
|
-
format: ['PascalCase'],
|
|
149
|
-
leadingUnderscore: 'allowSingleOrDouble',
|
|
150
|
-
}],
|
|
151
|
-
|
|
152
|
-
'@typescript-eslint/no-extra-parens': ['off', 'all', {
|
|
153
|
-
conditionalAssign: true,
|
|
154
|
-
nestedBinaryExpressions: false,
|
|
155
|
-
returnAssign: false,
|
|
156
|
-
ignoreJSX: 'all',
|
|
157
|
-
enforceForArrowConditionals: false,
|
|
158
|
-
}],
|
|
159
|
-
|
|
160
|
-
'@stylistic/ts/member-delimiter-style': ['error', {
|
|
161
|
-
multiline: {
|
|
162
|
-
delimiter: 'comma',
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
singleline: {
|
|
166
|
-
delimiter: 'comma',
|
|
167
|
-
},
|
|
168
|
-
}],
|
|
169
|
-
'@stylistic/ts/func-call-spacing': ['error', 'never'],
|
|
170
|
-
'@stylistic/ts/no-extra-semi': ['error'],
|
|
171
|
-
'@stylistic/ts/comma-dangle': ['error', {
|
|
172
|
-
arrays: 'always-multiline',
|
|
173
|
-
objects: 'always-multiline',
|
|
174
|
-
imports: 'always-multiline',
|
|
175
|
-
exports: 'always-multiline',
|
|
176
|
-
functions: 'always-multiline',
|
|
177
|
-
enums: 'always-multiline',
|
|
178
|
-
generics: 'always-multiline',
|
|
179
|
-
tuples: 'always-multiline',
|
|
180
|
-
}],
|
|
181
|
-
},
|
|
66
|
+
propWrapperFunctions: ['forbidExtraProps', 'exact', 'Object.freeze'],
|
|
182
67
|
},
|
|
183
|
-
|
|
184
|
-
{
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
68
|
+
|
|
69
|
+
rules: {
|
|
70
|
+
...baseMainRule.rules,
|
|
71
|
+
...getOverrides(
|
|
72
|
+
baseMainRule.rules,
|
|
73
|
+
[
|
|
74
|
+
'no-array-constructor',
|
|
75
|
+
'no-useless-constructor',
|
|
76
|
+
'no-empty-function',
|
|
77
|
+
'no-dupe-class-members',
|
|
78
|
+
'default-param-last',
|
|
79
|
+
'dot-notation',
|
|
80
|
+
'naming-convention',
|
|
81
|
+
'no-shadow',
|
|
82
|
+
'no-unused-vars',
|
|
83
|
+
],
|
|
84
|
+
'@typescript-eslint',
|
|
85
|
+
),
|
|
86
|
+
...getOverrides(
|
|
87
|
+
baseMainRule.rules,
|
|
88
|
+
[
|
|
89
|
+
'space-before-function-paren',
|
|
90
|
+
'lines-between-class-members',
|
|
91
|
+
'space-before-blocks',
|
|
92
|
+
'brace-style',
|
|
93
|
+
'indent',
|
|
94
|
+
'keyword-spacing',
|
|
95
|
+
'space-infix-ops',
|
|
96
|
+
'comma-spacing',
|
|
97
|
+
'comma-dangle',
|
|
98
|
+
'object-curly-spacing',
|
|
99
|
+
'quotes',
|
|
100
|
+
],
|
|
101
|
+
'@stylistic/ts',
|
|
102
|
+
),
|
|
103
|
+
|
|
104
|
+
'@typescript-eslint/no-implied-eval': ['error'],
|
|
105
|
+
'@typescript-eslint/no-loss-of-precision': ['error'],
|
|
106
|
+
'@typescript-eslint/no-loop-func': ['error'],
|
|
107
|
+
'@typescript-eslint/no-magic-numbers': ['off', {
|
|
108
|
+
ignore: [],
|
|
109
|
+
ignoreArrayIndexes: true,
|
|
110
|
+
enforceConst: true,
|
|
111
|
+
detectObjects: false,
|
|
112
|
+
}],
|
|
113
|
+
|
|
114
|
+
'@typescript-eslint/no-redeclare': ['error'],
|
|
115
|
+
'@typescript-eslint/no-unused-expressions': ['error', {
|
|
116
|
+
allowShortCircuit: false,
|
|
117
|
+
allowTernary: false,
|
|
118
|
+
allowTaggedTemplates: false,
|
|
119
|
+
enforceForJSX: false,
|
|
120
|
+
}],
|
|
121
|
+
|
|
122
|
+
'@typescript-eslint/no-use-before-define': ['error', {
|
|
123
|
+
functions: true,
|
|
124
|
+
classes: true,
|
|
125
|
+
variables: true,
|
|
126
|
+
}],
|
|
127
|
+
|
|
128
|
+
'@typescript-eslint/require-await': ['off'],
|
|
129
|
+
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
|
|
130
|
+
|
|
131
|
+
'@typescript-eslint/no-explicit-any': ['error', {
|
|
132
|
+
ignoreRestArgs: true,
|
|
133
|
+
}],
|
|
134
|
+
|
|
135
|
+
'@typescript-eslint/naming-convention': ['error', {
|
|
136
|
+
selector: 'variable',
|
|
137
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
138
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
139
|
+
}, {
|
|
140
|
+
selector: 'function',
|
|
141
|
+
format: ['camelCase', 'PascalCase'],
|
|
142
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
143
|
+
}, {
|
|
144
|
+
selector: 'typeLike',
|
|
145
|
+
format: ['PascalCase'],
|
|
146
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
147
|
+
}],
|
|
148
|
+
|
|
149
|
+
'@typescript-eslint/no-extra-parens': ['off', 'all', {
|
|
150
|
+
conditionalAssign: true,
|
|
151
|
+
nestedBinaryExpressions: false,
|
|
152
|
+
returnAssign: false,
|
|
153
|
+
ignoreJSX: 'all',
|
|
154
|
+
enforceForArrowConditionals: false,
|
|
155
|
+
}],
|
|
156
|
+
|
|
157
|
+
'@stylistic/ts/member-delimiter-style': ['error', {
|
|
158
|
+
multiline: {
|
|
159
|
+
delimiter: 'comma',
|
|
195
160
|
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
161
|
+
|
|
162
|
+
singleline: {
|
|
163
|
+
delimiter: 'comma',
|
|
164
|
+
},
|
|
165
|
+
}],
|
|
166
|
+
'@stylistic/ts/func-call-spacing': ['error', 'never'],
|
|
167
|
+
'@stylistic/ts/no-extra-semi': ['error'],
|
|
168
|
+
'@stylistic/ts/comma-dangle': ['error', {
|
|
169
|
+
arrays: 'always-multiline',
|
|
170
|
+
objects: 'always-multiline',
|
|
171
|
+
imports: 'always-multiline',
|
|
172
|
+
exports: 'always-multiline',
|
|
173
|
+
functions: 'always-multiline',
|
|
174
|
+
enums: 'always-multiline',
|
|
175
|
+
generics: 'always-multiline',
|
|
176
|
+
tuples: 'always-multiline',
|
|
177
|
+
}],
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export const testRule = {
|
|
182
|
+
files: [
|
|
183
|
+
'**/*.test.ts',
|
|
184
|
+
'**/*.test.tsx',
|
|
185
|
+
'**/*.spec.ts',
|
|
186
|
+
'**/*.spec.tsx',
|
|
187
|
+
'**/__tests__/**',
|
|
188
|
+
],
|
|
189
|
+
languageOptions: {
|
|
190
|
+
globals: {
|
|
191
|
+
...globals.jest,
|
|
205
192
|
},
|
|
206
193
|
},
|
|
194
|
+
rules: {
|
|
195
|
+
...baseTestRule.rules,
|
|
196
|
+
...getOverrides(
|
|
197
|
+
baseTestRule.rules,
|
|
198
|
+
[
|
|
199
|
+
'no-unused-vars',
|
|
200
|
+
],
|
|
201
|
+
'@typescript-eslint',
|
|
202
|
+
),
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export default [
|
|
207
|
+
ignoreRule,
|
|
208
|
+
baseMainRule,
|
|
209
|
+
mainRule,
|
|
210
|
+
baseTestRule,
|
|
211
|
+
testRule,
|
|
207
212
|
];
|