@cto.af/eslint-config 3.0.1 → 3.1.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/README.md +46 -0
- package/index.js +104 -74
- package/jsdoc.js +10 -0
- package/package.json +18 -14
- package/ts.js +141 -49
package/README.md
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
+
# @cto-af/eslint-config
|
|
2
|
+
|
|
1
3
|
EsLint rules for [cto.af](https://cto.af) projects.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -D eslint @cto-af/eslint-config
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## CommonJS project:
|
|
12
|
+
|
|
13
|
+
.eslintrc.js
|
|
14
|
+
```js
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
root: true,
|
|
19
|
+
extends: ['@cto.af'],
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## ES6 project:
|
|
24
|
+
|
|
25
|
+
.eslintrc.cjs
|
|
26
|
+
```js
|
|
27
|
+
'use strict';
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
root: true,
|
|
31
|
+
extends: ['@cto.af/eslint-config/modules'],
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## TS Project:
|
|
36
|
+
|
|
37
|
+
install:
|
|
38
|
+
```sh
|
|
39
|
+
npm install -D typescript @typescript-eslint/eslint-plugin @typescript-eslint/parser
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
.eslintrc.cjs
|
|
43
|
+
```js
|
|
44
|
+
module.exports = {
|
|
45
|
+
extends: '@cto.af/eslint-config/modules'
|
|
46
|
+
}
|
|
47
|
+
```
|
package/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// Last updated 2024-01-23
|
|
4
|
+
// "@stylistic/eslint-plugin": "1.5.4",
|
|
5
|
+
// "@typescript-eslint/eslint-plugin": "6.19.1"
|
|
6
|
+
// "eslint-plugin-n": "16.6.2"
|
|
7
|
+
|
|
3
8
|
module.exports = {
|
|
4
9
|
env: {
|
|
5
10
|
node: true,
|
|
@@ -8,6 +13,7 @@ module.exports = {
|
|
|
8
13
|
},
|
|
9
14
|
plugins: [
|
|
10
15
|
'n',
|
|
16
|
+
'@stylistic',
|
|
11
17
|
],
|
|
12
18
|
ignorePatterns: [
|
|
13
19
|
'coverage/',
|
|
@@ -120,6 +126,7 @@ module.exports = {
|
|
|
120
126
|
'id-length': 'off', // Not needed
|
|
121
127
|
'id-match': 'off', // Not needed
|
|
122
128
|
'init-declarations': 'error',
|
|
129
|
+
'line-comment-position': 'off', // I'm all over the place on these
|
|
123
130
|
'logical-assignment-operators': 'off', // No.
|
|
124
131
|
'max-classes-per-file': 'off', // No.
|
|
125
132
|
'max-depth': 'off', // No.
|
|
@@ -135,7 +142,6 @@ module.exports = {
|
|
|
135
142
|
'no-bitwise': 'off', // Lol. Not in these projects
|
|
136
143
|
'no-caller': 'error',
|
|
137
144
|
'no-case-declarations': 'error',
|
|
138
|
-
'no-confusing-arrow': 'error',
|
|
139
145
|
'no-console': 'error',
|
|
140
146
|
'no-continue': 'off', // Why?
|
|
141
147
|
'no-delete-var': 'error',
|
|
@@ -150,8 +156,6 @@ module.exports = {
|
|
|
150
156
|
'no-extra-bind': 'error',
|
|
151
157
|
'no-extra-boolean-cast': 'error',
|
|
152
158
|
'no-extra-label': 'error',
|
|
153
|
-
'no-extra-semi': 'error',
|
|
154
|
-
'no-floating-decimal': 'error',
|
|
155
159
|
'no-global-assign': 'error',
|
|
156
160
|
'no-implicit-coercion': 'error',
|
|
157
161
|
'no-implicit-globals': 'error',
|
|
@@ -164,18 +168,16 @@ module.exports = {
|
|
|
164
168
|
'no-lone-blocks': 'error',
|
|
165
169
|
'no-lonely-if': 'error',
|
|
166
170
|
'no-loop-func': 'error',
|
|
167
|
-
// No shot at this for node-cbor. For other projects, yes.
|
|
168
|
-
'no-magic-numbers': 'off',
|
|
169
|
-
'no-mixed-operators': 'error',
|
|
171
|
+
'no-magic-numbers': 'off', // No shot at this for node-cbor. For other projects, yes.
|
|
170
172
|
'no-multi-assign': 'error',
|
|
171
173
|
'no-multi-str': 'error',
|
|
172
174
|
'no-negated-condition': 'error',
|
|
173
175
|
'no-nested-ternary': 'error',
|
|
174
176
|
'no-new': 'error',
|
|
175
177
|
'no-new-func': 'error',
|
|
176
|
-
'no-new-object': 'error',
|
|
177
178
|
'no-new-wrappers': 'warn',
|
|
178
179
|
'no-nonoctal-decimal-escape': 'error',
|
|
180
|
+
'no-object-constructor': 'error',
|
|
179
181
|
'no-octal': 'error',
|
|
180
182
|
'no-octal-escape': 'warn',
|
|
181
183
|
'no-param-reassign': 'off', // I do this all the time.
|
|
@@ -189,7 +191,6 @@ module.exports = {
|
|
|
189
191
|
'no-restricted-properties': 'off', // Not needed
|
|
190
192
|
'no-restricted-syntax': 'off', // Not needed
|
|
191
193
|
'no-return-assign': 'error',
|
|
192
|
-
'no-return-await': 'error',
|
|
193
194
|
'no-script-url': 'error',
|
|
194
195
|
'no-sequences': 'error',
|
|
195
196
|
'no-shadow': 'error',
|
|
@@ -216,7 +217,6 @@ module.exports = {
|
|
|
216
217
|
'no-with': 'error',
|
|
217
218
|
'object-shorthand': 'error',
|
|
218
219
|
'one-var': ['error', 'never'],
|
|
219
|
-
'one-var-declaration-per-line': 'error',
|
|
220
220
|
'operator-assignment': 'error',
|
|
221
221
|
'prefer-arrow-callback': 'error',
|
|
222
222
|
'prefer-const': 'error',
|
|
@@ -231,7 +231,6 @@ module.exports = {
|
|
|
231
231
|
'prefer-rest-params': 'error',
|
|
232
232
|
'prefer-spread': 'error',
|
|
233
233
|
'prefer-template': 'error',
|
|
234
|
-
'quote-props': ['error', 'consistent-as-needed'],
|
|
235
234
|
'radix': 'error',
|
|
236
235
|
'require-await': 'error',
|
|
237
236
|
'require-unicode-regexp': 'off', // No.
|
|
@@ -239,92 +238,123 @@ module.exports = {
|
|
|
239
238
|
'sort-imports': 'error',
|
|
240
239
|
'sort-keys': 'off', // Pedantic
|
|
241
240
|
'sort-vars': 'off', // Pedantic
|
|
242
|
-
'spaced-comment': ['error', 'always'],
|
|
243
241
|
'strict': ['error', 'global'],
|
|
244
242
|
'symbol-description': 'error',
|
|
243
|
+
'unicode-bom': 'error',
|
|
245
244
|
'vars-on-top': 'error',
|
|
246
245
|
'yoda': ['error', 'never', {exceptRange: true}],
|
|
247
246
|
|
|
248
|
-
// [
|
|
249
|
-
'array-bracket-newline': ['error', 'consistent'],
|
|
250
|
-
'array-bracket-spacing': ['error', 'never'],
|
|
251
|
-
'array-element-newline': ['error', 'consistent'],
|
|
252
|
-
'arrow-parens': ['error', 'as-needed'],
|
|
253
|
-
'arrow-spacing': 'error',
|
|
254
|
-
'block-spacing': ['error', 'always'],
|
|
255
|
-
'brace-style': ['error', '1tbs'],
|
|
256
|
-
'comma-dangle': ['error', {
|
|
247
|
+
// [Stylistc](https://eslint.style/packages/default)
|
|
248
|
+
'@stylistic/array-bracket-newline': ['error', 'consistent'],
|
|
249
|
+
'@stylistic/array-bracket-spacing': ['error', 'never'],
|
|
250
|
+
'@stylistic/array-element-newline': ['error', 'consistent'],
|
|
251
|
+
'@stylistic/arrow-parens': ['error', 'as-needed'],
|
|
252
|
+
'@stylistic/arrow-spacing': 'error',
|
|
253
|
+
'@stylistic/block-spacing': ['error', 'always'],
|
|
254
|
+
'@stylistic/brace-style': ['error', '1tbs'],
|
|
255
|
+
'@stylistic/comma-dangle': ['error', {
|
|
257
256
|
arrays: 'always-multiline',
|
|
258
257
|
objects: 'always-multiline',
|
|
259
258
|
imports: 'always-multiline',
|
|
260
259
|
exports: 'always-multiline',
|
|
261
260
|
functions: 'never',
|
|
262
261
|
}],
|
|
263
|
-
'comma-spacing': 'error',
|
|
264
|
-
'comma-style': ['error', 'last'],
|
|
265
|
-
'computed-property-spacing': 'error',
|
|
266
|
-
'dot-location': ['error', 'property'],
|
|
267
|
-
'eol-last': 'error',
|
|
268
|
-
'func-call-spacing': '
|
|
269
|
-
'function-call-argument-newline': ['error', 'consistent'],
|
|
270
|
-
'function-
|
|
271
|
-
'
|
|
272
|
-
'
|
|
273
|
-
'
|
|
274
|
-
'
|
|
275
|
-
'
|
|
276
|
-
|
|
277
|
-
'
|
|
278
|
-
'
|
|
279
|
-
'
|
|
262
|
+
'@stylistic/comma-spacing': 'error',
|
|
263
|
+
'@stylistic/comma-style': ['error', 'last'],
|
|
264
|
+
'@stylistic/computed-property-spacing': 'error',
|
|
265
|
+
'@stylistic/dot-location': ['error', 'property'],
|
|
266
|
+
'@stylistic/eol-last': 'error',
|
|
267
|
+
'@stylistic/func-call-spacing': 'off', // Renamed
|
|
268
|
+
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
|
269
|
+
'@stylistic/function-call-spacing': 'error',
|
|
270
|
+
'@stylistic/function-paren-newline': ['error', 'consistent'],
|
|
271
|
+
'@stylistic/generator-star-spacing': 'error',
|
|
272
|
+
'@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
|
|
273
|
+
'@stylistic/indent': ['error', 2, {SwitchCase: 1}],
|
|
274
|
+
'@stylistic/indent-binary-ops': 'off', // Not good enough
|
|
275
|
+
|
|
276
|
+
'@stylistic/jsx-child-element-spacing': 'off', // Not needed
|
|
277
|
+
'@stylistic/jsx-closing-bracket-location': 'off', // Not needed
|
|
278
|
+
'@stylistic/jsx-closing-tag-location': 'off', // Not needed
|
|
279
|
+
'@stylistic/jsx-curly-brace-presence': 'off', // Not needed
|
|
280
|
+
'@stylistic/jsx-curly-newline': 'off', // Not needed
|
|
281
|
+
'@stylistic/jsx-curly-spacing': 'off', // Not needed
|
|
282
|
+
'@stylistic/jsx-equals-spacing': 'off', // Not needed
|
|
283
|
+
'@stylistic/jsx-first-prop-new-line': 'off', // Not needed
|
|
284
|
+
'@stylistic/jsx-indent': 'off', // Not needed
|
|
285
|
+
'@stylistic/jsx-indent-props': 'off', // Not needed
|
|
286
|
+
'@stylistic/jsx-max-props-per-line': 'off', // Not needed
|
|
287
|
+
'@stylistic/jsx-newline': 'off', // Not needed
|
|
288
|
+
'@stylistic/jsx-one-expression-per-line': 'off', // Not needed
|
|
289
|
+
'@stylistic/jsx-props-no-multi-spaces': 'off', // Not needed
|
|
290
|
+
'@stylistic/jsx-quotes': 'off', // Not needed
|
|
291
|
+
'@stylistic/jsx-self-closing-comp': 'off', // Not needed
|
|
292
|
+
'@stylistic/jsx-sort-props': 'off', // Not needed
|
|
293
|
+
'@stylistic/jsx-tag-spacing': 'off', // Not needed
|
|
294
|
+
'@stylistic/jsx-wrap-multilines': 'off', // Not needed
|
|
295
|
+
|
|
296
|
+
'@stylistic/key-spacing': 'error',
|
|
297
|
+
'@stylistic/keyword-spacing': 'error',
|
|
298
|
+
'@stylistic/linebreak-style': 'error',
|
|
299
|
+
'@stylistic/lines-around-comment': ['error', {
|
|
280
300
|
allowBlockStart: true,
|
|
281
301
|
allowClassStart: true,
|
|
282
302
|
}],
|
|
283
|
-
'lines-between-class-members': ['error', 'always', {
|
|
303
|
+
'@stylistic/lines-between-class-members': ['error', 'always', {
|
|
284
304
|
exceptAfterSingleLine: true,
|
|
285
305
|
}],
|
|
286
|
-
'max-len': ['error', 80, {
|
|
306
|
+
'@stylistic/max-len': ['error', 80, {
|
|
287
307
|
ignoreRegExpLiterals: true,
|
|
288
308
|
ignoreStrings: true,
|
|
289
309
|
ignoreTemplateLiterals: true,
|
|
290
310
|
ignoreUrls: true,
|
|
291
311
|
}],
|
|
292
|
-
'max-statements-per-line': 'off',
|
|
293
|
-
'
|
|
294
|
-
'
|
|
295
|
-
'
|
|
296
|
-
'
|
|
297
|
-
'no-
|
|
298
|
-
'no-
|
|
299
|
-
'no-
|
|
300
|
-
'no-
|
|
301
|
-
'no-
|
|
302
|
-
'no-
|
|
303
|
-
'
|
|
304
|
-
'
|
|
305
|
-
'
|
|
306
|
-
'
|
|
307
|
-
'
|
|
308
|
-
'
|
|
309
|
-
'
|
|
310
|
-
'
|
|
311
|
-
'
|
|
312
|
+
'@stylistic/max-statements-per-line': 'off',
|
|
313
|
+
'@stylistic/member-delimiter-style': 'off',
|
|
314
|
+
'@stylistic/multiline-ternary': ['error', 'always-multiline'],
|
|
315
|
+
'@stylistic/new-parens': 'error',
|
|
316
|
+
'@stylistic/newline-per-chained-call': 'error',
|
|
317
|
+
'@stylistic/no-confusing-arrow': 'error',
|
|
318
|
+
'@stylistic/no-extra-parens': 'off', // Too fiddly to torn off everything.
|
|
319
|
+
'@stylistic/no-extra-semi': 'error',
|
|
320
|
+
'@stylistic/no-floating-decimal': 'error',
|
|
321
|
+
'@stylistic/no-mixed-operators': 'error',
|
|
322
|
+
'@stylistic/no-mixed-spaces-and-tabs': 'error',
|
|
323
|
+
'@stylistic/no-multi-spaces': 'error',
|
|
324
|
+
'@stylistic/no-multiple-empty-lines': ['error', {max: 1}],
|
|
325
|
+
'@stylistic/no-tabs': 'error',
|
|
326
|
+
'@stylistic/no-trailing-spaces': 'error',
|
|
327
|
+
'@stylistic/no-whitespace-before-property': 'error',
|
|
328
|
+
'@stylistic/nonblock-statement-body-position': 'error',
|
|
329
|
+
'@stylistic/object-curly-newline': 'error',
|
|
330
|
+
'@stylistic/object-curly-spacing': ['error', 'never'],
|
|
331
|
+
'@stylistic/object-property-newline': ['error', {allowAllPropertiesOnSameLine: true}],
|
|
332
|
+
'@stylistic/one-var-declaration-per-line': 'error',
|
|
333
|
+
'@stylistic/operator-linebreak': ['error', 'after'],
|
|
334
|
+
'@stylistic/padded-blocks': ['error', 'never'],
|
|
335
|
+
'@stylistic/padding-line-between-statements': 'error',
|
|
336
|
+
'@stylistic/quote-props': ['error', 'consistent-as-needed'],
|
|
337
|
+
'@stylistic/quotes': ['error', 'single', {avoidEscape: true}],
|
|
338
|
+
'@stylistic/rest-spread-spacing': ['error', 'never'],
|
|
312
339
|
// Massive breaking change. I changed my mind.
|
|
313
|
-
'semi': ['error', 'always'],
|
|
314
|
-
'semi-spacing': 'error',
|
|
315
|
-
'semi-style': ['error'],
|
|
316
|
-
'space-before-blocks': 'error',
|
|
317
|
-
'space-before-function-paren': ['error', 'never'],
|
|
318
|
-
'space-in-parens': 'error',
|
|
319
|
-
'space-infix-ops': ['error', {int32Hint: false}],
|
|
320
|
-
'space-unary-ops': 'error',
|
|
321
|
-
'
|
|
322
|
-
'
|
|
323
|
-
'template-
|
|
324
|
-
'
|
|
325
|
-
'
|
|
326
|
-
'
|
|
327
|
-
'
|
|
340
|
+
'@stylistic/semi': ['error', 'always'],
|
|
341
|
+
'@stylistic/semi-spacing': 'error',
|
|
342
|
+
'@stylistic/semi-style': ['error'],
|
|
343
|
+
'@stylistic/space-before-blocks': 'error',
|
|
344
|
+
'@stylistic/space-before-function-paren': ['error', 'never'],
|
|
345
|
+
'@stylistic/space-in-parens': 'error',
|
|
346
|
+
'@stylistic/space-infix-ops': ['error', {int32Hint: false}],
|
|
347
|
+
'@stylistic/space-unary-ops': 'error',
|
|
348
|
+
'@stylistic/spaced-comment': ['error', 'always'],
|
|
349
|
+
'@stylistic/switch-colon-spacing': 'error',
|
|
350
|
+
'@stylistic/template-curly-spacing': 'error',
|
|
351
|
+
'@stylistic/template-tag-spacing': 'error',
|
|
352
|
+
'@stylistic/type-annotation-spacing': 'off', // Not TS.
|
|
353
|
+
'@stylistic/type-generic-spacing': 'off', // Not TS.
|
|
354
|
+
'@stylistic/type-named-tuple-spacing': 'off', // Not TS.
|
|
355
|
+
'@stylistic/wrap-iife': 'error',
|
|
356
|
+
'@stylistic/wrap-regex': 'off', // No.
|
|
357
|
+
'@stylistic/yield-star-spacing': ['error', 'before'],
|
|
328
358
|
|
|
329
359
|
// [Possible Errors](https://github.com/eslint-community/eslint-plugin-n#possible-errors)
|
|
330
360
|
'n/handle-callback-err': ['error', 'er'],
|
package/jsdoc.js
CHANGED
|
@@ -82,4 +82,14 @@ module.exports = {
|
|
|
82
82
|
'jsdoc/text-escaping': 'off', // Painful
|
|
83
83
|
'jsdoc/valid-types': 'error',
|
|
84
84
|
},
|
|
85
|
+
overrides: [
|
|
86
|
+
{
|
|
87
|
+
files: ['*.ts'],
|
|
88
|
+
rules: {
|
|
89
|
+
'jsdoc/no-undefined-types': 'off', // Switch to typedoc
|
|
90
|
+
'jsdoc/require-param-type': 'off', // Not needed in TS
|
|
91
|
+
'jsdoc/require-returns-type': 'off', // Not needed in TS
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
85
95
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cto.af/eslint-config",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "hildjj's lint rules",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "
|
|
8
|
-
"lint": "eslint . --ext js,cjs,mjs",
|
|
7
|
+
"test": "cd test; npm run test",
|
|
8
|
+
"lint": "eslint . --ext js,cjs,mjs,ts",
|
|
9
9
|
"unused": "eslint-find-rules index.js -u && eslint-find-rules ava.js -u --no-core && eslint-find-rules jsdoc.js -u --no-core && eslint-find-rules ts.js -u --no-core",
|
|
10
|
-
"update": "ncu -u --deep && ncu --dep peer -u && npm run unused && pnpm i -r && npm test"
|
|
10
|
+
"update": "ncu -u --deep && ncu --dep peer -u && npm run unused && pnpm i -r && npm test",
|
|
11
|
+
"ci": "npm run lint && npm run test && npm run unused"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [
|
|
13
14
|
"lint"
|
|
@@ -15,12 +16,16 @@
|
|
|
15
16
|
"author": "Joe Hildebrand <joe-github@cursive.net>",
|
|
16
17
|
"license": "MIT",
|
|
17
18
|
"repository": "cto-af/eslint-config",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@stylistic/eslint-plugin": "1.5.4",
|
|
21
|
+
"eslint-plugin-n": "16.6.2"
|
|
22
|
+
},
|
|
18
23
|
"peerDependencies": {
|
|
19
24
|
"@typescript-eslint/eslint-plugin": "~6",
|
|
20
25
|
"@typescript-eslint/parser": "~6",
|
|
26
|
+
"eslint": "~8",
|
|
21
27
|
"eslint-plugin-ava": "~14",
|
|
22
|
-
"eslint-plugin-jsdoc": "~
|
|
23
|
-
"eslint-plugin-n": "~16",
|
|
28
|
+
"eslint-plugin-jsdoc": "~48",
|
|
24
29
|
"typescript": "~5"
|
|
25
30
|
},
|
|
26
31
|
"peerDependenciesMeta": {
|
|
@@ -41,18 +46,17 @@
|
|
|
41
46
|
}
|
|
42
47
|
},
|
|
43
48
|
"devDependencies": {
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
45
|
-
"@typescript-eslint/parser": "6.
|
|
46
|
-
"eslint": "^8.
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "6.19.1",
|
|
50
|
+
"@typescript-eslint/parser": "6.19.1",
|
|
51
|
+
"eslint": "^8.56.0",
|
|
47
52
|
"eslint-find-rules": "4.1.0",
|
|
48
53
|
"eslint-plugin-ava": "^14.0.0",
|
|
49
54
|
"eslint-plugin-hildjj": "link:rules",
|
|
50
|
-
"eslint-plugin-jsdoc": "^
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"typescript": "5.1.6"
|
|
55
|
+
"eslint-plugin-jsdoc": "^48.0.2",
|
|
56
|
+
"npm-check-updates": "16.14.12",
|
|
57
|
+
"typescript": "5.3.3"
|
|
54
58
|
},
|
|
55
59
|
"engines": {
|
|
56
|
-
"node": ">=
|
|
60
|
+
"node": ">=18"
|
|
57
61
|
}
|
|
58
62
|
}
|
package/ts.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// Last updated
|
|
4
|
-
// "
|
|
3
|
+
// Last updated 2024-01-23
|
|
4
|
+
// "eslint": "8.56.0"
|
|
5
|
+
// "@stylistic/eslint-plugin": "1.5.4",
|
|
6
|
+
// "@typescript-eslint/eslint-plugin": "6.19.1"
|
|
5
7
|
|
|
6
8
|
module.exports = {
|
|
7
9
|
parser: '@typescript-eslint/parser',
|
|
8
10
|
parserOptions: {
|
|
9
11
|
sourceType: 'module',
|
|
10
12
|
},
|
|
11
|
-
plugins: ['@typescript-eslint'],
|
|
13
|
+
plugins: ['@typescript-eslint', '@stylistic'],
|
|
12
14
|
rules: {
|
|
13
15
|
// From plugin:@typescript-eslint/eslint-recommended
|
|
14
16
|
'constructor-super': 'off',
|
|
@@ -44,28 +46,9 @@ module.exports = {
|
|
|
44
46
|
}],
|
|
45
47
|
'@typescript-eslint/ban-tslint-comment': 'error',
|
|
46
48
|
'@typescript-eslint/ban-types': 'off', // Not needed
|
|
47
|
-
'@typescript-eslint/block-spacing': 'error',
|
|
48
|
-
'brace-style': 'off',
|
|
49
|
-
'@typescript-eslint/brace-style': ['error', '1tbs', {
|
|
50
|
-
allowSingleLine: true,
|
|
51
|
-
}],
|
|
52
49
|
'@typescript-eslint/class-literal-property-style': ['error', 'getters'],
|
|
53
|
-
'
|
|
54
|
-
'@typescript-eslint/
|
|
55
|
-
'error',
|
|
56
|
-
{
|
|
57
|
-
arrays: 'always-multiline',
|
|
58
|
-
objects: 'always-multiline',
|
|
59
|
-
imports: 'always-multiline',
|
|
60
|
-
exports: 'always-multiline',
|
|
61
|
-
functions: 'never',
|
|
62
|
-
enums: 'always-multiline',
|
|
63
|
-
generics: 'never',
|
|
64
|
-
tuples: 'always-multiline',
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
'comma-spacing': 'off',
|
|
68
|
-
'@typescript-eslint/comma-spacing': 'error',
|
|
50
|
+
'class-methods-use-this': 'off',
|
|
51
|
+
'@typescript-eslint/class-methods-use-this': 'error',
|
|
69
52
|
'default-param-last': 'off',
|
|
70
53
|
'@typescript-eslint/consistent-generic-constructors': [
|
|
71
54
|
'error',
|
|
@@ -87,20 +70,15 @@ module.exports = {
|
|
|
87
70
|
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
88
71
|
'@typescript-eslint/explicit-member-accessibility': 'error',
|
|
89
72
|
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
|
90
|
-
'func-call-spacing': 'off',
|
|
91
|
-
'@typescript-eslint/func-call-spacing': 'error',
|
|
92
|
-
'@typescript-eslint/indent': ['off', 2], // Broken, see https://github.com/typescript-eslint/typescript-eslint/issues/1824
|
|
93
73
|
'@typescript-eslint/init-declarations': 'error',
|
|
94
|
-
'
|
|
95
|
-
'@typescript-eslint/
|
|
96
|
-
'@typescript-eslint/lines-around-comment': 'off', // Maybe later
|
|
97
|
-
'@typescript-eslint/lines-between-class-members': 'error',
|
|
98
|
-
'@typescript-eslint/member-delimiter-style': 'error',
|
|
74
|
+
'max-params': 'off',
|
|
75
|
+
'@typescript-eslint/max-params': ['error', {max: 4}],
|
|
99
76
|
'@typescript-eslint/member-ordering': 'error',
|
|
100
77
|
'@typescript-eslint/method-signature-style': ['error', 'method'],
|
|
101
78
|
'@typescript-eslint/naming-convention': 'off', // Too late
|
|
102
79
|
'no-array-constructor': 'off',
|
|
103
80
|
'@typescript-eslint/no-array-constructor': 'error',
|
|
81
|
+
'@typescript-eslint/no-array-delete': 'error',
|
|
104
82
|
'@typescript-eslint/no-base-to-string': 'off', // Can't config
|
|
105
83
|
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
|
106
84
|
'@typescript-eslint/no-confusing-void-expression': 'off', // Can't config
|
|
@@ -113,9 +91,6 @@ module.exports = {
|
|
|
113
91
|
'@typescript-eslint/no-empty-interface': 'error',
|
|
114
92
|
'@typescript-eslint/no-explicit-any': 'off', // Too hard
|
|
115
93
|
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
116
|
-
'@typescript-eslint/no-extra-parens': 'off', // Disagree
|
|
117
|
-
'no-extra-semi': 'off',
|
|
118
|
-
'@typescript-eslint/no-extra-semi': 'error',
|
|
119
94
|
'@typescript-eslint/no-extraneous-class': 'error',
|
|
120
95
|
'@typescript-eslint/no-floating-promises': 'off', // Can't config
|
|
121
96
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
@@ -156,25 +131,28 @@ module.exports = {
|
|
|
156
131
|
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
|
157
132
|
'@typescript-eslint/no-unsafe-member-access': 'off', // Can't config
|
|
158
133
|
'@typescript-eslint/no-unsafe-return': 'off', // Can't config
|
|
134
|
+
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
|
159
135
|
'@typescript-eslint/no-unused-expressions': 'error',
|
|
160
136
|
'no-unused-vars': 'off',
|
|
161
137
|
'@typescript-eslint/no-unused-vars': [
|
|
162
138
|
'error', {
|
|
163
139
|
args: 'none',
|
|
140
|
+
argsIgnorePattern: '^_',
|
|
164
141
|
caughtErrors: 'all',
|
|
165
|
-
caughtErrorsIgnorePattern: '^(ignore
|
|
142
|
+
caughtErrorsIgnorePattern: '^(_|ignore)',
|
|
143
|
+
varsIgnorePattern: '^_',
|
|
166
144
|
},
|
|
167
145
|
],
|
|
168
146
|
'@typescript-eslint/no-use-before-define': 'error',
|
|
169
147
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
170
148
|
'@typescript-eslint/no-useless-empty-export': 'error',
|
|
149
|
+
'@typescript-eslint/no-useless-template-literals': 'error',
|
|
171
150
|
'@typescript-eslint/no-var-requires': 'error',
|
|
172
151
|
'@typescript-eslint/non-nullable-type-assertion-style': 'off', // Can't config
|
|
173
|
-
'object-curly-spacing': 'off',
|
|
174
|
-
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
|
|
175
|
-
'@typescript-eslint/padding-line-between-statements': 'error',
|
|
176
152
|
'@typescript-eslint/parameter-properties': 'error',
|
|
177
153
|
'@typescript-eslint/prefer-as-const': 'error',
|
|
154
|
+
'prefer-destructuring': 'off',
|
|
155
|
+
'@typescript-eslint/prefer-destructuring': 'error',
|
|
178
156
|
'@typescript-eslint/prefer-enum-initializers': 'error',
|
|
179
157
|
'@typescript-eslint/prefer-for-of': 'error',
|
|
180
158
|
'@typescript-eslint/prefer-function-type': 'error',
|
|
@@ -183,6 +161,7 @@ module.exports = {
|
|
|
183
161
|
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
184
162
|
'@typescript-eslint/prefer-nullish-coalescing': 'off', // Can't config
|
|
185
163
|
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
164
|
+
'@typescript-eslint/prefer-promise-reject-errors': 'error',
|
|
186
165
|
'@typescript-eslint/prefer-readonly-parameter-types': 'off', // Can't config
|
|
187
166
|
'@typescript-eslint/prefer-readonly': 'off', // Can't config
|
|
188
167
|
'@typescript-eslint/prefer-reduce-type-parameter': 'off', // Can't config
|
|
@@ -191,27 +170,140 @@ module.exports = {
|
|
|
191
170
|
'@typescript-eslint/prefer-string-starts-ends-with': 'off', // Can't config
|
|
192
171
|
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
|
193
172
|
'@typescript-eslint/promise-function-async': 'off', // Can't config
|
|
194
|
-
'quotes': 'off',
|
|
195
|
-
'@typescript-eslint/quotes': ['error', 'single', {avoidEscape: true}],
|
|
196
173
|
'@typescript-eslint/require-array-sort-compare': 'off', // Can't config
|
|
197
174
|
'@typescript-eslint/require-await': 'off', // Can't config
|
|
198
175
|
'@typescript-eslint/restrict-plus-operands': 'off', // Can't config
|
|
199
176
|
'@typescript-eslint/restrict-template-expressions': 'off', // Can't config
|
|
200
177
|
'@typescript-eslint/return-await': 'off', // Can't config
|
|
201
|
-
'semi': 'off',
|
|
202
|
-
'@typescript-eslint/semi': ['error', 'always'],
|
|
203
178
|
'@typescript-eslint/sort-type-constituents': 'error',
|
|
204
|
-
'@typescript-eslint/space-before-blocks': 'error',
|
|
205
|
-
'space-before-function-paren': 'off',
|
|
206
|
-
'@typescript-eslint/space-before-function-paren': ['error', 'never'],
|
|
207
|
-
'space-infix-ops': 'off',
|
|
208
|
-
'@typescript-eslint/space-infix-ops': ['error', {int32Hint: true}],
|
|
209
179
|
'@typescript-eslint/strict-boolean-expressions': 'off', // Can't config
|
|
210
180
|
'@typescript-eslint/switch-exhaustiveness-check': 'off', // Can't config
|
|
211
181
|
'@typescript-eslint/triple-slash-reference': 'error',
|
|
212
|
-
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
213
182
|
'@typescript-eslint/typedef': 'error',
|
|
214
183
|
'@typescript-eslint/unbound-method': 'off', // Can't config
|
|
215
184
|
'@typescript-eslint/unified-signatures': 'off', // Too hard
|
|
185
|
+
|
|
186
|
+
// [Stylistc](https://eslint.style/packages/default)
|
|
187
|
+
'@stylistic/array-bracket-newline': ['error', 'consistent'],
|
|
188
|
+
'@stylistic/array-bracket-spacing': ['error', 'never'],
|
|
189
|
+
'@stylistic/array-element-newline': ['error', 'consistent'],
|
|
190
|
+
'@stylistic/arrow-parens': ['error', 'as-needed'],
|
|
191
|
+
'@stylistic/arrow-spacing': 'error',
|
|
192
|
+
'@stylistic/block-spacing': ['error', 'always'],
|
|
193
|
+
'@stylistic/brace-style': ['error', '1tbs', {
|
|
194
|
+
allowSingleLine: true,
|
|
195
|
+
}],
|
|
196
|
+
'@stylistic/comma-dangle': [
|
|
197
|
+
'error',
|
|
198
|
+
{
|
|
199
|
+
arrays: 'always-multiline',
|
|
200
|
+
objects: 'always-multiline',
|
|
201
|
+
imports: 'always-multiline',
|
|
202
|
+
exports: 'always-multiline',
|
|
203
|
+
functions: 'never',
|
|
204
|
+
enums: 'always-multiline',
|
|
205
|
+
generics: 'never',
|
|
206
|
+
tuples: 'always-multiline',
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
'@stylistic/comma-spacing': 'error',
|
|
210
|
+
'@stylistic/comma-style': ['error', 'last'],
|
|
211
|
+
'@stylistic/computed-property-spacing': 'error',
|
|
212
|
+
'@stylistic/dot-location': ['error', 'property'],
|
|
213
|
+
'@stylistic/eol-last': 'error',
|
|
214
|
+
'@stylistic/func-call-spacing': 'off', // Renamed
|
|
215
|
+
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
|
216
|
+
'@stylistic/function-call-spacing': 'error',
|
|
217
|
+
'@stylistic/function-paren-newline': ['error', 'consistent'],
|
|
218
|
+
'@stylistic/generator-star-spacing': 'error',
|
|
219
|
+
'@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
|
|
220
|
+
'@stylistic/indent': ['error', 2], // Still broken?
|
|
221
|
+
'@stylistic/indent-binary-ops': 'off', // Not good enough
|
|
222
|
+
|
|
223
|
+
'@stylistic/jsx-child-element-spacing': 'off', // Not needed
|
|
224
|
+
'@stylistic/jsx-closing-bracket-location': 'off', // Not needed
|
|
225
|
+
'@stylistic/jsx-closing-tag-location': 'off', // Not needed
|
|
226
|
+
'@stylistic/jsx-curly-brace-presence': 'off', // Not needed
|
|
227
|
+
'@stylistic/jsx-curly-newline': 'off', // Not needed
|
|
228
|
+
'@stylistic/jsx-curly-spacing': 'off', // Not needed
|
|
229
|
+
'@stylistic/jsx-equals-spacing': 'off', // Not needed
|
|
230
|
+
'@stylistic/jsx-first-prop-new-line': 'off', // Not needed
|
|
231
|
+
'@stylistic/jsx-indent': 'off', // Not needed
|
|
232
|
+
'@stylistic/jsx-indent-props': 'off', // Not needed
|
|
233
|
+
'@stylistic/jsx-max-props-per-line': 'off', // Not needed
|
|
234
|
+
'@stylistic/jsx-newline': 'off', // Not needed
|
|
235
|
+
'@stylistic/jsx-one-expression-per-line': 'off', // Not needed
|
|
236
|
+
'@stylistic/jsx-props-no-multi-spaces': 'off', // Not needed
|
|
237
|
+
'@stylistic/jsx-quotes': 'off', // Not needed
|
|
238
|
+
'@stylistic/jsx-self-closing-comp': 'off', // Not needed
|
|
239
|
+
'@stylistic/jsx-sort-props': 'off', // Not needed
|
|
240
|
+
'@stylistic/jsx-tag-spacing': 'off', // Not needed
|
|
241
|
+
'@stylistic/jsx-wrap-multilines': 'off', // Not needed
|
|
242
|
+
|
|
243
|
+
'@stylistic/key-spacing': ['error', {mode: 'minimum'}],
|
|
244
|
+
'@stylistic/keyword-spacing': 'error',
|
|
245
|
+
'@stylistic/linebreak-style': 'error',
|
|
246
|
+
'@stylistic/lines-around-comment': ['error', {
|
|
247
|
+
allowBlockStart: true,
|
|
248
|
+
allowClassStart: true,
|
|
249
|
+
allowEnumStart: true,
|
|
250
|
+
allowInterfaceStart: true,
|
|
251
|
+
allowModuleStart: true,
|
|
252
|
+
allowTypeStart: true,
|
|
253
|
+
}],
|
|
254
|
+
'@stylistic/lines-between-class-members': ['error', 'always', {
|
|
255
|
+
exceptAfterSingleLine: true,
|
|
256
|
+
}],
|
|
257
|
+
'@stylistic/max-len': ['error', 80, {
|
|
258
|
+
ignoreRegExpLiterals: true,
|
|
259
|
+
ignoreStrings: true,
|
|
260
|
+
ignoreTemplateLiterals: true,
|
|
261
|
+
ignoreUrls: true,
|
|
262
|
+
}],
|
|
263
|
+
'@stylistic/max-statements-per-line': 'off',
|
|
264
|
+
'@stylistic/member-delimiter-style': 'error',
|
|
265
|
+
'@stylistic/multiline-ternary': ['error', 'always-multiline'],
|
|
266
|
+
'@stylistic/new-parens': 'error',
|
|
267
|
+
'@stylistic/newline-per-chained-call': 'error',
|
|
268
|
+
'@stylistic/no-confusing-arrow': 'error',
|
|
269
|
+
'@stylistic/no-extra-parens': 'off', // Disagree
|
|
270
|
+
'@stylistic/no-extra-semi': 'error',
|
|
271
|
+
'@stylistic/no-floating-decimal': 'error',
|
|
272
|
+
'@stylistic/no-mixed-operators': 'error',
|
|
273
|
+
'@stylistic/no-mixed-spaces-and-tabs': 'error',
|
|
274
|
+
'@stylistic/no-multi-spaces': 'error',
|
|
275
|
+
'@stylistic/no-multiple-empty-lines': ['error', {max: 1}],
|
|
276
|
+
'@stylistic/no-tabs': 'error',
|
|
277
|
+
'@stylistic/no-trailing-spaces': 'error',
|
|
278
|
+
'@stylistic/no-whitespace-before-property': 'error',
|
|
279
|
+
'@stylistic/nonblock-statement-body-position': 'error',
|
|
280
|
+
'@stylistic/object-curly-newline': 'error',
|
|
281
|
+
'@stylistic/object-curly-spacing': ['error', 'never'],
|
|
282
|
+
'@stylistic/object-property-newline': ['error', {allowAllPropertiesOnSameLine: true}],
|
|
283
|
+
'@stylistic/one-var-declaration-per-line': 'error',
|
|
284
|
+
'@stylistic/operator-linebreak': ['error', 'after'],
|
|
285
|
+
'@stylistic/padded-blocks': ['error', 'never'],
|
|
286
|
+
'@stylistic/padding-line-between-statements': 'error',
|
|
287
|
+
'@stylistic/quote-props': ['error', 'consistent-as-needed'],
|
|
288
|
+
'@stylistic/quotes': ['error', 'single', {avoidEscape: true}],
|
|
289
|
+
'@stylistic/rest-spread-spacing': ['error', 'never'],
|
|
290
|
+
'@stylistic/semi': ['error', 'always'],
|
|
291
|
+
'@stylistic/semi-spacing': 'error',
|
|
292
|
+
'@stylistic/semi-style': ['error'],
|
|
293
|
+
'@stylistic/space-before-blocks': 'error',
|
|
294
|
+
'@stylistic/space-before-function-paren': ['error', 'never'],
|
|
295
|
+
'@stylistic/space-in-parens': 'error',
|
|
296
|
+
'@stylistic/space-infix-ops': ['error', {int32Hint: false}],
|
|
297
|
+
'@stylistic/space-unary-ops': 'error',
|
|
298
|
+
'@stylistic/spaced-comment': ['error', 'always'],
|
|
299
|
+
'@stylistic/switch-colon-spacing': 'error',
|
|
300
|
+
'@stylistic/template-curly-spacing': 'error',
|
|
301
|
+
'@stylistic/template-tag-spacing': 'error',
|
|
302
|
+
'@stylistic/type-annotation-spacing': 'error',
|
|
303
|
+
'@stylistic/type-generic-spacing': 'error',
|
|
304
|
+
'@stylistic/type-named-tuple-spacing': 'error',
|
|
305
|
+
'@stylistic/wrap-iife': 'error',
|
|
306
|
+
'@stylistic/wrap-regex': 'off', // No.
|
|
307
|
+
'@stylistic/yield-star-spacing': ['error', 'before'],
|
|
216
308
|
},
|
|
217
309
|
};
|