@cto.af/eslint-config 3.0.2 → 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.
Files changed (5) hide show
  1. package/README.md +46 -0
  2. package/index.js +103 -72
  3. package/jsdoc.js +10 -0
  4. package/package.json +18 -14
  5. package/ts.js +135 -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,9 +168,7 @@ 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',
@@ -215,7 +217,6 @@ module.exports = {
215
217
  'no-with': 'error',
216
218
  'object-shorthand': 'error',
217
219
  'one-var': ['error', 'never'],
218
- 'one-var-declaration-per-line': 'error',
219
220
  'operator-assignment': 'error',
220
221
  'prefer-arrow-callback': 'error',
221
222
  'prefer-const': 'error',
@@ -230,7 +231,6 @@ module.exports = {
230
231
  'prefer-rest-params': 'error',
231
232
  'prefer-spread': 'error',
232
233
  'prefer-template': 'error',
233
- 'quote-props': ['error', 'consistent-as-needed'],
234
234
  'radix': 'error',
235
235
  'require-await': 'error',
236
236
  'require-unicode-regexp': 'off', // No.
@@ -238,92 +238,123 @@ module.exports = {
238
238
  'sort-imports': 'error',
239
239
  'sort-keys': 'off', // Pedantic
240
240
  'sort-vars': 'off', // Pedantic
241
- 'spaced-comment': ['error', 'always'],
242
241
  'strict': ['error', 'global'],
243
242
  'symbol-description': 'error',
243
+ 'unicode-bom': 'error',
244
244
  'vars-on-top': 'error',
245
245
  'yoda': ['error', 'never', {exceptRange: true}],
246
246
 
247
- // [Layout & Formatting](https://eslint.org/docs/rules/#layout-formatting)
248
- 'array-bracket-newline': ['error', 'consistent'],
249
- 'array-bracket-spacing': ['error', 'never'],
250
- 'array-element-newline': ['error', 'consistent'],
251
- 'arrow-parens': ['error', 'as-needed'],
252
- 'arrow-spacing': 'error',
253
- 'block-spacing': ['error', 'always'],
254
- 'brace-style': ['error', '1tbs'],
255
- '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', {
256
256
  arrays: 'always-multiline',
257
257
  objects: 'always-multiline',
258
258
  imports: 'always-multiline',
259
259
  exports: 'always-multiline',
260
260
  functions: 'never',
261
261
  }],
262
- 'comma-spacing': 'error',
263
- 'comma-style': ['error', 'last'],
264
- 'computed-property-spacing': 'error',
265
- 'dot-location': ['error', 'property'],
266
- 'eol-last': 'error',
267
- 'func-call-spacing': 'error',
268
- 'function-call-argument-newline': ['error', 'consistent'],
269
- 'function-paren-newline': ['error', 'consistent'],
270
- 'generator-star-spacing': 'error',
271
- 'implicit-arrow-linebreak': ['error', 'beside'],
272
- 'indent': ['error', 2, {SwitchCase: 1}],
273
- 'jsx-quotes': 'off', // Not needed
274
- 'key-spacing': 'error',
275
- 'keyword-spacing': 'error',
276
- 'line-comment-position': 'off', // I'm all over the place on these
277
- 'linebreak-style': 'error',
278
- 'lines-around-comment': ['error', {
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', {
279
300
  allowBlockStart: true,
280
301
  allowClassStart: true,
281
302
  }],
282
- 'lines-between-class-members': ['error', 'always', {
303
+ '@stylistic/lines-between-class-members': ['error', 'always', {
283
304
  exceptAfterSingleLine: true,
284
305
  }],
285
- 'max-len': ['error', 80, {
306
+ '@stylistic/max-len': ['error', 80, {
286
307
  ignoreRegExpLiterals: true,
287
308
  ignoreStrings: true,
288
309
  ignoreTemplateLiterals: true,
289
310
  ignoreUrls: true,
290
311
  }],
291
- 'max-statements-per-line': 'off',
292
- 'multiline-ternary': ['error', 'always-multiline'],
293
- 'new-parens': 'error',
294
- 'newline-per-chained-call': 'error',
295
- 'no-extra-parens': 'off', // Too fiddly to torn off everything.
296
- 'no-mixed-spaces-and-tabs': 'error',
297
- 'no-multi-spaces': 'error',
298
- 'no-multiple-empty-lines': ['error', {max: 1}],
299
- 'no-tabs': 'error',
300
- 'no-trailing-spaces': 'error',
301
- 'no-whitespace-before-property': 'error',
302
- 'nonblock-statement-body-position': 'error',
303
- 'object-curly-newline': 'error',
304
- 'object-curly-spacing': ['error', 'never'],
305
- 'object-property-newline': ['error', {allowAllPropertiesOnSameLine: true}],
306
- 'operator-linebreak': ['error', 'after'],
307
- 'padded-blocks': ['error', 'never'],
308
- 'padding-line-between-statements': 'error',
309
- 'quotes': ['error', 'single', {avoidEscape: true}],
310
- 'rest-spread-spacing': ['error', 'never'],
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'],
311
339
  // Massive breaking change. I changed my mind.
312
- 'semi': ['error', 'always'],
313
- 'semi-spacing': 'error',
314
- 'semi-style': ['error'],
315
- 'space-before-blocks': 'error',
316
- 'space-before-function-paren': ['error', 'never'],
317
- 'space-in-parens': 'error',
318
- 'space-infix-ops': ['error', {int32Hint: false}],
319
- 'space-unary-ops': 'error',
320
- 'switch-colon-spacing': 'error',
321
- 'template-curly-spacing': 'error',
322
- 'template-tag-spacing': 'error',
323
- 'unicode-bom': 'error',
324
- 'wrap-iife': 'error',
325
- 'wrap-regex': 'off', // No.
326
- 'yield-star-spacing': ['error', 'before'],
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'],
327
358
 
328
359
  // [Possible Errors](https://github.com/eslint-community/eslint-plugin-n#possible-errors)
329
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.2",
3
+ "version": "3.1.0",
4
4
  "description": "hildjj's lint rules",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "eslint -c index.js *.js",
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": "~46",
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.9.1",
45
- "@typescript-eslint/parser": "6.9.1",
46
- "eslint": "^8.52.0",
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": "^46.8.2",
51
- "eslint-plugin-n": "16.2.0",
52
- "npm-check-updates": "16.14.6",
53
- "typescript": "5.2.2"
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": ">=16"
60
+ "node": ">=18"
57
61
  }
58
62
  }
package/ts.js CHANGED
@@ -1,14 +1,16 @@
1
1
  'use strict';
2
2
 
3
- // Last updated 2023-01-12
4
- // "@typescript-eslint/eslint-plugin": "5.37.0"
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,30 +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
50
  'class-methods-use-this': 'off',
54
51
  '@typescript-eslint/class-methods-use-this': 'error',
55
- 'comma-dangle': 'off',
56
- '@typescript-eslint/comma-dangle': [
57
- 'error',
58
- {
59
- arrays: 'always-multiline',
60
- objects: 'always-multiline',
61
- imports: 'always-multiline',
62
- exports: 'always-multiline',
63
- functions: 'never',
64
- enums: 'always-multiline',
65
- generics: 'never',
66
- tuples: 'always-multiline',
67
- },
68
- ],
69
- 'comma-spacing': 'off',
70
- '@typescript-eslint/comma-spacing': 'error',
71
52
  'default-param-last': 'off',
72
53
  '@typescript-eslint/consistent-generic-constructors': [
73
54
  'error',
@@ -89,22 +70,15 @@ module.exports = {
89
70
  '@typescript-eslint/explicit-function-return-type': 'error',
90
71
  '@typescript-eslint/explicit-member-accessibility': 'error',
91
72
  '@typescript-eslint/explicit-module-boundary-types': 'error',
92
- 'func-call-spacing': 'off',
93
- '@typescript-eslint/func-call-spacing': 'error',
94
- '@typescript-eslint/indent': ['off', 2], // Broken, see https://github.com/typescript-eslint/typescript-eslint/issues/1824
95
73
  '@typescript-eslint/init-declarations': 'error',
96
- '@typescript-eslint/key-spacing': ['error', {mode: 'minimum'}],
97
- '@typescript-eslint/keyword-spacing': 'error',
98
- '@typescript-eslint/lines-around-comment': 'off', // Maybe later
99
- '@typescript-eslint/lines-between-class-members': 'error',
100
74
  'max-params': 'off',
101
75
  '@typescript-eslint/max-params': ['error', {max: 4}],
102
- '@typescript-eslint/member-delimiter-style': 'error',
103
76
  '@typescript-eslint/member-ordering': 'error',
104
77
  '@typescript-eslint/method-signature-style': ['error', 'method'],
105
78
  '@typescript-eslint/naming-convention': 'off', // Too late
106
79
  'no-array-constructor': 'off',
107
80
  '@typescript-eslint/no-array-constructor': 'error',
81
+ '@typescript-eslint/no-array-delete': 'error',
108
82
  '@typescript-eslint/no-base-to-string': 'off', // Can't config
109
83
  '@typescript-eslint/no-confusing-non-null-assertion': 'error',
110
84
  '@typescript-eslint/no-confusing-void-expression': 'off', // Can't config
@@ -117,9 +91,6 @@ module.exports = {
117
91
  '@typescript-eslint/no-empty-interface': 'error',
118
92
  '@typescript-eslint/no-explicit-any': 'off', // Too hard
119
93
  '@typescript-eslint/no-extra-non-null-assertion': 'error',
120
- '@typescript-eslint/no-extra-parens': 'off', // Disagree
121
- 'no-extra-semi': 'off',
122
- '@typescript-eslint/no-extra-semi': 'error',
123
94
  '@typescript-eslint/no-extraneous-class': 'error',
124
95
  '@typescript-eslint/no-floating-promises': 'off', // Can't config
125
96
  '@typescript-eslint/no-for-in-array': 'error',
@@ -160,23 +131,24 @@ module.exports = {
160
131
  '@typescript-eslint/no-unsafe-enum-comparison': 'error',
161
132
  '@typescript-eslint/no-unsafe-member-access': 'off', // Can't config
162
133
  '@typescript-eslint/no-unsafe-return': 'off', // Can't config
134
+ '@typescript-eslint/no-unsafe-unary-minus': 'error',
163
135
  '@typescript-eslint/no-unused-expressions': 'error',
164
136
  'no-unused-vars': 'off',
165
137
  '@typescript-eslint/no-unused-vars': [
166
138
  'error', {
167
139
  args: 'none',
140
+ argsIgnorePattern: '^_',
168
141
  caughtErrors: 'all',
169
- caughtErrorsIgnorePattern: '^(ignore|_)',
142
+ caughtErrorsIgnorePattern: '^(_|ignore)',
143
+ varsIgnorePattern: '^_',
170
144
  },
171
145
  ],
172
146
  '@typescript-eslint/no-use-before-define': 'error',
173
147
  '@typescript-eslint/no-useless-constructor': 'error',
174
148
  '@typescript-eslint/no-useless-empty-export': 'error',
149
+ '@typescript-eslint/no-useless-template-literals': 'error',
175
150
  '@typescript-eslint/no-var-requires': 'error',
176
151
  '@typescript-eslint/non-nullable-type-assertion-style': 'off', // Can't config
177
- 'object-curly-spacing': 'off',
178
- '@typescript-eslint/object-curly-spacing': ['error', 'always'],
179
- '@typescript-eslint/padding-line-between-statements': 'error',
180
152
  '@typescript-eslint/parameter-properties': 'error',
181
153
  '@typescript-eslint/prefer-as-const': 'error',
182
154
  'prefer-destructuring': 'off',
@@ -189,6 +161,7 @@ module.exports = {
189
161
  '@typescript-eslint/prefer-namespace-keyword': 'error',
190
162
  '@typescript-eslint/prefer-nullish-coalescing': 'off', // Can't config
191
163
  '@typescript-eslint/prefer-optional-chain': 'error',
164
+ '@typescript-eslint/prefer-promise-reject-errors': 'error',
192
165
  '@typescript-eslint/prefer-readonly-parameter-types': 'off', // Can't config
193
166
  '@typescript-eslint/prefer-readonly': 'off', // Can't config
194
167
  '@typescript-eslint/prefer-reduce-type-parameter': 'off', // Can't config
@@ -197,27 +170,140 @@ module.exports = {
197
170
  '@typescript-eslint/prefer-string-starts-ends-with': 'off', // Can't config
198
171
  '@typescript-eslint/prefer-ts-expect-error': 'error',
199
172
  '@typescript-eslint/promise-function-async': 'off', // Can't config
200
- 'quotes': 'off',
201
- '@typescript-eslint/quotes': ['error', 'single', {avoidEscape: true}],
202
173
  '@typescript-eslint/require-array-sort-compare': 'off', // Can't config
203
174
  '@typescript-eslint/require-await': 'off', // Can't config
204
175
  '@typescript-eslint/restrict-plus-operands': 'off', // Can't config
205
176
  '@typescript-eslint/restrict-template-expressions': 'off', // Can't config
206
177
  '@typescript-eslint/return-await': 'off', // Can't config
207
- 'semi': 'off',
208
- '@typescript-eslint/semi': ['error', 'always'],
209
178
  '@typescript-eslint/sort-type-constituents': 'error',
210
- '@typescript-eslint/space-before-blocks': 'error',
211
- 'space-before-function-paren': 'off',
212
- '@typescript-eslint/space-before-function-paren': ['error', 'never'],
213
- 'space-infix-ops': 'off',
214
- '@typescript-eslint/space-infix-ops': ['error', {int32Hint: true}],
215
179
  '@typescript-eslint/strict-boolean-expressions': 'off', // Can't config
216
180
  '@typescript-eslint/switch-exhaustiveness-check': 'off', // Can't config
217
181
  '@typescript-eslint/triple-slash-reference': 'error',
218
- '@typescript-eslint/type-annotation-spacing': 'error',
219
182
  '@typescript-eslint/typedef': 'error',
220
183
  '@typescript-eslint/unbound-method': 'off', // Can't config
221
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'],
222
308
  },
223
309
  };