eslint-config-jc 5.2.0 → 6.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/dist/base.js CHANGED
@@ -236,7 +236,7 @@ export default tseslint.config({
236
236
  // https://jc-verse.github.io/js-style-guide/eslint-base/functions#no-extra-bind
237
237
  "no-extra-bind": "error",
238
238
  // https://jc-verse.github.io/js-style-guide/eslint-base/operators#no-extra-boolean-cast
239
- "no-extra-boolean-cast": ["error", { enforceForLogicalOperands: true }],
239
+ "no-extra-boolean-cast": ["error", { enforceForInnerExpressions: true }],
240
240
  // https://jc-verse.github.io/js-style-guide/eslint-base/control-flow#no-extra-label
241
241
  "no-extra-label": "error",
242
242
  // A eslint-disable is as expressive as a special comment.
@@ -566,6 +566,8 @@ export default tseslint.config({
566
566
  variables: true,
567
567
  },
568
568
  ],
569
+ // https://jc-verse.github.io/js-style-guide/eslint-base/variables-names#no-useless-assignment
570
+ "no-useless-assignment": "error",
569
571
  // https://jc-verse.github.io/js-style-guide/eslint-base/literals#no-useless-backreference
570
572
  "no-useless-backreference": "error",
571
573
  // https://jc-verse.github.io/js-style-guide/eslint-base/functions#no-useless-call
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { TSESLint } from "@typescript-eslint/utils";
2
2
  export default function configCreator({ react, typescriptTypeCheck, node, reactClassComp, reactPropTypes, }?: {
3
- react?: boolean | TSESLint.FlatConfig.FileSpec[];
4
- typescriptTypeCheck?: boolean | TSESLint.FlatConfig.FileSpec[];
5
- node?: boolean | TSESLint.FlatConfig.FileSpec[];
6
- reactClassComp?: boolean | TSESLint.FlatConfig.FileSpec[];
7
- reactPropTypes?: boolean | TSESLint.FlatConfig.FileSpec[];
3
+ react?: boolean | (string[] | string)[];
4
+ typescriptTypeCheck?: boolean | (string[] | string)[];
5
+ node?: boolean | (string[] | string)[];
6
+ reactClassComp?: boolean | (string[] | string)[];
7
+ reactPropTypes?: boolean | (string[] | string)[];
8
8
  }): TSESLint.FlatConfig.ConfigArray;
package/dist/jsx.js CHANGED
@@ -294,6 +294,7 @@ export default tseslint.config({
294
294
  "react/jsx-props-no-multi-spaces": "off",
295
295
  // We like spreading
296
296
  "react/jsx-props-no-spreading": "off",
297
+ "react/jsx-props-no-spread-multi": "error",
297
298
  "react/jsx-sort-props": 0,
298
299
  // Formatting
299
300
  "react/jsx-tag-spacing": "off",
package/dist/node.js CHANGED
@@ -9,6 +9,7 @@ export default tseslint.config({
9
9
  },
10
10
  },
11
11
  plugins: {
12
+ // @ts-expect-error: TODO make an issue
12
13
  n: nPlugin,
13
14
  },
14
15
  rules: {
package/dist/react.js CHANGED
@@ -17,10 +17,13 @@ export default tseslint.config({
17
17
  "react-hooks/exhaustive-deps": "error",
18
18
  "react-hooks/rules-of-hooks": "error",
19
19
  "react/boolean-prop-naming": "off",
20
- "react/checked-requires-onchange-or-readonly": ["error", {
20
+ "react/checked-requires-onchange-or-readonly": [
21
+ "error",
22
+ {
21
23
  ignoreExclusiveCheckedAttribute: false,
22
24
  ignoreMissingProperties: false,
23
- }],
25
+ },
26
+ ],
24
27
  // Sometimes we do need `props` as a whole, e.g. for spreading
25
28
  "react/destructuring-assignment": "off",
26
29
  // Isn't useful
@@ -28,6 +31,7 @@ export default tseslint.config({
28
31
  "react/forbid-component-props": 0,
29
32
  "react/forbid-dom-props": 0,
30
33
  "react/forbid-elements": 0,
34
+ "react/forward-ref-uses-ref": "error",
31
35
  // Note that it false-positives for `const Foo: Comp = () => <></>`
32
36
  "react/function-component-definition": [
33
37
  "warn",
@@ -28,6 +28,7 @@ export default tseslint.config({
28
28
  ignoreVoidOperator: false,
29
29
  },
30
30
  ],
31
+ "@typescript-eslint/no-deprecated": "warn",
31
32
  "@typescript-eslint/no-floating-promises": [
32
33
  "warn",
33
34
  {
@@ -42,7 +43,7 @@ export default tseslint.config({
42
43
  "@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
43
44
  "@typescript-eslint/no-unnecessary-condition": [
44
45
  "error",
45
- { allowConstantLoopConditions: true },
46
+ { allowConstantLoopConditions: true, checkTypePredicates: true },
46
47
  ],
47
48
  // Enums & namespaces aren't allowed anyway.
48
49
  "@typescript-eslint/no-unnecessary-qualifier": "warn",
@@ -91,6 +92,6 @@ export default tseslint.config({
91
92
  "@typescript-eslint/switch-exhaustiveness-check": "error",
92
93
  // Not very useful in practice... A lot of false-positives
93
94
  "@typescript-eslint/unbound-method": "off",
94
- "@typescript-eslint/use-unknown-in-catch-callback-variables": "error",
95
+ "@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
95
96
  },
96
97
  });
@@ -27,16 +27,6 @@ export default tseslint.config({
27
27
  // We've never used TSLint anyway
28
28
  // https://jc-verse.github.io/js-style-guide/typescript/base#ban-tslint-comment
29
29
  "@typescript-eslint/ban-tslint-comment": "error",
30
- // https://jc-verse.github.io/js-style-guide/typescript/base#ban-types
31
- "@typescript-eslint/ban-types": [
32
- "error",
33
- {
34
- extendDefaults: true,
35
- types: {
36
- "{}": false,
37
- },
38
- },
39
- ],
40
30
  // https://jc-verse.github.io/js-style-guide/typescript/base#class-literal-property-style
41
31
  "@typescript-eslint/class-literal-property-style": ["warn", "getters"],
42
32
  // We turn off the base rule too
@@ -99,13 +89,16 @@ export default tseslint.config({
99
89
  // This can be useful for dynamic object transformations
100
90
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-dynamic-delete
101
91
  "@typescript-eslint/no-dynamic-delete": "off",
92
+ // https://jc-verse.github.io/js-style-guide/typescript/base#no-empty-object-type
93
+ "@typescript-eslint/no-empty-object-type": [
94
+ "warn",
95
+ {
96
+ allowInterfaces: "with-single-extends",
97
+ allowObjectTypes: "never",
98
+ },
99
+ ],
102
100
  // We turn off the base rule too
103
101
  "@typescript-eslint/no-empty-function": "off",
104
- // https://jc-verse.github.io/js-style-guide/typescript/base#no-empty-interface
105
- "@typescript-eslint/no-empty-interface": [
106
- "error",
107
- { allowSingleExtends: true },
108
- ],
109
102
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-explicit-any
110
103
  "@typescript-eslint/no-explicit-any": "warn",
111
104
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-extra-non-null-assertion
@@ -136,8 +129,6 @@ export default tseslint.config({
136
129
  ],
137
130
  // We turn off the base rule too
138
131
  "@typescript-eslint/no-loop-func": "off",
139
- // To be deprecated
140
- "@typescript-eslint/no-loss-of-precision": "off",
141
132
  // We turn off the base rule too
142
133
  "@typescript-eslint/no-magic-numbers": "off",
143
134
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-misused-new
@@ -226,8 +217,6 @@ export default tseslint.config({
226
217
  "@typescript-eslint/no-useless-constructor": "error",
227
218
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-useless-empty-export
228
219
  "@typescript-eslint/no-useless-empty-export": "error",
229
- // https://jc-verse.github.io/js-style-guide/typescript/base#no-var-requires
230
- "@typescript-eslint/no-var-requires": "error",
231
220
  // https://jc-verse.github.io/js-style-guide/typescript/base#parameter-properties
232
221
  "@typescript-eslint/parameter-properties": [
233
222
  "warn",
@@ -248,8 +237,6 @@ export default tseslint.config({
248
237
  ],
249
238
  // https://jc-verse.github.io/js-style-guide/typescript/base#prefer-namespace-keyword
250
239
  "@typescript-eslint/prefer-namespace-keyword": "error",
251
- // https://jc-verse.github.io/js-style-guide/typescript/base#prefer-ts-expect-error
252
- "@typescript-eslint/prefer-ts-expect-error": "error",
253
240
  "@typescript-eslint/sort-type-constituents": 0,
254
241
  // https://jc-verse.github.io/js-style-guide/typescript/base#triple-slash-reference
255
242
  "@typescript-eslint/triple-slash-reference": [
@@ -271,7 +258,6 @@ export default tseslint.config({
271
258
  "@typescript-eslint/default-param-last": "off",
272
259
  "@typescript-eslint/explicit-module-boundary-types": "off",
273
260
  "@typescript-eslint/no-require-imports": "off",
274
- "@typescript-eslint/no-var-requires": "off",
275
261
  },
276
262
  }, {
277
263
  files: ["**/*.{ts,tsx,cts,mts}"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-jc",
3
- "version": "5.2.0",
3
+ "version": "6.0.0",
4
4
  "description": "Josh-Cena's personal coding style",
5
5
  "type": "module",
6
6
  "repository": {
@@ -36,20 +36,22 @@
36
36
  "prepublishOnly": "yarn build"
37
37
  },
38
38
  "dependencies": {
39
- "@typescript-eslint/eslint-plugin": "^7.8.0",
40
- "@typescript-eslint/parser": "^7.8.0",
39
+ "@typescript-eslint/eslint-plugin": "^8.8.1",
40
+ "@typescript-eslint/parser": "^8.8.1",
41
41
  "eslint-config-prettier": "^9.1.0",
42
- "eslint-plugin-header": "^3.1.1",
43
- "eslint-plugin-import": "^2.29.1",
44
- "eslint-plugin-jsx-a11y": "^6.8.0",
45
- "eslint-plugin-n": "^17.4.0",
46
- "eslint-plugin-react": "^7.34.1",
42
+ "eslint-plugin-import": "^2.31.0",
43
+ "eslint-plugin-jsx-a11y": "^6.10.0",
44
+ "eslint-plugin-n": "^17.11.1",
45
+ "eslint-plugin-react": "^7.37.1",
47
46
  "eslint-plugin-react-hooks": "^4.6.2",
48
- "eslint-plugin-regexp": "^2.5.0",
49
- "globals": "^15.0.0",
50
- "typescript-eslint": "^7.8.0"
47
+ "eslint-plugin-regexp": "^2.6.0",
48
+ "globals": "^15.11.0",
49
+ "typescript-eslint": "^8.8.1"
51
50
  },
52
51
  "devDependencies": {
53
52
  "@types/eslint-config-prettier": "^6.11.3"
53
+ },
54
+ "peerDependencies": {
55
+ "eslint": "^9.12.0"
54
56
  }
55
57
  }
package/src/base.ts CHANGED
@@ -313,7 +313,7 @@ export default tseslint.config({
313
313
  "no-extra-bind": "error",
314
314
 
315
315
  // https://jc-verse.github.io/js-style-guide/eslint-base/operators#no-extra-boolean-cast
316
- "no-extra-boolean-cast": ["error", { enforceForLogicalOperands: true }],
316
+ "no-extra-boolean-cast": ["error", { enforceForInnerExpressions: true }],
317
317
 
318
318
  // https://jc-verse.github.io/js-style-guide/eslint-base/control-flow#no-extra-label
319
319
  "no-extra-label": "error",
@@ -727,6 +727,9 @@ export default tseslint.config({
727
727
  },
728
728
  ],
729
729
 
730
+ // https://jc-verse.github.io/js-style-guide/eslint-base/variables-names#no-useless-assignment
731
+ "no-useless-assignment": "error",
732
+
730
733
  // https://jc-verse.github.io/js-style-guide/eslint-base/literals#no-useless-backreference
731
734
  "no-useless-backreference": "error",
732
735
 
package/src/index.ts CHANGED
@@ -17,7 +17,7 @@ import reactPropTypesRules from "./react-prop-types.js";
17
17
 
18
18
  function expandConfig(
19
19
  config: TSESLint.FlatConfig.ConfigArray,
20
- enabled: undefined | boolean | TSESLint.FlatConfig.FileSpec[],
20
+ enabled: undefined | boolean | (string[] | string)[],
21
21
  ): TSESLint.FlatConfig.ConfigArray {
22
22
  if (enabled === true) return config;
23
23
  if (!enabled) return [];
@@ -34,11 +34,11 @@ export default function configCreator({
34
34
  reactClassComp,
35
35
  reactPropTypes,
36
36
  }: {
37
- react?: boolean | TSESLint.FlatConfig.FileSpec[];
38
- typescriptTypeCheck?: boolean | TSESLint.FlatConfig.FileSpec[];
39
- node?: boolean | TSESLint.FlatConfig.FileSpec[];
40
- reactClassComp?: boolean | TSESLint.FlatConfig.FileSpec[];
41
- reactPropTypes?: boolean | TSESLint.FlatConfig.FileSpec[];
37
+ react?: boolean | (string[] | string)[];
38
+ typescriptTypeCheck?: boolean | (string[] | string)[];
39
+ node?: boolean | (string[] | string)[];
40
+ reactClassComp?: boolean | (string[] | string)[];
41
+ reactPropTypes?: boolean | (string[] | string)[];
42
42
  } = {}): TSESLint.FlatConfig.ConfigArray {
43
43
  return tseslint.config(
44
44
  {
package/src/jsx.ts CHANGED
@@ -362,6 +362,8 @@ export default tseslint.config({
362
362
  // We like spreading
363
363
  "react/jsx-props-no-spreading": "off",
364
364
 
365
+ "react/jsx-props-no-spread-multi": "error",
366
+
365
367
  "react/jsx-sort-props": 0,
366
368
 
367
369
  // Formatting
package/src/node.ts CHANGED
@@ -10,6 +10,7 @@ export default tseslint.config({
10
10
  },
11
11
  },
12
12
  plugins: {
13
+ // @ts-expect-error: TODO make an issue
13
14
  n: nPlugin,
14
15
  },
15
16
  rules: {
package/src/react.ts CHANGED
@@ -21,10 +21,13 @@ export default tseslint.config({
21
21
 
22
22
  "react/boolean-prop-naming": "off",
23
23
 
24
- "react/checked-requires-onchange-or-readonly": ["error", {
25
- ignoreExclusiveCheckedAttribute: false,
26
- ignoreMissingProperties: false,
27
- }],
24
+ "react/checked-requires-onchange-or-readonly": [
25
+ "error",
26
+ {
27
+ ignoreExclusiveCheckedAttribute: false,
28
+ ignoreMissingProperties: false,
29
+ },
30
+ ],
28
31
 
29
32
  // Sometimes we do need `props` as a whole, e.g. for spreading
30
33
  "react/destructuring-assignment": "off",
@@ -38,6 +41,8 @@ export default tseslint.config({
38
41
 
39
42
  "react/forbid-elements": 0,
40
43
 
44
+ "react/forward-ref-uses-ref": "error",
45
+
41
46
  // Note that it false-positives for `const Foo: Comp = () => <></>`
42
47
  "react/function-component-definition": [
43
48
  "warn",
@@ -36,6 +36,8 @@ export default tseslint.config({
36
36
  },
37
37
  ],
38
38
 
39
+ "@typescript-eslint/no-deprecated": "warn",
40
+
39
41
  "@typescript-eslint/no-floating-promises": [
40
42
  "warn",
41
43
  {
@@ -56,7 +58,7 @@ export default tseslint.config({
56
58
 
57
59
  "@typescript-eslint/no-unnecessary-condition": [
58
60
  "error",
59
- { allowConstantLoopConditions: true },
61
+ { allowConstantLoopConditions: true, checkTypePredicates: true },
60
62
  ],
61
63
 
62
64
  // Enums & namespaces aren't allowed anyway.
@@ -130,6 +132,6 @@ export default tseslint.config({
130
132
  // Not very useful in practice... A lot of false-positives
131
133
  "@typescript-eslint/unbound-method": "off",
132
134
 
133
- "@typescript-eslint/use-unknown-in-catch-callback-variables": "error",
135
+ "@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
134
136
  },
135
137
  });
package/src/typescript.ts CHANGED
@@ -33,17 +33,6 @@ export default tseslint.config(
33
33
  // https://jc-verse.github.io/js-style-guide/typescript/base#ban-tslint-comment
34
34
  "@typescript-eslint/ban-tslint-comment": "error",
35
35
 
36
- // https://jc-verse.github.io/js-style-guide/typescript/base#ban-types
37
- "@typescript-eslint/ban-types": [
38
- "error",
39
- {
40
- extendDefaults: true,
41
- types: {
42
- "{}": false,
43
- },
44
- },
45
- ],
46
-
47
36
  // https://jc-verse.github.io/js-style-guide/typescript/base#class-literal-property-style
48
37
  "@typescript-eslint/class-literal-property-style": ["warn", "getters"],
49
38
 
@@ -98,7 +87,7 @@ export default tseslint.config(
98
87
 
99
88
  "init-declarations": "off",
100
89
  // https://jc-verse.github.io/js-style-guide/typescript/base#init-declarations
101
-
90
+
102
91
  "@typescript-eslint/init-declarations": ["error", "always"],
103
92
 
104
93
  // We turn off the base rule too
@@ -121,22 +110,25 @@ export default tseslint.config(
121
110
 
122
111
  "no-dupe-class-members": "off",
123
112
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-dupe-class-members
124
-
113
+
125
114
  "@typescript-eslint/no-dupe-class-members": "error",
126
115
 
127
116
  // This can be useful for dynamic object transformations
128
117
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-dynamic-delete
129
118
  "@typescript-eslint/no-dynamic-delete": "off",
130
119
 
120
+ // https://jc-verse.github.io/js-style-guide/typescript/base#no-empty-object-type
121
+ "@typescript-eslint/no-empty-object-type": [
122
+ "warn",
123
+ {
124
+ allowInterfaces: "with-single-extends",
125
+ allowObjectTypes: "never",
126
+ },
127
+ ],
128
+
131
129
  // We turn off the base rule too
132
130
  "@typescript-eslint/no-empty-function": "off",
133
131
 
134
- // https://jc-verse.github.io/js-style-guide/typescript/base#no-empty-interface
135
- "@typescript-eslint/no-empty-interface": [
136
- "error",
137
- { allowSingleExtends: true },
138
- ],
139
-
140
132
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-explicit-any
141
133
  "@typescript-eslint/no-explicit-any": "warn",
142
134
 
@@ -175,9 +167,6 @@ export default tseslint.config(
175
167
  // We turn off the base rule too
176
168
  "@typescript-eslint/no-loop-func": "off",
177
169
 
178
- // To be deprecated
179
- "@typescript-eslint/no-loss-of-precision": "off",
180
-
181
170
  // We turn off the base rule too
182
171
  "@typescript-eslint/no-magic-numbers": "off",
183
172
 
@@ -200,7 +189,7 @@ export default tseslint.config(
200
189
 
201
190
  "no-redeclare": "off",
202
191
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-redeclare
203
-
192
+
204
193
  "@typescript-eslint/no-redeclare": [
205
194
  "error",
206
195
  {
@@ -216,7 +205,7 @@ export default tseslint.config(
216
205
 
217
206
  "no-shadow": "off",
218
207
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-shadow
219
-
208
+
220
209
  "@typescript-eslint/no-shadow": [
221
210
  "warn",
222
211
  {
@@ -243,7 +232,7 @@ export default tseslint.config(
243
232
 
244
233
  "no-unused-expressions": "off",
245
234
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-unused-expressions
246
-
235
+
247
236
  "@typescript-eslint/no-unused-expressions": [
248
237
  "error",
249
238
  {
@@ -256,7 +245,7 @@ export default tseslint.config(
256
245
 
257
246
  "no-unused-vars": "off",
258
247
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-unused-vars
259
-
248
+
260
249
  "@typescript-eslint/no-unused-vars": [
261
250
  "error",
262
251
  {
@@ -268,7 +257,7 @@ export default tseslint.config(
268
257
  ],
269
258
 
270
259
  "no-use-before-define": "off",
271
-
260
+
272
261
  "@typescript-eslint/no-use-before-define": [
273
262
  "error",
274
263
  {
@@ -283,15 +272,12 @@ export default tseslint.config(
283
272
  ],
284
273
 
285
274
  "no-useless-constructor": "off",
286
-
275
+
287
276
  "@typescript-eslint/no-useless-constructor": "error",
288
277
 
289
278
  // https://jc-verse.github.io/js-style-guide/typescript/base#no-useless-empty-export
290
279
  "@typescript-eslint/no-useless-empty-export": "error",
291
280
 
292
- // https://jc-verse.github.io/js-style-guide/typescript/base#no-var-requires
293
- "@typescript-eslint/no-var-requires": "error",
294
-
295
281
  // https://jc-verse.github.io/js-style-guide/typescript/base#parameter-properties
296
282
  "@typescript-eslint/parameter-properties": [
297
283
  "warn",
@@ -319,9 +305,6 @@ export default tseslint.config(
319
305
  // https://jc-verse.github.io/js-style-guide/typescript/base#prefer-namespace-keyword
320
306
  "@typescript-eslint/prefer-namespace-keyword": "error",
321
307
 
322
- // https://jc-verse.github.io/js-style-guide/typescript/base#prefer-ts-expect-error
323
- "@typescript-eslint/prefer-ts-expect-error": "error",
324
-
325
308
  "@typescript-eslint/sort-type-constituents": 0,
326
309
 
327
310
  // https://jc-verse.github.io/js-style-guide/typescript/base#triple-slash-reference
@@ -347,7 +330,6 @@ export default tseslint.config(
347
330
  "@typescript-eslint/default-param-last": "off",
348
331
  "@typescript-eslint/explicit-module-boundary-types": "off",
349
332
  "@typescript-eslint/no-require-imports": "off",
350
- "@typescript-eslint/no-var-requires": "off",
351
333
  },
352
334
  },
353
335
  {