eslint-config-entva-typescript-base 1.1.0 → 2.0.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/eslint.config.js +3 -0
- package/index.js +253 -28
- package/package.json +14 -8
package/eslint.config.js
ADDED
package/index.js
CHANGED
|
@@ -1,31 +1,256 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import baseConfig from 'eslint-config-entva-base';
|
|
2
|
+
import importPlugin from 'eslint-plugin-import';
|
|
3
|
+
import globals from 'globals';
|
|
4
|
+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
5
|
+
import tsParser from '@typescript-eslint/parser';
|
|
6
|
+
import stylisticTs from '@stylistic/eslint-plugin-ts';
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
...baseConfig,
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.{js,mjs,cjs,ts}'],
|
|
12
|
+
plugins: {
|
|
13
|
+
import: importPlugin,
|
|
14
|
+
'@typescript-eslint': typescriptEslint,
|
|
15
|
+
'@stylistic/ts': stylisticTs,
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
languageOptions: {
|
|
19
|
+
globals: {
|
|
20
|
+
...globals.browser,
|
|
21
|
+
...globals.node,
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
parser: tsParser,
|
|
25
|
+
ecmaVersion: 'latest',
|
|
26
|
+
sourceType: 'module',
|
|
27
|
+
|
|
28
|
+
parserOptions: {
|
|
29
|
+
parser: '@typescript-eslint/parser',
|
|
30
|
+
project: './tsconfig.json',
|
|
31
|
+
|
|
32
|
+
ecmaFeatures: {
|
|
33
|
+
generators: false,
|
|
34
|
+
objectLiteralDuplicateProperties: false,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
settings: {
|
|
40
|
+
'import/parsers': {
|
|
41
|
+
'@typescript-eslint/parser': ['.ts', '.d.ts'],
|
|
13
42
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'import/extensions': [
|
|
20
|
-
'error',
|
|
21
|
-
'ignorePackages',
|
|
22
|
-
{
|
|
23
|
-
'': 'never',
|
|
24
|
-
js: 'never',
|
|
25
|
-
jsx: 'never',
|
|
26
|
-
ts: 'never',
|
|
27
|
-
tsx: 'never',
|
|
43
|
+
|
|
44
|
+
'import/resolver': {
|
|
45
|
+
node: {
|
|
46
|
+
extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts'],
|
|
47
|
+
},
|
|
28
48
|
},
|
|
29
|
-
|
|
49
|
+
|
|
50
|
+
'import/extensions': ['.mjs', '.js', '.json', '.ts', '.d.ts'],
|
|
51
|
+
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
52
|
+
'import/core-modules': [],
|
|
53
|
+
'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
rules: {
|
|
57
|
+
'@stylistic/ts/member-delimiter-style': ['error', {
|
|
58
|
+
multiline: {
|
|
59
|
+
delimiter: 'comma',
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
singleline: {
|
|
63
|
+
delimiter: 'comma',
|
|
64
|
+
},
|
|
65
|
+
}],
|
|
66
|
+
|
|
67
|
+
'@typescript-eslint/no-explicit-any': ['error', {
|
|
68
|
+
ignoreRestArgs: true,
|
|
69
|
+
}],
|
|
70
|
+
|
|
71
|
+
'@typescript-eslint/naming-convention': ['error', {
|
|
72
|
+
selector: 'variable',
|
|
73
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
74
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
75
|
+
}, {
|
|
76
|
+
selector: 'function',
|
|
77
|
+
format: ['camelCase', 'PascalCase'],
|
|
78
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
79
|
+
}, {
|
|
80
|
+
selector: 'typeLike',
|
|
81
|
+
format: ['PascalCase'],
|
|
82
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
83
|
+
}],
|
|
84
|
+
|
|
85
|
+
'@stylistic/ts/brace-style': ['error', '1tbs', {
|
|
86
|
+
allowSingleLine: true,
|
|
87
|
+
}],
|
|
88
|
+
|
|
89
|
+
'@stylistic/ts/comma-dangle': ['error', {
|
|
90
|
+
arrays: 'always-multiline',
|
|
91
|
+
objects: 'always-multiline',
|
|
92
|
+
imports: 'always-multiline',
|
|
93
|
+
exports: 'always-multiline',
|
|
94
|
+
functions: 'always-multiline',
|
|
95
|
+
enums: 'always-multiline',
|
|
96
|
+
generics: 'always-multiline',
|
|
97
|
+
tuples: 'always-multiline',
|
|
98
|
+
}],
|
|
99
|
+
|
|
100
|
+
'@stylistic/ts/comma-spacing': ['error', {
|
|
101
|
+
before: false,
|
|
102
|
+
after: true,
|
|
103
|
+
}],
|
|
104
|
+
|
|
105
|
+
'@typescript-eslint/default-param-last': ['error'],
|
|
106
|
+
|
|
107
|
+
'@typescript-eslint/dot-notation': ['error', {
|
|
108
|
+
allowKeywords: true,
|
|
109
|
+
allowPattern: '',
|
|
110
|
+
allowPrivateClassPropertyAccess: false,
|
|
111
|
+
allowProtectedClassPropertyAccess: false,
|
|
112
|
+
allowIndexSignaturePropertyAccess: false,
|
|
113
|
+
}],
|
|
114
|
+
|
|
115
|
+
'@stylistic/ts/func-call-spacing': ['error', 'never'],
|
|
116
|
+
|
|
117
|
+
'@stylistic/ts/indent': ['error', 2, {
|
|
118
|
+
SwitchCase: 1,
|
|
119
|
+
VariableDeclarator: 1,
|
|
120
|
+
outerIIFEBody: 1,
|
|
121
|
+
|
|
122
|
+
FunctionDeclaration: {
|
|
123
|
+
parameters: 1,
|
|
124
|
+
body: 1,
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
FunctionExpression: {
|
|
128
|
+
parameters: 1,
|
|
129
|
+
body: 1,
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
CallExpression: {
|
|
133
|
+
arguments: 1,
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
ArrayExpression: 1,
|
|
137
|
+
ObjectExpression: 1,
|
|
138
|
+
ImportDeclaration: 1,
|
|
139
|
+
flatTernaryExpressions: false,
|
|
140
|
+
|
|
141
|
+
ignoredNodes: [
|
|
142
|
+
'JSXElement',
|
|
143
|
+
'JSXElement > *',
|
|
144
|
+
'JSXAttribute',
|
|
145
|
+
'JSXIdentifier',
|
|
146
|
+
'JSXNamespacedName',
|
|
147
|
+
'JSXMemberExpression',
|
|
148
|
+
'JSXSpreadAttribute',
|
|
149
|
+
'JSXExpressionContainer',
|
|
150
|
+
'JSXOpeningElement',
|
|
151
|
+
'JSXClosingElement',
|
|
152
|
+
'JSXFragment',
|
|
153
|
+
'JSXOpeningFragment',
|
|
154
|
+
'JSXClosingFragment',
|
|
155
|
+
'JSXText',
|
|
156
|
+
'JSXEmptyExpression',
|
|
157
|
+
'JSXSpreadChild',
|
|
158
|
+
],
|
|
159
|
+
|
|
160
|
+
ignoreComments: false,
|
|
161
|
+
offsetTernaryExpressions: false,
|
|
162
|
+
}],
|
|
163
|
+
|
|
164
|
+
'@stylistic/ts/keyword-spacing': ['error', {
|
|
165
|
+
before: true,
|
|
166
|
+
after: true,
|
|
167
|
+
|
|
168
|
+
overrides: {
|
|
169
|
+
return: {
|
|
170
|
+
after: true,
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
throw: {
|
|
174
|
+
after: true,
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
case: {
|
|
178
|
+
after: true,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
}],
|
|
182
|
+
|
|
183
|
+
'@stylistic/ts/lines-between-class-members': ['error', 'always', {
|
|
184
|
+
exceptAfterSingleLine: false,
|
|
185
|
+
exceptAfterOverload: true,
|
|
186
|
+
}],
|
|
187
|
+
|
|
188
|
+
'@typescript-eslint/no-array-constructor': ['error'],
|
|
189
|
+
'@typescript-eslint/no-dupe-class-members': ['error'],
|
|
190
|
+
|
|
191
|
+
'@typescript-eslint/no-empty-function': ['error', {
|
|
192
|
+
allow: ['arrowFunctions', 'functions', 'methods'],
|
|
193
|
+
}],
|
|
194
|
+
|
|
195
|
+
'@typescript-eslint/no-extra-parens': ['off', 'all', {
|
|
196
|
+
conditionalAssign: true,
|
|
197
|
+
nestedBinaryExpressions: false,
|
|
198
|
+
returnAssign: false,
|
|
199
|
+
ignoreJSX: 'all',
|
|
200
|
+
enforceForArrowConditionals: false,
|
|
201
|
+
}],
|
|
202
|
+
|
|
203
|
+
'@stylistic/ts/no-extra-semi': ['error'],
|
|
204
|
+
'@typescript-eslint/no-implied-eval': ['error'],
|
|
205
|
+
'@typescript-eslint/no-loss-of-precision': ['error'],
|
|
206
|
+
'@typescript-eslint/no-loop-func': ['error'],
|
|
207
|
+
|
|
208
|
+
'@typescript-eslint/no-magic-numbers': ['off', {
|
|
209
|
+
ignore: [],
|
|
210
|
+
ignoreArrayIndexes: true,
|
|
211
|
+
enforceConst: true,
|
|
212
|
+
detectObjects: false,
|
|
213
|
+
}],
|
|
214
|
+
|
|
215
|
+
'@typescript-eslint/no-redeclare': ['error'],
|
|
216
|
+
'@typescript-eslint/no-shadow': ['error'],
|
|
217
|
+
'@stylistic/ts/space-before-blocks': ['error'],
|
|
218
|
+
|
|
219
|
+
'@typescript-eslint/no-unused-expressions': ['error', {
|
|
220
|
+
allowShortCircuit: false,
|
|
221
|
+
allowTernary: false,
|
|
222
|
+
allowTaggedTemplates: false,
|
|
223
|
+
enforceForJSX: false,
|
|
224
|
+
}],
|
|
225
|
+
|
|
226
|
+
'@typescript-eslint/no-unused-vars': ['error', {
|
|
227
|
+
vars: 'all',
|
|
228
|
+
args: 'after-used',
|
|
229
|
+
ignoreRestSiblings: true,
|
|
230
|
+
}],
|
|
231
|
+
|
|
232
|
+
'@typescript-eslint/no-use-before-define': ['error', {
|
|
233
|
+
functions: true,
|
|
234
|
+
classes: true,
|
|
235
|
+
variables: true,
|
|
236
|
+
}],
|
|
237
|
+
|
|
238
|
+
'@typescript-eslint/no-useless-constructor': ['error'],
|
|
239
|
+
|
|
240
|
+
'@stylistic/ts/quotes': ['error', 'single', {
|
|
241
|
+
avoidEscape: true,
|
|
242
|
+
}],
|
|
243
|
+
|
|
244
|
+
'@stylistic/ts/space-before-function-paren': ['error', {
|
|
245
|
+
anonymous: 'always',
|
|
246
|
+
named: 'never',
|
|
247
|
+
asyncArrow: 'always',
|
|
248
|
+
}],
|
|
249
|
+
|
|
250
|
+
'@typescript-eslint/require-await': ['off'],
|
|
251
|
+
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
|
|
252
|
+
'@stylistic/ts/space-infix-ops': ['error'],
|
|
253
|
+
'@stylistic/ts/object-curly-spacing': ['error', 'always'],
|
|
254
|
+
},
|
|
30
255
|
},
|
|
31
|
-
|
|
256
|
+
];
|
package/package.json
CHANGED
|
@@ -4,15 +4,19 @@
|
|
|
4
4
|
"author": "Max Degterev <max@degterev.me>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"readmeFilename": "README.md",
|
|
7
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/entva/styleguide"
|
|
10
|
+
},
|
|
8
11
|
"bugs": "https://github.com/entva/styleguide/issues",
|
|
9
|
-
"version": "
|
|
12
|
+
"version": "2.0.0",
|
|
10
13
|
"keywords": [
|
|
11
14
|
"linter",
|
|
12
15
|
"config",
|
|
13
16
|
"eslint",
|
|
14
17
|
"typescript"
|
|
15
18
|
],
|
|
19
|
+
"type": "module",
|
|
16
20
|
"main": "index.js",
|
|
17
21
|
"scripts": {
|
|
18
22
|
"reinstall": "rm -rf node_modules package-lock.json && npm install",
|
|
@@ -21,15 +25,17 @@
|
|
|
21
25
|
"prepublishOnly": "npm test"
|
|
22
26
|
},
|
|
23
27
|
"devDependencies": {
|
|
24
|
-
"eslint": "^
|
|
28
|
+
"eslint": "^9.16.0"
|
|
25
29
|
},
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"eslint-
|
|
28
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
29
|
-
"@typescript-eslint/parser": "^
|
|
30
|
-
"eslint-config-
|
|
31
|
+
"@stylistic/eslint-plugin-ts": "^2.12.1",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
|
33
|
+
"@typescript-eslint/parser": "^8.18.0",
|
|
34
|
+
"eslint-config-entva-base": "^2.1.0",
|
|
35
|
+
"eslint-plugin-import": "^2.31.0",
|
|
36
|
+
"globals": "^15.13.0"
|
|
31
37
|
},
|
|
32
38
|
"peerDependencies": {
|
|
33
|
-
"eslint": "^
|
|
39
|
+
"eslint": "^9.x.x"
|
|
34
40
|
}
|
|
35
41
|
}
|