@typescript-eslint/eslint-plugin 6.8.1-alpha.7 → 6.9.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 (88) hide show
  1. package/dist/rules/default-param-last.js +1 -1
  2. package/dist/rules/default-param-last.js.map +1 -1
  3. package/dist/rules/enum-utils/shared.js +56 -5
  4. package/dist/rules/enum-utils/shared.js.map +1 -1
  5. package/dist/rules/explicit-function-return-type.js +1 -1
  6. package/dist/rules/explicit-function-return-type.js.map +1 -1
  7. package/dist/rules/naming-convention-utils/enums.js +2 -0
  8. package/dist/rules/naming-convention-utils/enums.js.map +1 -1
  9. package/dist/rules/naming-convention-utils/parse-options.js +1 -0
  10. package/dist/rules/naming-convention-utils/parse-options.js.map +1 -1
  11. package/dist/rules/no-empty-function.js +1 -1
  12. package/dist/rules/no-empty-function.js.map +1 -1
  13. package/dist/rules/no-namespace.js +1 -2
  14. package/dist/rules/no-namespace.js.map +1 -1
  15. package/dist/rules/no-non-null-asserted-nullish-coalescing.js +1 -1
  16. package/dist/rules/no-non-null-asserted-nullish-coalescing.js.map +1 -1
  17. package/dist/rules/no-redeclare.js.map +1 -1
  18. package/dist/rules/no-shadow.js +1 -1
  19. package/dist/rules/no-shadow.js.map +1 -1
  20. package/dist/rules/no-unsafe-assignment.js +1 -1
  21. package/dist/rules/no-unsafe-assignment.js.map +1 -1
  22. package/dist/rules/no-unsafe-enum-comparison.js +29 -0
  23. package/dist/rules/no-unsafe-enum-comparison.js.map +1 -1
  24. package/dist/rules/no-unsafe-return.js +2 -1
  25. package/dist/rules/no-unsafe-return.js.map +1 -1
  26. package/dist/rules/prefer-readonly.js +2 -1
  27. package/dist/rules/prefer-readonly.js.map +1 -1
  28. package/dist/rules/prefer-regexp-exec.js.map +1 -1
  29. package/dist/util/collectUnusedVariables.js +1 -1
  30. package/dist/util/collectUnusedVariables.js.map +1 -1
  31. package/dist/util/getOperatorPrecedence.js.map +1 -1
  32. package/docs/rules/array-type.md +6 -6
  33. package/docs/rules/ban-ts-comment.md +10 -8
  34. package/docs/rules/ban-types.md +1 -57
  35. package/docs/rules/class-literal-property-style.md +4 -12
  36. package/docs/rules/class-methods-use-this.md +2 -2
  37. package/docs/rules/consistent-generic-constructors.md +4 -4
  38. package/docs/rules/consistent-indexed-object-style.md +4 -12
  39. package/docs/rules/consistent-type-assertions.md +4 -4
  40. package/docs/rules/consistent-type-definitions.md +4 -12
  41. package/docs/rules/consistent-type-exports.md +2 -2
  42. package/docs/rules/consistent-type-imports.md +5 -5
  43. package/docs/rules/dot-notation.md +3 -3
  44. package/docs/rules/explicit-function-return-type.md +14 -14
  45. package/docs/rules/explicit-member-accessibility.md +15 -15
  46. package/docs/rules/explicit-module-boundary-types.md +8 -8
  47. package/docs/rules/lines-between-class-members.md +2 -6
  48. package/docs/rules/member-ordering.md +34 -34
  49. package/docs/rules/method-signature-style.md +4 -4
  50. package/docs/rules/no-array-constructor.md +0 -4
  51. package/docs/rules/no-base-to-string.md +1 -1
  52. package/docs/rules/no-confusing-void-expression.md +2 -2
  53. package/docs/rules/no-empty-function.md +4 -4
  54. package/docs/rules/no-explicit-any.md +1 -3
  55. package/docs/rules/no-extraneous-class.md +8 -8
  56. package/docs/rules/no-floating-promises.md +2 -2
  57. package/docs/rules/no-inferrable-types.md +2 -2
  58. package/docs/rules/no-invalid-void-type.md +4 -4
  59. package/docs/rules/no-magic-numbers.md +8 -24
  60. package/docs/rules/no-misused-promises.md +6 -6
  61. package/docs/rules/no-namespace.md +6 -6
  62. package/docs/rules/no-redeclare.md +2 -2
  63. package/docs/rules/no-restricted-imports.md +2 -2
  64. package/docs/rules/no-shadow.md +2 -2
  65. package/docs/rules/no-type-alias.md +33 -33
  66. package/docs/rules/no-unnecessary-boolean-literal-compare.md +4 -4
  67. package/docs/rules/no-unnecessary-condition.md +1 -1
  68. package/docs/rules/no-unnecessary-type-assertion.md +2 -2
  69. package/docs/rules/no-unsafe-argument.md +2 -2
  70. package/docs/rules/no-unsafe-assignment.md +1 -1
  71. package/docs/rules/no-unsafe-return.md +1 -1
  72. package/docs/rules/no-use-before-define.md +4 -12
  73. package/docs/rules/parameter-properties.md +16 -16
  74. package/docs/rules/prefer-literal-enum-member.md +2 -2
  75. package/docs/rules/prefer-nullish-coalescing.md +8 -8
  76. package/docs/rules/prefer-optional-chain.md +15 -15
  77. package/docs/rules/prefer-readonly-parameter-types.md +46 -27
  78. package/docs/rules/prefer-readonly.md +11 -3
  79. package/docs/rules/require-array-sort-compare.md +2 -2
  80. package/docs/rules/restrict-plus-operands.md +12 -12
  81. package/docs/rules/restrict-template-expressions.md +7 -7
  82. package/docs/rules/return-await.md +6 -6
  83. package/docs/rules/triple-slash-reference.md +6 -6
  84. package/docs/rules/type-annotation-spacing.md +8 -8
  85. package/docs/rules/typedef.md +16 -16
  86. package/docs/rules/unbound-method.md +1 -1
  87. package/docs/rules/unified-signatures.md +2 -2
  88. package/package.json +8 -8
@@ -98,7 +98,7 @@ type Foo = () => {};
98
98
  #### ❌ Incorrect
99
99
 
100
100
  <!-- prettier-ignore -->
101
- ```ts
101
+ ```ts option='{ "before": false, "after": true }'
102
102
  let foo:string = "bar";
103
103
  let foo :string = "bar";
104
104
  let foo : string = "bar";
@@ -127,7 +127,7 @@ type Foo = () => {};
127
127
  #### ✅ Correct
128
128
 
129
129
  <!-- prettier-ignore -->
130
- ```ts
130
+ ```ts option='{ "before": false, "after": true }'
131
131
  let foo: string = "bar";
132
132
 
133
133
  function foo(): string {}
@@ -150,7 +150,7 @@ type Foo = ()=> {};
150
150
  #### ❌ Incorrect
151
151
 
152
152
  <!-- prettier-ignore -->
153
- ```ts
153
+ ```ts option='{ "before": true, "after": true }'
154
154
  let foo: string = "bar";
155
155
  let foo:string = "bar";
156
156
  let foo :string = "bar";
@@ -179,7 +179,7 @@ type Foo = ()=> {};
179
179
  #### ✅ Correct
180
180
 
181
181
  <!-- prettier-ignore -->
182
- ```ts
182
+ ```ts option='{ "before": true, "after": true }'
183
183
  let foo : string = "bar";
184
184
 
185
185
  function foo() : string {}
@@ -206,7 +206,7 @@ type Foo = () => {};
206
206
  #### ❌ Incorrect
207
207
 
208
208
  <!-- prettier-ignore -->
209
- ```ts
209
+ ```ts option='{"before":false,"after":false,"overrides":{"colon":{"before":true,"after":true}}}'
210
210
  let foo: string = "bar";
211
211
  let foo:string = "bar";
212
212
  let foo :string = "bar";
@@ -235,7 +235,7 @@ type Foo = () => {};
235
235
  #### ✅ Correct
236
236
 
237
237
  <!-- prettier-ignore -->
238
- ```ts
238
+ ```ts option='{"before":false,"after":false,"overrides":{"colon":{"before":true,"after":true}}}'
239
239
  let foo : string = "bar";
240
240
 
241
241
  function foo() : string {}
@@ -266,7 +266,7 @@ type Foo = ()=>{};
266
266
  #### ❌ Incorrect
267
267
 
268
268
  <!-- prettier-ignore -->
269
- ```ts
269
+ ```ts option='{"before":false,"after":false,"overrides":{"arrow":{"before":true,"after":true}}}'
270
270
  let foo: string = "bar";
271
271
  let foo : string = "bar";
272
272
  let foo :string = "bar";
@@ -295,7 +295,7 @@ type Foo = ()=> {};
295
295
  #### ✅ Correct
296
296
 
297
297
  <!-- prettier-ignore -->
298
- ```ts
298
+ ```ts option='{"before":false,"after":false,"overrides":{"arrow":{"before":true,"after":true}}}'
299
299
  let foo:string = "bar";
300
300
 
301
301
  function foo():string {}
@@ -67,14 +67,14 @@ Examples of code with `{ "arrayDestructuring": true }`:
67
67
 
68
68
  #### ❌ Incorrect
69
69
 
70
- ```ts
70
+ ```ts option='{ "arrayDestructuring": true }'
71
71
  const [a] = [1];
72
72
  const [b, c] = [1, 2];
73
73
  ```
74
74
 
75
75
  #### ✅ Correct
76
76
 
77
- ```ts
77
+ ```ts option='{ "arrayDestructuring": true }'
78
78
  const [a]: number[] = [1];
79
79
  const [b]: [number] = [2];
80
80
  const [c, d]: [boolean, string] = [true, 'text'];
@@ -93,7 +93,7 @@ Examples of code with `{ "arrowParameter": true }`:
93
93
 
94
94
  #### ❌ Incorrect
95
95
 
96
- ```ts
96
+ ```ts option='{ "arrowParameter": true }'
97
97
  const logsSize = size => console.log(size);
98
98
 
99
99
  ['hello', 'world'].map(text => text.length);
@@ -105,7 +105,7 @@ const mapper = {
105
105
 
106
106
  #### ✅ Correct
107
107
 
108
- ```ts
108
+ ```ts option='{ "arrowParameter": true }'
109
109
  const logsSize = (size: number) => console.log(size);
110
110
 
111
111
  ['hello', 'world'].map((text: string) => text.length);
@@ -125,7 +125,7 @@ Examples of code with `{ "memberVariableDeclaration": true }`:
125
125
 
126
126
  #### ❌ Incorrect
127
127
 
128
- ```ts
128
+ ```ts option='{ "memberVariableDeclaration": true }'
129
129
  class ContainsText {
130
130
  delayedText;
131
131
  immediateTextImplicit = 'text';
@@ -134,7 +134,7 @@ class ContainsText {
134
134
 
135
135
  #### ✅ Correct
136
136
 
137
- ```ts
137
+ ```ts option='{ "memberVariableDeclaration": true }'
138
138
  class ContainsText {
139
139
  delayedText: string;
140
140
  immediateTextImplicit: string = 'text';
@@ -151,14 +151,14 @@ Examples of code with `{ "objectDestructuring": true }`:
151
151
 
152
152
  #### ❌ Incorrect
153
153
 
154
- ```ts
154
+ ```ts option='{ "objectDestructuring": true }'
155
155
  const { length } = 'text';
156
156
  const [b, c] = Math.random() ? [1, 2] : [3, 4];
157
157
  ```
158
158
 
159
159
  #### ✅ Correct
160
160
 
161
- ```ts
161
+ ```ts option='{ "objectDestructuring": true }'
162
162
  const { length }: { length: number } = 'text';
163
163
  const [b, c]: [number, number] = Math.random() ? [1, 2] : [3, 4];
164
164
 
@@ -176,7 +176,7 @@ Examples of code with `{ "parameter": true }`:
176
176
 
177
177
  #### ❌ Incorrect
178
178
 
179
- ```ts
179
+ ```ts option='{ "parameter": true }'
180
180
  function logsSize(size): void {
181
181
  console.log(size);
182
182
  }
@@ -204,7 +204,7 @@ class Logger {
204
204
 
205
205
  #### ✅ Correct
206
206
 
207
- ```ts
207
+ ```ts option='{ "parameter": true }'
208
208
  function logsSize(size: number): void {
209
209
  console.log(size);
210
210
  }
@@ -240,7 +240,7 @@ Examples of code with `{ "propertyDeclaration": true }`:
240
240
 
241
241
  #### ❌ Incorrect
242
242
 
243
- ```ts
243
+ ```ts option='{ "propertyDeclaration": true }'
244
244
  type Members = {
245
245
  member;
246
246
  otherMember;
@@ -249,7 +249,7 @@ type Members = {
249
249
 
250
250
  #### ✅ Correct
251
251
 
252
- ```ts
252
+ ```ts option='{ "propertyDeclaration": true }'
253
253
  type Members = {
254
254
  member: boolean;
255
255
  otherMember: string;
@@ -266,7 +266,7 @@ Examples of code with `{ "variableDeclaration": true }`:
266
266
 
267
267
  #### ❌ Incorrect
268
268
 
269
- ```ts
269
+ ```ts option='{ "variableDeclaration": true }'
270
270
  const text = 'text';
271
271
  let initialText = 'text';
272
272
  let delayedText;
@@ -274,7 +274,7 @@ let delayedText;
274
274
 
275
275
  #### ✅ Correct
276
276
 
277
- ```ts
277
+ ```ts option='{ "variableDeclaration": true }'
278
278
  const text: string = 'text';
279
279
  let initialText: string = 'text';
280
280
  let delayedText: string;
@@ -290,13 +290,13 @@ Examples of code with `{ "variableDeclaration": true, "variableDeclarationIgnore
290
290
 
291
291
  #### ❌ Incorrect
292
292
 
293
- ```ts
293
+ ```ts option='{ "variableDeclaration": true, "variableDeclarationIgnoreFunction": true }'
294
294
  const text = 'text';
295
295
  ```
296
296
 
297
297
  #### ✅ Correct
298
298
 
299
- ```ts
299
+ ```ts option='{ "variableDeclaration": true, "variableDeclarationIgnoreFunction": true }'
300
300
  const a = (): void => {};
301
301
  const b = function (): void => {};
302
302
  const c: () => void = (): void => {};
@@ -83,7 +83,7 @@ const { double } = arith;
83
83
 
84
84
  Examples of **correct** code for this rule with `{ ignoreStatic: true }`:
85
85
 
86
- ```ts
86
+ ```ts option='{ "ignoreStatic": true }' showPlaygroundButton
87
87
  class OtherClass {
88
88
  static log() {
89
89
  console.log(OtherClass);
@@ -55,14 +55,14 @@ Examples of code for this rule with `ignoreDifferentlyNamedParameters`:
55
55
 
56
56
  ### ❌ Incorrect
57
57
 
58
- ```ts
58
+ ```ts option='{ "ignoreDifferentlyNamedParameters": true }'
59
59
  function f(a: number): void;
60
60
  function f(a: string): void;
61
61
  ```
62
62
 
63
63
  ### ✅ Correct
64
64
 
65
- ```ts
65
+ ```ts option='{ "ignoreDifferentlyNamedParameters": true }'
66
66
  function f(a: number): void;
67
67
  function f(b: string): void;
68
68
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/eslint-plugin",
3
- "version": "6.8.1-alpha.7+ee4fe8914",
3
+ "version": "6.9.0",
4
4
  "description": "TypeScript plugin for ESLint",
5
5
  "files": [
6
6
  "dist",
@@ -57,10 +57,10 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@eslint-community/regexpp": "^4.5.1",
60
- "@typescript-eslint/scope-manager": "6.8.1-alpha.7+ee4fe8914",
61
- "@typescript-eslint/type-utils": "6.8.1-alpha.7+ee4fe8914",
62
- "@typescript-eslint/utils": "6.8.1-alpha.7+ee4fe8914",
63
- "@typescript-eslint/visitor-keys": "6.8.1-alpha.7+ee4fe8914",
60
+ "@typescript-eslint/scope-manager": "6.9.0",
61
+ "@typescript-eslint/type-utils": "6.9.0",
62
+ "@typescript-eslint/utils": "6.9.0",
63
+ "@typescript-eslint/visitor-keys": "6.9.0",
64
64
  "debug": "^4.3.4",
65
65
  "graphemer": "^1.4.0",
66
66
  "ignore": "^5.2.4",
@@ -73,8 +73,8 @@
73
73
  "@types/debug": "*",
74
74
  "@types/marked": "*",
75
75
  "@types/natural-compare": "*",
76
- "@typescript-eslint/rule-schema-to-typescript-types": "6.8.0",
77
- "@typescript-eslint/rule-tester": "6.8.1-alpha.7+ee4fe8914",
76
+ "@typescript-eslint/rule-schema-to-typescript-types": "6.9.0",
77
+ "@typescript-eslint/rule-tester": "6.9.0",
78
78
  "ajv": "^6.12.6",
79
79
  "chalk": "^5.3.0",
80
80
  "cross-fetch": "*",
@@ -103,5 +103,5 @@
103
103
  "type": "opencollective",
104
104
  "url": "https://opencollective.com/typescript-eslint"
105
105
  },
106
- "gitHead": "ee4fe891400376138191fd9c83defa0388973060"
106
+ "gitHead": "101563b34ad21c68177ab6ed373c0eb1643e1888"
107
107
  }