@typescript-eslint/eslint-plugin 7.2.1-alpha.2 → 7.2.1-alpha.4

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 (179) hide show
  1. package/dist/configs/all.js +1 -0
  2. package/dist/configs/all.js.map +1 -1
  3. package/dist/configs/disable-type-checked.js +1 -0
  4. package/dist/configs/disable-type-checked.js.map +1 -1
  5. package/dist/configs/strict-type-checked-only.js +23 -3
  6. package/dist/configs/strict-type-checked-only.js.map +1 -1
  7. package/dist/configs/strict-type-checked.js +27 -4
  8. package/dist/configs/strict-type-checked.js.map +1 -1
  9. package/dist/configs/strict.js +4 -1
  10. package/dist/configs/strict.js.map +1 -1
  11. package/dist/rules/ban-ts-comment.js +4 -1
  12. package/dist/rules/ban-ts-comment.js.map +1 -1
  13. package/dist/rules/index.js +2 -0
  14. package/dist/rules/index.js.map +1 -1
  15. package/dist/rules/no-floating-promises.js +4 -1
  16. package/dist/rules/no-floating-promises.js.map +1 -1
  17. package/dist/rules/no-misused-promises.js +1 -1
  18. package/dist/rules/no-misused-promises.js.map +1 -1
  19. package/dist/rules/no-unnecessary-qualifier.js +1 -1
  20. package/dist/rules/no-unnecessary-qualifier.js.map +1 -1
  21. package/dist/rules/no-unsafe-argument.js +1 -25
  22. package/dist/rules/no-unsafe-argument.js.map +1 -1
  23. package/dist/rules/no-unused-expressions.js +6 -2
  24. package/dist/rules/no-unused-expressions.js.map +1 -1
  25. package/dist/rules/restrict-plus-operands.js +12 -1
  26. package/dist/rules/restrict-plus-operands.js.map +1 -1
  27. package/dist/rules/restrict-template-expressions.js +13 -1
  28. package/dist/rules/restrict-template-expressions.js.map +1 -1
  29. package/dist/rules/use-unknown-in-catch-callback-variable.js +283 -0
  30. package/dist/rules/use-unknown-in-catch-callback-variable.js.map +1 -0
  31. package/dist/util/misc.js +10 -1
  32. package/dist/util/misc.js.map +1 -1
  33. package/docs/rules/TEMPLATE.md +10 -4
  34. package/docs/rules/{adjacent-overload-signatures.md → adjacent-overload-signatures.mdx} +11 -5
  35. package/docs/rules/{array-type.md → array-type.mdx} +24 -12
  36. package/docs/rules/{await-thenable.md → await-thenable.mdx} +10 -4
  37. package/docs/rules/{ban-ts-comment.md → ban-ts-comment.mdx} +32 -18
  38. package/docs/rules/{ban-tslint-comment.md → ban-tslint-comment.mdx} +10 -4
  39. package/docs/rules/{ban-types.md → ban-types.mdx} +11 -5
  40. package/docs/rules/{block-spacing.md → block-spacing.mdx} +3 -0
  41. package/docs/rules/{brace-style.md → brace-style.mdx} +3 -0
  42. package/docs/rules/camelcase.md +3 -5
  43. package/docs/rules/{class-literal-property-style.md → class-literal-property-style.mdx} +18 -11
  44. package/docs/rules/{class-methods-use-this.md → class-methods-use-this.mdx} +12 -6
  45. package/docs/rules/{comma-dangle.md → comma-dangle.mdx} +3 -0
  46. package/docs/rules/{comma-spacing.md → comma-spacing.mdx} +3 -0
  47. package/docs/rules/{consistent-generic-constructors.md → consistent-generic-constructors.mdx} +17 -8
  48. package/docs/rules/{consistent-indexed-object-style.md → consistent-indexed-object-style.mdx} +17 -8
  49. package/docs/rules/{consistent-return.md → consistent-return.mdx} +10 -4
  50. package/docs/rules/{consistent-type-assertions.md → consistent-type-assertions.mdx} +15 -10
  51. package/docs/rules/{consistent-type-definitions.md → consistent-type-definitions.mdx} +17 -8
  52. package/docs/rules/{consistent-type-exports.md → consistent-type-exports.mdx} +17 -8
  53. package/docs/rules/{consistent-type-imports.md → consistent-type-imports.mdx} +13 -8
  54. package/docs/rules/{default-param-last.md → default-param-last.mdx} +10 -4
  55. package/docs/rules/{dot-notation.md → dot-notation.mdx} +3 -0
  56. package/docs/rules/{explicit-function-return-type.md → explicit-function-return-type.mdx} +59 -32
  57. package/docs/rules/{explicit-member-accessibility.md → explicit-member-accessibility.mdx} +3 -0
  58. package/docs/rules/{explicit-module-boundary-types.md → explicit-module-boundary-types.mdx} +39 -21
  59. package/docs/rules/{func-call-spacing.md → func-call-spacing.mdx} +3 -0
  60. package/docs/rules/{indent.md → indent.mdx} +3 -0
  61. package/docs/rules/{init-declarations.md → init-declarations.mdx} +3 -0
  62. package/docs/rules/{key-spacing.md → key-spacing.mdx} +3 -0
  63. package/docs/rules/{keyword-spacing.md → keyword-spacing.mdx} +3 -0
  64. package/docs/rules/{lines-around-comment.md → lines-around-comment.mdx} +3 -0
  65. package/docs/rules/{lines-between-class-members.md → lines-between-class-members.mdx} +3 -0
  66. package/docs/rules/{max-params.md → max-params.mdx} +3 -0
  67. package/docs/rules/{member-delimiter-style.md → member-delimiter-style.mdx} +13 -7
  68. package/docs/rules/{member-ordering.md → member-ordering.mdx} +92 -56
  69. package/docs/rules/{method-signature-style.md → method-signature-style.mdx} +17 -8
  70. package/docs/rules/{naming-convention.md → naming-convention.mdx} +3 -0
  71. package/docs/rules/{no-array-constructor.md → no-array-constructor.mdx} +10 -4
  72. package/docs/rules/{no-array-delete.md → no-array-delete.mdx} +9 -5
  73. package/docs/rules/{no-base-to-string.md → no-base-to-string.mdx} +12 -6
  74. package/docs/rules/{no-confusing-non-null-assertion.md → no-confusing-non-null-assertion.mdx} +11 -5
  75. package/docs/rules/{no-confusing-void-expression.md → no-confusing-void-expression.mdx} +10 -4
  76. package/docs/rules/{no-dupe-class-members.md → no-dupe-class-members.mdx} +4 -1
  77. package/docs/rules/{no-duplicate-enum-values.md → no-duplicate-enum-values.mdx} +10 -4
  78. package/docs/rules/{no-duplicate-imports.md → no-duplicate-imports.mdx} +1 -1
  79. package/docs/rules/{no-duplicate-type-constituents.md → no-duplicate-type-constituents.mdx} +10 -4
  80. package/docs/rules/{no-dynamic-delete.md → no-dynamic-delete.mdx} +10 -4
  81. package/docs/rules/{no-empty-function.md → no-empty-function.mdx} +3 -0
  82. package/docs/rules/{no-empty-interface.md → no-empty-interface.mdx} +9 -5
  83. package/docs/rules/{no-explicit-any.md → no-explicit-any.mdx} +15 -9
  84. package/docs/rules/{no-extra-non-null-assertion.md → no-extra-non-null-assertion.mdx} +11 -5
  85. package/docs/rules/{no-extra-parens.md → no-extra-parens.mdx} +3 -0
  86. package/docs/rules/{no-extra-semi.md → no-extra-semi.mdx} +3 -0
  87. package/docs/rules/{no-extraneous-class.md → no-extraneous-class.mdx} +61 -33
  88. package/docs/rules/{no-floating-promises.md → no-floating-promises.mdx} +12 -6
  89. package/docs/rules/{no-for-in-array.md → no-for-in-array.mdx} +10 -4
  90. package/docs/rules/{no-implied-eval.md → no-implied-eval.mdx} +10 -4
  91. package/docs/rules/{no-import-type-side-effects.md → no-import-type-side-effects.mdx} +12 -6
  92. package/docs/rules/{no-inferrable-types.md → no-inferrable-types.mdx} +9 -5
  93. package/docs/rules/{no-invalid-this.md → no-invalid-this.mdx} +4 -1
  94. package/docs/rules/{no-invalid-void-type.md → no-invalid-void-type.mdx} +10 -4
  95. package/docs/rules/{no-loop-func.md → no-loop-func.mdx} +3 -0
  96. package/docs/rules/{no-loss-of-precision.md → no-loss-of-precision.mdx} +3 -0
  97. package/docs/rules/{no-magic-numbers.md → no-magic-numbers.mdx} +3 -0
  98. package/docs/rules/{no-meaningless-void-operator.md → no-meaningless-void-operator.mdx} +12 -4
  99. package/docs/rules/{no-misused-new.md → no-misused-new.mdx} +10 -4
  100. package/docs/rules/{no-misused-promises.md → no-misused-promises.mdx} +24 -16
  101. package/docs/rules/{no-mixed-enums.md → no-mixed-enums.mdx} +14 -6
  102. package/docs/rules/{no-namespace.md → no-namespace.mdx} +29 -18
  103. package/docs/rules/{no-non-null-asserted-nullish-coalescing.md → no-non-null-asserted-nullish-coalescing.mdx} +10 -4
  104. package/docs/rules/{no-non-null-asserted-optional-chain.md → no-non-null-asserted-optional-chain.mdx} +10 -4
  105. package/docs/rules/{no-non-null-assertion.md → no-non-null-assertion.mdx} +10 -4
  106. package/docs/rules/{no-redeclare.md → no-redeclare.mdx} +4 -1
  107. package/docs/rules/{no-redundant-type-constituents.md → no-redundant-type-constituents.mdx} +10 -4
  108. package/docs/rules/{no-require-imports.md → no-require-imports.mdx} +18 -9
  109. package/docs/rules/{no-restricted-imports.md → no-restricted-imports.mdx} +10 -4
  110. package/docs/rules/{no-shadow.md → no-shadow.mdx} +4 -1
  111. package/docs/rules/{no-this-alias.md → no-this-alias.mdx} +24 -12
  112. package/docs/rules/{no-throw-literal.md → no-throw-literal.mdx} +11 -5
  113. package/docs/rules/{no-type-alias.md → no-type-alias.mdx} +5 -2
  114. package/docs/rules/{no-unnecessary-boolean-literal-compare.md → no-unnecessary-boolean-literal-compare.mdx} +24 -12
  115. package/docs/rules/{no-unnecessary-condition.md → no-unnecessary-condition.mdx} +11 -5
  116. package/docs/rules/{no-unnecessary-qualifier.md → no-unnecessary-qualifier.mdx} +10 -4
  117. package/docs/rules/{no-unnecessary-type-arguments.md → no-unnecessary-type-arguments.mdx} +10 -4
  118. package/docs/rules/{no-unnecessary-type-assertion.md → no-unnecessary-type-assertion.mdx} +10 -4
  119. package/docs/rules/{no-unnecessary-type-constraint.md → no-unnecessary-type-constraint.mdx} +10 -4
  120. package/docs/rules/{no-unsafe-argument.md → no-unsafe-argument.mdx} +14 -10
  121. package/docs/rules/{no-unsafe-assignment.md → no-unsafe-assignment.mdx} +14 -10
  122. package/docs/rules/{no-unsafe-call.md → no-unsafe-call.mdx} +15 -9
  123. package/docs/rules/{no-unsafe-declaration-merging.md → no-unsafe-declaration-merging.mdx} +10 -4
  124. package/docs/rules/{no-unsafe-enum-comparison.md → no-unsafe-enum-comparison.mdx} +9 -5
  125. package/docs/rules/{no-unsafe-member-access.md → no-unsafe-member-access.mdx} +15 -9
  126. package/docs/rules/{no-unsafe-return.md → no-unsafe-return.mdx} +14 -10
  127. package/docs/rules/{no-unsafe-unary-minus.md → no-unsafe-unary-minus.mdx} +11 -5
  128. package/docs/rules/{no-unused-expressions.md → no-unused-expressions.mdx} +3 -0
  129. package/docs/rules/{no-unused-vars.md → no-unused-vars.mdx} +3 -0
  130. package/docs/rules/{no-use-before-define.md → no-use-before-define.mdx} +10 -4
  131. package/docs/rules/{no-useless-constructor.md → no-useless-constructor.mdx} +3 -0
  132. package/docs/rules/{no-useless-empty-export.md → no-useless-empty-export.mdx} +10 -4
  133. package/docs/rules/{no-useless-template-literals.md → no-useless-template-literals.mdx} +10 -6
  134. package/docs/rules/{no-var-requires.md → no-var-requires.mdx} +18 -9
  135. package/docs/rules/{non-nullable-type-assertion-style.md → non-nullable-type-assertion-style.mdx} +10 -4
  136. package/docs/rules/{object-curly-spacing.md → object-curly-spacing.mdx} +3 -0
  137. package/docs/rules/{padding-line-between-statements.md → padding-line-between-statements.mdx} +3 -0
  138. package/docs/rules/{parameter-properties.md → parameter-properties.mdx} +66 -36
  139. package/docs/rules/{prefer-as-const.md → prefer-as-const.mdx} +9 -5
  140. package/docs/rules/{prefer-destructuring.md → prefer-destructuring.mdx} +23 -12
  141. package/docs/rules/{prefer-enum-initializers.md → prefer-enum-initializers.mdx} +10 -4
  142. package/docs/rules/{prefer-find.md → prefer-find.mdx} +10 -4
  143. package/docs/rules/{prefer-for-of.md → prefer-for-of.mdx} +11 -5
  144. package/docs/rules/{prefer-function-type.md → prefer-function-type.mdx} +10 -4
  145. package/docs/rules/{prefer-includes.md → prefer-includes.mdx} +11 -5
  146. package/docs/rules/{prefer-literal-enum-member.md → prefer-literal-enum-member.mdx} +16 -9
  147. package/docs/rules/{prefer-namespace-keyword.md → prefer-namespace-keyword.mdx} +9 -5
  148. package/docs/rules/{prefer-nullish-coalescing.md → prefer-nullish-coalescing.mdx} +3 -0
  149. package/docs/rules/{prefer-optional-chain.md → prefer-optional-chain.mdx} +58 -33
  150. package/docs/rules/{prefer-promise-reject-errors.md → prefer-promise-reject-errors.mdx} +10 -4
  151. package/docs/rules/{prefer-readonly-parameter-types.md → prefer-readonly-parameter-types.mdx} +36 -22
  152. package/docs/rules/{prefer-readonly.md → prefer-readonly.mdx} +17 -8
  153. package/docs/rules/{prefer-reduce-type-parameter.md → prefer-reduce-type-parameter.mdx} +10 -4
  154. package/docs/rules/{prefer-regexp-exec.md → prefer-regexp-exec.mdx} +10 -4
  155. package/docs/rules/{prefer-return-this-type.md → prefer-return-this-type.mdx} +10 -4
  156. package/docs/rules/{prefer-string-starts-ends-with.md → prefer-string-starts-ends-with.mdx} +9 -5
  157. package/docs/rules/{prefer-ts-expect-error.md → prefer-ts-expect-error.mdx} +10 -4
  158. package/docs/rules/{promise-function-async.md → promise-function-async.mdx} +24 -12
  159. package/docs/rules/{quotes.md → quotes.mdx} +3 -0
  160. package/docs/rules/{require-array-sort-compare.md → require-array-sort-compare.mdx} +17 -8
  161. package/docs/rules/{require-await.md → require-await.mdx} +3 -0
  162. package/docs/rules/{restrict-plus-operands.md → restrict-plus-operands.mdx} +54 -30
  163. package/docs/rules/{restrict-template-expressions.md → restrict-template-expressions.mdx} +13 -7
  164. package/docs/rules/{return-await.md → return-await.mdx} +24 -12
  165. package/docs/rules/{semi.md → semi.mdx} +4 -1
  166. package/docs/rules/{sort-type-constituents.md → sort-type-constituents.mdx} +31 -16
  167. package/docs/rules/{space-before-blocks.md → space-before-blocks.mdx} +10 -4
  168. package/docs/rules/{space-before-function-paren.md → space-before-function-paren.mdx} +3 -0
  169. package/docs/rules/{space-infix-ops.md → space-infix-ops.mdx} +3 -0
  170. package/docs/rules/{strict-boolean-expressions.md → strict-boolean-expressions.mdx} +11 -5
  171. package/docs/rules/{switch-exhaustiveness-check.md → switch-exhaustiveness-check.mdx} +19 -14
  172. package/docs/rules/{triple-slash-reference.md → triple-slash-reference.mdx} +30 -17
  173. package/docs/rules/{type-annotation-spacing.md → type-annotation-spacing.mdx} +49 -31
  174. package/docs/rules/{typedef.md → typedef.mdx} +60 -33
  175. package/docs/rules/{unbound-method.md → unbound-method.mdx} +12 -6
  176. package/docs/rules/{unified-signatures.md → unified-signatures.mdx} +18 -9
  177. package/docs/rules/use-unknown-in-catch-callback-variable.mdx +84 -0
  178. package/package.json +7 -7
  179. /package/docs/rules/{no-parameter-properties.md → no-parameter-properties.mdx} +0 -0
@@ -2,6 +2,9 @@
2
2
  description: 'Require `.toString()` to only be called on objects which provide useful information when stringified.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-base-to-string** for documentation.
@@ -15,9 +18,8 @@ This rule reports on stringified values that aren't primitives and don't define
15
18
 
16
19
  ## Examples
17
20
 
18
- <!--tabs-->
19
-
20
- ### ❌ Incorrect
21
+ <Tabs>
22
+ <TabItem value="❌ Incorrect">
21
23
 
22
24
  ```ts
23
25
  // Passing an object or class instance to string concatenation:
@@ -32,7 +34,8 @@ value + '';
32
34
  ({}).toString();
33
35
  ```
34
36
 
35
- ### ✅ Correct
37
+ </TabItem>
38
+ <TabItem value="✅ Correct">
36
39
 
37
40
  ```ts
38
41
  // These types all have useful .toString()s
@@ -56,6 +59,9 @@ const literalWithToString = {
56
59
  `Value: ${literalWithToString}`;
57
60
  ```
58
61
 
62
+ </TabItem>
63
+ </Tabs>
64
+
59
65
  ## Options
60
66
 
61
67
  ### `ignoredTypeNames`
@@ -80,8 +86,8 @@ If you don't mind a risk of `"[object Object]"` or incorrect type coercions in y
80
86
 
81
87
  ## Related To
82
88
 
83
- - [`restrict-plus-operands`](./restrict-plus-operands.md)
84
- - [`restrict-template-expressions`](./restrict-template-expressions.md)
89
+ - [`restrict-plus-operands`](./restrict-plus-operands.mdx)
90
+ - [`restrict-template-expressions`](./restrict-template-expressions.mdx)
85
91
 
86
92
  ## Further Reading
87
93
 
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow non-null assertion in locations that may be confusing.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-confusing-non-null-assertion** for documentation.
@@ -18,9 +21,8 @@ This rule flags confusing `!` assertions and suggests either removing them or wr
18
21
 
19
22
  ## Examples
20
23
 
21
- <!--tabs-->
22
-
23
- ### ❌ Incorrect
24
+ <Tabs>
25
+ <TabItem value="❌ Incorrect">
24
26
 
25
27
  ```ts
26
28
  interface Foo {
@@ -33,9 +35,10 @@ const isEqualsBar = foo.bar! == 'hello';
33
35
  const isEqualsNum = 1 + foo.num! == 2;
34
36
  ```
35
37
 
36
- ### ✅ Correct
38
+ </TabItem>
39
+ <TabItem value="✅ Correct">
37
40
 
38
- <!-- prettier-ignore -->
41
+ {/* prettier-ignore */}
39
42
  ```ts
40
43
  interface Foo {
41
44
  bar?: string;
@@ -47,6 +50,9 @@ const isEqualsBar = foo.bar == 'hello';
47
50
  const isEqualsNum = (1 + foo.num!) == 2;
48
51
  ```
49
52
 
53
+ </TabItem>
54
+ </Tabs>
55
+
50
56
  ## When Not To Use It
51
57
 
52
58
  If you don't care about this confusion, then you will not need this rule.
@@ -2,6 +2,9 @@
2
2
  description: 'Require expressions of type void to appear in statement position.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-confusing-void-expression** for documentation.
@@ -14,9 +17,8 @@ This rule prevents `void` type expressions from being used in misleading locatio
14
17
 
15
18
  ## Examples
16
19
 
17
- <!--tabs-->
18
-
19
- ### ❌ Incorrect
20
+ <Tabs>
21
+ <TabItem value="❌ Incorrect">
20
22
 
21
23
  ```ts
22
24
  // somebody forgot that `alert` doesn't return anything
@@ -36,7 +38,8 @@ function doSomething() {
36
38
  }
37
39
  ```
38
40
 
39
- ### ✅ Correct
41
+ </TabItem>
42
+ <TabItem value="✅ Correct">
40
43
 
41
44
  ```ts
42
45
  // just a regular void function in a statement position
@@ -67,6 +70,9 @@ cond || console.error('false');
67
70
  cond ? console.log('true') : console.error('false');
68
71
  ```
69
72
 
73
+ </TabItem>
74
+ </Tabs>
75
+
70
76
  ## Options
71
77
 
72
78
  ### `ignoreArrowShorthand`
@@ -2,11 +2,14 @@
2
2
  description: 'Disallow duplicate class members.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-dupe-class-members** for documentation.
8
11
 
9
- import TypeScriptOverlap from "@site/src/components/TypeScriptOverlap";
12
+ import TypeScriptOverlap from '@site/src/components/TypeScriptOverlap';
10
13
 
11
14
  <TypeScriptOverlap />
12
15
 
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow duplicate enum member values.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-duplicate-enum-values** for documentation.
@@ -15,9 +18,8 @@ This rule disallows defining an enum with multiple members initialized to the sa
15
18
  > This rule only enforces on enum members initialized with string or number literals.
16
19
  > Members without an initializer or initialized with an expression are not checked by this rule.
17
20
 
18
- <!--tabs-->
19
-
20
- ### ❌ Incorrect
21
+ <Tabs>
22
+ <TabItem value="❌ Incorrect">
21
23
 
22
24
  ```ts
23
25
  enum E {
@@ -33,7 +35,8 @@ enum E {
33
35
  }
34
36
  ```
35
37
 
36
- ### ✅ Correct
38
+ </TabItem>
39
+ <TabItem value="✅ Correct">
37
40
 
38
41
  ```ts
39
42
  enum E {
@@ -49,6 +52,9 @@ enum E {
49
52
  }
50
53
  ```
51
54
 
55
+ </TabItem>
56
+ </Tabs>
57
+
52
58
  ## When Not To Use It
53
59
 
54
60
  It can sometimes be useful to include duplicate enum members for very specific use cases.
@@ -1,6 +1,6 @@
1
1
  :::danger Deprecated
2
2
 
3
- This rule has been deprecated in favour of the [`import/no-duplicates`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-duplicates.md) rule.
3
+ This rule has been deprecated in favour of the [`import/no-duplicates`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-duplicates.mdx) rule.
4
4
 
5
5
  :::
6
6
 
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow duplicate constituents of union or intersection types.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-duplicate-type-constituents** for documentation.
@@ -14,9 +17,8 @@ This rule disallows duplicate union or intersection constituents.
14
17
  We consider types to be duplicate if they evaluate to the same result in the type system.
15
18
  For example, given `type A = string` and `type T = string | A`, this rule would flag that `A` is the same type as `string`.
16
19
 
17
- <!--tabs-->
18
-
19
- ### ❌ Incorrect
20
+ <Tabs>
21
+ <TabItem value="❌ Incorrect">
20
22
 
21
23
  ```ts
22
24
  type T1 = 'A' | 'A';
@@ -32,7 +34,8 @@ type StringB = string;
32
34
  type T5 = StringA | StringB;
33
35
  ```
34
36
 
35
- ### ✅ Correct
37
+ </TabItem>
38
+ <TabItem value="✅ Correct">
36
39
 
37
40
  ```ts
38
41
  type T1 = 'A' | 'B';
@@ -48,6 +51,9 @@ type NumberB = number;
48
51
  type T5 = StringA | NumberB;
49
52
  ```
50
53
 
54
+ </TabItem>
55
+ </Tabs>
56
+
51
57
  ## Options
52
58
 
53
59
  ### `ignoreIntersections`
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow using the `delete` operator on computed key expressions.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-dynamic-delete** for documentation.
@@ -14,9 +17,8 @@ Using `Object`s with added and removed keys can cause occasional edge case bugs,
14
17
 
15
18
  ## Examples
16
19
 
17
- <!--tabs-->
18
-
19
- ### ❌ Incorrect
20
+ <Tabs>
21
+ <TabItem value="❌ Incorrect">
20
22
 
21
23
  ```ts
22
24
  // Can be replaced with the constant equivalents, such as container.aaa
@@ -29,7 +31,8 @@ delete container[name];
29
31
  delete container[name.toUpperCase()];
30
32
  ```
31
33
 
32
- ### ✅ Correct
34
+ </TabItem>
35
+ <TabItem value="✅ Correct">
33
36
 
34
37
  ```ts
35
38
  const container: { [i: string]: number } = {
@@ -44,6 +47,9 @@ delete container[7];
44
47
  delete container['-Infinity'];
45
48
  ```
46
49
 
50
+ </TabItem>
51
+ </Tabs>
52
+
47
53
  ## When Not To Use It
48
54
 
49
55
  When you know your keys are safe to delete, this rule can be unnecessary.
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow empty functions.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-empty-function** for documentation.
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow the declaration of empty interfaces.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-empty-interface** for documentation.
@@ -13,9 +16,8 @@ This rule aims to ensure that only meaningful interfaces are declared in the cod
13
16
 
14
17
  ## Examples
15
18
 
16
- <!--tabs-->
17
-
18
- ### ❌ Incorrect
19
+ <Tabs>
20
+ <TabItem value="❌ Incorrect">
19
21
 
20
22
  ```ts
21
23
  // an empty interface
@@ -28,7 +30,8 @@ interface Bar extends Foo {}
28
30
  interface Baz {}
29
31
  ```
30
32
 
31
- ### ✅ Correct
33
+ </TabItem>
34
+ <TabItem value="✅ Correct">
32
35
 
33
36
  ```ts
34
37
  // an interface with any number of members
@@ -46,7 +49,8 @@ interface Bar {
46
49
  interface Baz extends Foo, Bar {}
47
50
  ```
48
51
 
49
- <!--/tabs-->
52
+ </TabItem>
53
+ </Tabs>
50
54
 
51
55
  ## Options
52
56
 
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow the `any` type.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-explicit-any** for documentation.
@@ -19,9 +22,8 @@ Preferable alternatives to `any` include:
19
22
 
20
23
  ## Examples
21
24
 
22
- <!--tabs-->
23
-
24
- ### ❌ Incorrect
25
+ <Tabs>
26
+ <TabItem value="❌ Incorrect">
25
27
 
26
28
  ```ts
27
29
  const age: any = 'seventeen';
@@ -59,7 +61,8 @@ function greet(param: Array<any>): string {}
59
61
  function greet(param: Array<any>): Array<any> {}
60
62
  ```
61
63
 
62
- ### ✅ Correct
64
+ </TabItem>
65
+ <TabItem value="✅ Correct">
63
66
 
64
67
  ```ts
65
68
  const age: number = 17;
@@ -97,6 +100,9 @@ function greet(param: Array<string>): string {}
97
100
  function greet(param: Array<string>): Array<string> {}
98
101
  ```
99
102
 
103
+ </TabItem>
104
+ </Tabs>
105
+
100
106
  ## Options
101
107
 
102
108
  ### `fixToUnknown`
@@ -154,11 +160,11 @@ You might consider using [ESLint disable comments](https://eslint.org/docs/lates
154
160
 
155
161
  ## Related To
156
162
 
157
- - [`no-unsafe-argument`](./no-unsafe-argument.md)
158
- - [`no-unsafe-assignment`](./no-unsafe-assignment.md)
159
- - [`no-unsafe-call`](./no-unsafe-call.md)
160
- - [`no-unsafe-member-access`](./no-unsafe-member-access.md)
161
- - [`no-unsafe-return`](./no-unsafe-return.md)
163
+ - [`no-unsafe-argument`](./no-unsafe-argument.mdx)
164
+ - [`no-unsafe-assignment`](./no-unsafe-assignment.mdx)
165
+ - [`no-unsafe-call`](./no-unsafe-call.mdx)
166
+ - [`no-unsafe-member-access`](./no-unsafe-member-access.mdx)
167
+ - [`no-unsafe-return`](./no-unsafe-return.mdx)
162
168
 
163
169
  ## Further Reading
164
170
 
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow extra non-null assertions.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-extra-non-null-assertion** for documentation.
@@ -11,9 +14,8 @@ Using the operator any more than once on a single value does nothing.
11
14
 
12
15
  ## Examples
13
16
 
14
- <!--tabs-->
15
-
16
- ### ❌ Incorrect
17
+ <Tabs>
18
+ <TabItem value="❌ Incorrect">
17
19
 
18
20
  ```ts
19
21
  const foo: { bar: number } | null = null;
@@ -32,7 +34,8 @@ function foo(bar?: { n: number }) {
32
34
  }
33
35
  ```
34
36
 
35
- ### ✅ Correct
37
+ </TabItem>
38
+ <TabItem value="✅ Correct">
36
39
 
37
40
  ```ts
38
41
  const foo: { bar: number } | null = null;
@@ -51,4 +54,7 @@ function foo(bar?: { n: number }) {
51
54
  }
52
55
  ```
53
56
 
54
- <!-- Intentionally Omitted: When Not To Use It -->
57
+ </TabItem>
58
+ </Tabs>
59
+
60
+ {/* Intentionally Omitted: When Not To Use It */}
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow unnecessary parentheses.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-extra-parens** for documentation.
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow unnecessary semicolons.'
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
9
  >
7
10
  > See **https://typescript-eslint.io/rules/no-extra-semi** for documentation.