eslint-config-jc 2.3.0 → 2.3.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-jc",
3
- "version": "2.3.0",
3
+ "version": "2.3.3",
4
4
  "description": "Josh-Cena's personal coding style",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -35,14 +35,14 @@
35
35
  "eslint-config-prettier": "^8.5.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@typescript-eslint/eslint-plugin": "^5.26.0",
39
- "@typescript-eslint/parser": "^5.26.0",
40
- "eslint": "^8.16.0",
38
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
39
+ "@typescript-eslint/parser": "^5.32.0",
40
+ "eslint": "^8.21.0",
41
41
  "eslint-plugin-header": "^3.1.1",
42
42
  "eslint-plugin-import": "^2.26.0",
43
- "eslint-plugin-jsx-a11y": "^6.5.1",
44
- "eslint-plugin-react": "^7.30.0",
45
- "eslint-plugin-react-hooks": "^4.5.0"
43
+ "eslint-plugin-jsx-a11y": "^6.6.1",
44
+ "eslint-plugin-react": "^7.30.1",
45
+ "eslint-plugin-react-hooks": "^4.6.0"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "eslint-plugin-header": {
package/rules/base.js CHANGED
@@ -2,6 +2,7 @@ module.exports = {
2
2
  env: {
3
3
  browser: true,
4
4
  commonjs: true,
5
+ es6: true,
5
6
  node: true,
6
7
  },
7
8
  reportUnusedDisableDirectives: true,
@@ -38,7 +39,10 @@ module.exports = {
38
39
  "capitalized-comments": [
39
40
  "warn",
40
41
  "always",
41
- { ignoreConsecutiveComments: true },
42
+ {
43
+ ignoreConsecutiveComments: true,
44
+ ignorePattern: "prettier-ignore|cSpell:ignore",
45
+ },
42
46
  ],
43
47
 
44
48
  // It's a way of allowing private methods. (`this.myPrivateMethod()`)
@@ -164,8 +168,9 @@ module.exports = {
164
168
 
165
169
  "no-cond-assign": ["error", "always"],
166
170
 
167
- // Fixable, so better report this. Prettier doesn't fix it all the time
168
- "no-confusing-arrow": "error",
171
+ // This conflicts with Prettier, and syntax highlighting should be
172
+ // sufficient to catch this
173
+ "no-confusing-arrow": "off",
169
174
 
170
175
  // In projects with a wrapped logger, this can be enabled
171
176
  "no-console": 0,
@@ -350,6 +355,7 @@ module.exports = {
350
355
  "closed",
351
356
  "confirm",
352
357
  "defaultStatus",
358
+ // cSpell:ignore defaultstatus
353
359
  "defaultstatus",
354
360
  "event",
355
361
  "external",
@@ -524,7 +530,7 @@ module.exports = {
524
530
 
525
531
  "no-var": "error",
526
532
 
527
- "no-void": "error",
533
+ "no-void": ["error", { allowAsStatement: true }],
528
534
 
529
535
  "no-warning-comments": "off",
530
536
 
package/rules/import.js CHANGED
@@ -20,7 +20,9 @@ module.exports = {
20
20
 
21
21
  "import/no-duplicates": "error",
22
22
 
23
- "import/no-unresolved": ["error", { caseSensitive: true, commonjs: true }],
23
+ // This rule doesn't play well with TypeScript + ESM. TS is able to catch
24
+ // missing import anyways.
25
+ "import/no-unresolved": ["off", { caseSensitive: true, commonjs: true }],
24
26
 
25
27
  // Going one directory above ensures transpilation doesn't mess with paths
26
28
  "import/no-useless-path-segments": "off",
package/rules/jsx.js CHANGED
@@ -216,7 +216,7 @@ module.exports = {
216
216
 
217
217
  "react/jsx-max-depth": "off",
218
218
 
219
- "react/jsx-no-bind": ["error", { ignoreDOMComponents: true }],
219
+ "react/jsx-no-bind": ["warn", { ignoreDOMComponents: true }],
220
220
 
221
221
  "react/jsx-no-comment-textnodes": "error",
222
222
 
@@ -1,110 +1,114 @@
1
- // TODO enforce linting with typecheck
2
1
  module.exports = {
3
- "@typescript-eslint/await-thenable": "error",
2
+ rules: {
3
+ "@typescript-eslint/await-thenable": "error",
4
4
 
5
- // Already enforced by --isolatedModules
6
- "@typescript-eslint/consistent-type-exports": "off",
5
+ // Also enforced by --isolatedModules
6
+ "@typescript-eslint/consistent-type-exports": "error",
7
7
 
8
- // TODO figure out how this should be configured
9
- "@typescript-eslint/naming-convention": 0,
8
+ // TODO figure out how this should be configured
9
+ "@typescript-eslint/naming-convention": 0,
10
10
 
11
- "@typescript-eslint/no-base-to-string": "warn",
11
+ "@typescript-eslint/no-base-to-string": [
12
+ "warn",
13
+ { ignoredTypeNames: ["RegExp", "Error"] },
14
+ ],
12
15
 
13
- "@typescript-eslint/no-confusing-void-expression": [
14
- "error",
15
- {
16
- ignoreArrowShorthand: true,
17
- ignoreVoidOperator: false,
18
- },
19
- ],
16
+ "@typescript-eslint/no-confusing-void-expression": [
17
+ "error",
18
+ {
19
+ ignoreArrowShorthand: true,
20
+ ignoreVoidOperator: false,
21
+ },
22
+ ],
20
23
 
21
- "@typescript-eslint/no-floating-promises": [
22
- "warn",
23
- {
24
- ignoreIIFE: false,
25
- ignoreVoid: true,
26
- },
27
- ],
24
+ "@typescript-eslint/no-floating-promises": [
25
+ "warn",
26
+ {
27
+ ignoreIIFE: false,
28
+ ignoreVoid: true,
29
+ },
30
+ ],
28
31
 
29
- "@typescript-eslint/no-for-in-array": "error",
32
+ "@typescript-eslint/no-for-in-array": "error",
30
33
 
31
- "@typescript-eslint/no-meaningless-void-operator": "error",
34
+ "@typescript-eslint/no-meaningless-void-operator": "error",
32
35
 
33
- "@typescript-eslint/no-misused-promises": "error",
36
+ "@typescript-eslint/no-misused-promises": "error",
34
37
 
35
- "@typescript-eslint/no-redundant-type-constituents": "error",
38
+ "@typescript-eslint/no-redundant-type-constituents": "error",
36
39
 
37
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
40
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
38
41
 
39
- "@typescript-eslint/no-unnecessary-condition": [
40
- "error",
41
- { allowConstantLoopConditions: true },
42
- ],
42
+ "@typescript-eslint/no-unnecessary-condition": [
43
+ "error",
44
+ { allowConstantLoopConditions: true },
45
+ ],
43
46
 
44
- // Enums & namespaces aren't allowed anyway.
45
- "@typescript-eslint/no-unnecessary-qualifier": "warn",
47
+ // Enums & namespaces aren't allowed anyway.
48
+ "@typescript-eslint/no-unnecessary-qualifier": "warn",
46
49
 
47
- "@typescript-eslint/no-unnecessary-type-arguments": "warn",
50
+ "@typescript-eslint/no-unnecessary-type-arguments": "warn",
48
51
 
49
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
52
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
50
53
 
51
- "@typescript-eslint/no-unsafe-argument": "error",
54
+ "@typescript-eslint/no-unsafe-argument": "error",
52
55
 
53
- "@typescript-eslint/no-unsafe-assignment": "error",
56
+ "@typescript-eslint/no-unsafe-assignment": "error",
54
57
 
55
- "@typescript-eslint/no-unsafe-call": "error",
58
+ "@typescript-eslint/no-unsafe-call": "error",
56
59
 
57
- "@typescript-eslint/no-unsafe-member-access": "error",
60
+ "@typescript-eslint/no-unsafe-member-access": "error",
58
61
 
59
- "@typescript-eslint/no-unsafe-return": "error",
62
+ "@typescript-eslint/no-unsafe-return": "error",
60
63
 
61
- "@typescript-eslint/non-nullable-type-assertion-style": "error",
64
+ "@typescript-eslint/non-nullable-type-assertion-style": "error",
62
65
 
63
- "@typescript-eslint/prefer-includes": "error",
66
+ "@typescript-eslint/prefer-includes": "error",
64
67
 
65
- // This has a significant number of false-positives.
66
- "@typescript-eslint/prefer-nullish-coalescing": "warn",
68
+ // This has a significant number of false-positives.
69
+ "@typescript-eslint/prefer-nullish-coalescing": "warn",
67
70
 
68
- // Isn't useful.
69
- "@typescript-eslint/prefer-readonly": "off",
71
+ // Isn't useful.
72
+ "@typescript-eslint/prefer-readonly": "off",
70
73
 
71
- // Isn't useful. If there's a readonly-by-default tsconfig option we would
72
- // happily try it instead
73
- "@typescript-eslint/prefer-readonly-parameter-types": "off",
74
+ // Isn't useful. If there's a readonly-by-default tsconfig option we would
75
+ // happily try it instead
76
+ "@typescript-eslint/prefer-readonly-parameter-types": "off",
74
77
 
75
- "@typescript-eslint/prefer-reduce-type-parameter": "error",
78
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
76
79
 
77
- "@typescript-eslint/prefer-regexp-exec": "warn",
80
+ "@typescript-eslint/prefer-regexp-exec": "warn",
78
81
 
79
- "@typescript-eslint/prefer-return-this-type": "warn",
82
+ "@typescript-eslint/prefer-return-this-type": "warn",
80
83
 
81
- "@typescript-eslint/prefer-string-starts-ends-with": "warn",
84
+ "@typescript-eslint/prefer-string-starts-ends-with": "warn",
82
85
 
83
- // Not useful. Sometimes we intentionally make the function non-async.
84
- "@typescript-eslint/promise-function-async": "off",
86
+ // Not useful. Sometimes we intentionally make the function non-async.
87
+ "@typescript-eslint/promise-function-async": "off",
85
88
 
86
- "@typescript-eslint/require-array-sort-compare": "error",
89
+ "@typescript-eslint/require-array-sort-compare": "error",
87
90
 
88
- // Implicit casting is fine.
89
- "@typescript-eslint/restrict-plus-operands": "off",
91
+ // Implicit casting is fine.
92
+ "@typescript-eslint/restrict-plus-operands": "off",
90
93
 
91
- // Default options work fine. However, not allowing `never` is quite annoying
92
- "@typescript-eslint/restrict-template-expressions": [
93
- "warn",
94
- {
95
- allowAny: false,
96
- allowBoolean: false,
97
- allowNullish: false,
98
- allowNumber: true,
99
- allowRegExp: false,
100
- },
101
- ],
94
+ // Default options work fine. However, not allowing `never` is a pain
95
+ "@typescript-eslint/restrict-template-expressions": [
96
+ "warn",
97
+ {
98
+ allowAny: false,
99
+ allowBoolean: false,
100
+ allowNullish: false,
101
+ allowNumber: true,
102
+ allowRegExp: false,
103
+ },
104
+ ],
102
105
 
103
- // TODO configure it properly
104
- "@typescript-eslint/strict-boolean-expressions": "off",
106
+ // TODO configure it properly
107
+ "@typescript-eslint/strict-boolean-expressions": "off",
105
108
 
106
- "@typescript-eslint/switch-exhaustiveness-check": "error",
109
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
107
110
 
108
- // Not very useful in practice... A lot of false-positives
109
- "@typescript-eslint/unbound-method": "off",
111
+ // Not very useful in practice... A lot of false-positives
112
+ "@typescript-eslint/unbound-method": "off",
113
+ },
110
114
  };
@@ -11,6 +11,13 @@ module.exports = {
11
11
  "@typescript-eslint/no-var-requires": "off",
12
12
  },
13
13
  },
14
+ {
15
+ files: ["**/*.{ts,tsx,cts,mts}"],
16
+ rules: {
17
+ // Use TypeScript's checker instead
18
+ "no-undef": "off",
19
+ },
20
+ },
14
21
  ],
15
22
  parser: "@typescript-eslint/parser",
16
23
  parserOptions: {
@@ -27,6 +34,11 @@ module.exports = {
27
34
 
28
35
  "@typescript-eslint/ban-types": "error",
29
36
 
37
+ "@typescript-eslint/consistent-generic-constructors": [
38
+ "error",
39
+ "constructor",
40
+ ],
41
+
30
42
  // Index signatures allows annotating the semantics of the key, while record
31
43
  // is more concise
32
44
  "@typescript-eslint/consistent-indexed-object-style": "off",
@@ -144,7 +156,14 @@ module.exports = {
144
156
  { allowTaggedTemplates: true },
145
157
  ],
146
158
 
147
- "@typescript-eslint/no-unused-vars": "error",
159
+ "@typescript-eslint/no-unused-vars": [
160
+ "error",
161
+ {
162
+ args: "after-used",
163
+ ignoreRestSiblings: true,
164
+ vars: "all",
165
+ },
166
+ ],
148
167
 
149
168
  // This reports a lot of valid cases, e.g. function declarations
150
169
  // TypeScript does a much better job