@typescript-eslint/eslint-plugin 7.2.1-alpha.1 → 7.2.1-alpha.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.
Files changed (183) 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/consistent-type-imports.js +1 -0
  14. package/dist/rules/consistent-type-imports.js.map +1 -1
  15. package/dist/rules/index.js +2 -0
  16. package/dist/rules/index.js.map +1 -1
  17. package/dist/rules/no-floating-promises.js +4 -1
  18. package/dist/rules/no-floating-promises.js.map +1 -1
  19. package/dist/rules/no-misused-promises.js +1 -1
  20. package/dist/rules/no-misused-promises.js.map +1 -1
  21. package/dist/rules/no-redundant-type-constituents.js +42 -0
  22. package/dist/rules/no-redundant-type-constituents.js.map +1 -1
  23. package/dist/rules/no-unnecessary-qualifier.js +1 -1
  24. package/dist/rules/no-unnecessary-qualifier.js.map +1 -1
  25. package/dist/rules/no-unsafe-argument.js +1 -25
  26. package/dist/rules/no-unsafe-argument.js.map +1 -1
  27. package/dist/rules/no-unused-expressions.js +6 -2
  28. package/dist/rules/no-unused-expressions.js.map +1 -1
  29. package/dist/rules/restrict-plus-operands.js +12 -1
  30. package/dist/rules/restrict-plus-operands.js.map +1 -1
  31. package/dist/rules/restrict-template-expressions.js +52 -87
  32. package/dist/rules/restrict-template-expressions.js.map +1 -1
  33. package/dist/rules/use-unknown-in-catch-callback-variable.js +283 -0
  34. package/dist/rules/use-unknown-in-catch-callback-variable.js.map +1 -0
  35. package/dist/util/misc.js +10 -1
  36. package/dist/util/misc.js.map +1 -1
  37. package/docs/rules/TEMPLATE.md +10 -4
  38. package/docs/rules/{adjacent-overload-signatures.md → adjacent-overload-signatures.mdx} +11 -5
  39. package/docs/rules/{array-type.md → array-type.mdx} +24 -12
  40. package/docs/rules/{await-thenable.md → await-thenable.mdx} +10 -4
  41. package/docs/rules/{ban-ts-comment.md → ban-ts-comment.mdx} +32 -18
  42. package/docs/rules/{ban-tslint-comment.md → ban-tslint-comment.mdx} +10 -4
  43. package/docs/rules/{ban-types.md → ban-types.mdx} +11 -5
  44. package/docs/rules/{block-spacing.md → block-spacing.mdx} +3 -0
  45. package/docs/rules/{brace-style.md → brace-style.mdx} +3 -0
  46. package/docs/rules/camelcase.md +3 -5
  47. package/docs/rules/{class-literal-property-style.md → class-literal-property-style.mdx} +18 -11
  48. package/docs/rules/{class-methods-use-this.md → class-methods-use-this.mdx} +12 -6
  49. package/docs/rules/{comma-dangle.md → comma-dangle.mdx} +3 -0
  50. package/docs/rules/{comma-spacing.md → comma-spacing.mdx} +3 -0
  51. package/docs/rules/{consistent-generic-constructors.md → consistent-generic-constructors.mdx} +17 -8
  52. package/docs/rules/{consistent-indexed-object-style.md → consistent-indexed-object-style.mdx} +17 -8
  53. package/docs/rules/{consistent-return.md → consistent-return.mdx} +10 -4
  54. package/docs/rules/{consistent-type-assertions.md → consistent-type-assertions.mdx} +15 -10
  55. package/docs/rules/{consistent-type-definitions.md → consistent-type-definitions.mdx} +17 -8
  56. package/docs/rules/{consistent-type-exports.md → consistent-type-exports.mdx} +17 -8
  57. package/docs/rules/{consistent-type-imports.md → consistent-type-imports.mdx} +13 -8
  58. package/docs/rules/{default-param-last.md → default-param-last.mdx} +10 -4
  59. package/docs/rules/{dot-notation.md → dot-notation.mdx} +3 -0
  60. package/docs/rules/{explicit-function-return-type.md → explicit-function-return-type.mdx} +59 -32
  61. package/docs/rules/{explicit-member-accessibility.md → explicit-member-accessibility.mdx} +3 -0
  62. package/docs/rules/{explicit-module-boundary-types.md → explicit-module-boundary-types.mdx} +39 -21
  63. package/docs/rules/{func-call-spacing.md → func-call-spacing.mdx} +3 -0
  64. package/docs/rules/{indent.md → indent.mdx} +3 -0
  65. package/docs/rules/{init-declarations.md → init-declarations.mdx} +3 -0
  66. package/docs/rules/{key-spacing.md → key-spacing.mdx} +3 -0
  67. package/docs/rules/{keyword-spacing.md → keyword-spacing.mdx} +3 -0
  68. package/docs/rules/{lines-around-comment.md → lines-around-comment.mdx} +3 -0
  69. package/docs/rules/{lines-between-class-members.md → lines-between-class-members.mdx} +3 -0
  70. package/docs/rules/{max-params.md → max-params.mdx} +3 -0
  71. package/docs/rules/{member-delimiter-style.md → member-delimiter-style.mdx} +13 -7
  72. package/docs/rules/{member-ordering.md → member-ordering.mdx} +92 -56
  73. package/docs/rules/{method-signature-style.md → method-signature-style.mdx} +17 -8
  74. package/docs/rules/{naming-convention.md → naming-convention.mdx} +3 -0
  75. package/docs/rules/{no-array-constructor.md → no-array-constructor.mdx} +10 -4
  76. package/docs/rules/{no-array-delete.md → no-array-delete.mdx} +9 -5
  77. package/docs/rules/{no-base-to-string.md → no-base-to-string.mdx} +12 -6
  78. package/docs/rules/{no-confusing-non-null-assertion.md → no-confusing-non-null-assertion.mdx} +11 -5
  79. package/docs/rules/{no-confusing-void-expression.md → no-confusing-void-expression.mdx} +10 -4
  80. package/docs/rules/{no-dupe-class-members.md → no-dupe-class-members.mdx} +4 -1
  81. package/docs/rules/{no-duplicate-enum-values.md → no-duplicate-enum-values.mdx} +10 -4
  82. package/docs/rules/{no-duplicate-imports.md → no-duplicate-imports.mdx} +1 -1
  83. package/docs/rules/{no-duplicate-type-constituents.md → no-duplicate-type-constituents.mdx} +10 -4
  84. package/docs/rules/{no-dynamic-delete.md → no-dynamic-delete.mdx} +10 -4
  85. package/docs/rules/{no-empty-function.md → no-empty-function.mdx} +3 -0
  86. package/docs/rules/{no-empty-interface.md → no-empty-interface.mdx} +9 -5
  87. package/docs/rules/{no-explicit-any.md → no-explicit-any.mdx} +15 -9
  88. package/docs/rules/{no-extra-non-null-assertion.md → no-extra-non-null-assertion.mdx} +11 -5
  89. package/docs/rules/{no-extra-parens.md → no-extra-parens.mdx} +3 -0
  90. package/docs/rules/{no-extra-semi.md → no-extra-semi.mdx} +3 -0
  91. package/docs/rules/{no-extraneous-class.md → no-extraneous-class.mdx} +61 -33
  92. package/docs/rules/{no-floating-promises.md → no-floating-promises.mdx} +12 -6
  93. package/docs/rules/{no-for-in-array.md → no-for-in-array.mdx} +10 -4
  94. package/docs/rules/{no-implied-eval.md → no-implied-eval.mdx} +10 -4
  95. package/docs/rules/{no-import-type-side-effects.md → no-import-type-side-effects.mdx} +12 -6
  96. package/docs/rules/{no-inferrable-types.md → no-inferrable-types.mdx} +9 -5
  97. package/docs/rules/{no-invalid-this.md → no-invalid-this.mdx} +4 -1
  98. package/docs/rules/{no-invalid-void-type.md → no-invalid-void-type.mdx} +10 -4
  99. package/docs/rules/{no-loop-func.md → no-loop-func.mdx} +3 -0
  100. package/docs/rules/{no-loss-of-precision.md → no-loss-of-precision.mdx} +3 -0
  101. package/docs/rules/{no-magic-numbers.md → no-magic-numbers.mdx} +3 -0
  102. package/docs/rules/{no-meaningless-void-operator.md → no-meaningless-void-operator.mdx} +12 -4
  103. package/docs/rules/{no-misused-new.md → no-misused-new.mdx} +10 -4
  104. package/docs/rules/{no-misused-promises.md → no-misused-promises.mdx} +24 -16
  105. package/docs/rules/{no-mixed-enums.md → no-mixed-enums.mdx} +14 -6
  106. package/docs/rules/{no-namespace.md → no-namespace.mdx} +29 -18
  107. package/docs/rules/{no-non-null-asserted-nullish-coalescing.md → no-non-null-asserted-nullish-coalescing.mdx} +10 -4
  108. package/docs/rules/{no-non-null-asserted-optional-chain.md → no-non-null-asserted-optional-chain.mdx} +10 -4
  109. package/docs/rules/{no-non-null-assertion.md → no-non-null-assertion.mdx} +10 -4
  110. package/docs/rules/{no-redeclare.md → no-redeclare.mdx} +4 -1
  111. package/docs/rules/{no-redundant-type-constituents.md → no-redundant-type-constituents.mdx} +10 -4
  112. package/docs/rules/{no-require-imports.md → no-require-imports.mdx} +18 -9
  113. package/docs/rules/{no-restricted-imports.md → no-restricted-imports.mdx} +10 -4
  114. package/docs/rules/{no-shadow.md → no-shadow.mdx} +4 -1
  115. package/docs/rules/{no-this-alias.md → no-this-alias.mdx} +24 -12
  116. package/docs/rules/{no-throw-literal.md → no-throw-literal.mdx} +11 -5
  117. package/docs/rules/{no-type-alias.md → no-type-alias.mdx} +5 -2
  118. package/docs/rules/{no-unnecessary-boolean-literal-compare.md → no-unnecessary-boolean-literal-compare.mdx} +24 -12
  119. package/docs/rules/{no-unnecessary-condition.md → no-unnecessary-condition.mdx} +11 -5
  120. package/docs/rules/{no-unnecessary-qualifier.md → no-unnecessary-qualifier.mdx} +10 -4
  121. package/docs/rules/{no-unnecessary-type-arguments.md → no-unnecessary-type-arguments.mdx} +10 -4
  122. package/docs/rules/{no-unnecessary-type-assertion.md → no-unnecessary-type-assertion.mdx} +10 -4
  123. package/docs/rules/{no-unnecessary-type-constraint.md → no-unnecessary-type-constraint.mdx} +10 -4
  124. package/docs/rules/{no-unsafe-argument.md → no-unsafe-argument.mdx} +14 -10
  125. package/docs/rules/{no-unsafe-assignment.md → no-unsafe-assignment.mdx} +14 -10
  126. package/docs/rules/{no-unsafe-call.md → no-unsafe-call.mdx} +15 -9
  127. package/docs/rules/{no-unsafe-declaration-merging.md → no-unsafe-declaration-merging.mdx} +10 -4
  128. package/docs/rules/{no-unsafe-enum-comparison.md → no-unsafe-enum-comparison.mdx} +9 -5
  129. package/docs/rules/{no-unsafe-member-access.md → no-unsafe-member-access.mdx} +15 -9
  130. package/docs/rules/{no-unsafe-return.md → no-unsafe-return.mdx} +14 -10
  131. package/docs/rules/{no-unsafe-unary-minus.md → no-unsafe-unary-minus.mdx} +11 -5
  132. package/docs/rules/{no-unused-expressions.md → no-unused-expressions.mdx} +3 -0
  133. package/docs/rules/{no-unused-vars.md → no-unused-vars.mdx} +3 -0
  134. package/docs/rules/{no-use-before-define.md → no-use-before-define.mdx} +10 -4
  135. package/docs/rules/{no-useless-constructor.md → no-useless-constructor.mdx} +3 -0
  136. package/docs/rules/{no-useless-empty-export.md → no-useless-empty-export.mdx} +10 -4
  137. package/docs/rules/{no-useless-template-literals.md → no-useless-template-literals.mdx} +10 -6
  138. package/docs/rules/{no-var-requires.md → no-var-requires.mdx} +18 -9
  139. package/docs/rules/{non-nullable-type-assertion-style.md → non-nullable-type-assertion-style.mdx} +10 -4
  140. package/docs/rules/{object-curly-spacing.md → object-curly-spacing.mdx} +3 -0
  141. package/docs/rules/{padding-line-between-statements.md → padding-line-between-statements.mdx} +3 -0
  142. package/docs/rules/{parameter-properties.md → parameter-properties.mdx} +66 -36
  143. package/docs/rules/{prefer-as-const.md → prefer-as-const.mdx} +9 -5
  144. package/docs/rules/{prefer-destructuring.md → prefer-destructuring.mdx} +23 -12
  145. package/docs/rules/{prefer-enum-initializers.md → prefer-enum-initializers.mdx} +10 -4
  146. package/docs/rules/{prefer-find.md → prefer-find.mdx} +10 -4
  147. package/docs/rules/{prefer-for-of.md → prefer-for-of.mdx} +11 -5
  148. package/docs/rules/{prefer-function-type.md → prefer-function-type.mdx} +10 -4
  149. package/docs/rules/{prefer-includes.md → prefer-includes.mdx} +11 -5
  150. package/docs/rules/{prefer-literal-enum-member.md → prefer-literal-enum-member.mdx} +16 -9
  151. package/docs/rules/{prefer-namespace-keyword.md → prefer-namespace-keyword.mdx} +9 -5
  152. package/docs/rules/{prefer-nullish-coalescing.md → prefer-nullish-coalescing.mdx} +3 -0
  153. package/docs/rules/{prefer-optional-chain.md → prefer-optional-chain.mdx} +58 -33
  154. package/docs/rules/{prefer-promise-reject-errors.md → prefer-promise-reject-errors.mdx} +10 -4
  155. package/docs/rules/{prefer-readonly-parameter-types.md → prefer-readonly-parameter-types.mdx} +36 -22
  156. package/docs/rules/{prefer-readonly.md → prefer-readonly.mdx} +17 -8
  157. package/docs/rules/{prefer-reduce-type-parameter.md → prefer-reduce-type-parameter.mdx} +10 -4
  158. package/docs/rules/{prefer-regexp-exec.md → prefer-regexp-exec.mdx} +10 -4
  159. package/docs/rules/{prefer-return-this-type.md → prefer-return-this-type.mdx} +10 -4
  160. package/docs/rules/{prefer-string-starts-ends-with.md → prefer-string-starts-ends-with.mdx} +9 -5
  161. package/docs/rules/{prefer-ts-expect-error.md → prefer-ts-expect-error.mdx} +10 -4
  162. package/docs/rules/{promise-function-async.md → promise-function-async.mdx} +24 -12
  163. package/docs/rules/{quotes.md → quotes.mdx} +3 -0
  164. package/docs/rules/{require-array-sort-compare.md → require-array-sort-compare.mdx} +17 -8
  165. package/docs/rules/{require-await.md → require-await.mdx} +3 -0
  166. package/docs/rules/{restrict-plus-operands.md → restrict-plus-operands.mdx} +54 -30
  167. package/docs/rules/{restrict-template-expressions.md → restrict-template-expressions.mdx} +24 -9
  168. package/docs/rules/{return-await.md → return-await.mdx} +24 -12
  169. package/docs/rules/{semi.md → semi.mdx} +4 -1
  170. package/docs/rules/{sort-type-constituents.md → sort-type-constituents.mdx} +31 -16
  171. package/docs/rules/{space-before-blocks.md → space-before-blocks.mdx} +10 -4
  172. package/docs/rules/{space-before-function-paren.md → space-before-function-paren.mdx} +3 -0
  173. package/docs/rules/{space-infix-ops.md → space-infix-ops.mdx} +3 -0
  174. package/docs/rules/{strict-boolean-expressions.md → strict-boolean-expressions.mdx} +11 -5
  175. package/docs/rules/{switch-exhaustiveness-check.md → switch-exhaustiveness-check.mdx} +19 -14
  176. package/docs/rules/{triple-slash-reference.md → triple-slash-reference.mdx} +30 -17
  177. package/docs/rules/{type-annotation-spacing.md → type-annotation-spacing.mdx} +49 -31
  178. package/docs/rules/{typedef.md → typedef.mdx} +60 -33
  179. package/docs/rules/{unbound-method.md → unbound-method.mdx} +12 -6
  180. package/docs/rules/{unified-signatures.md → unified-signatures.mdx} +18 -9
  181. package/docs/rules/use-unknown-in-catch-callback-variable.mdx +84 -0
  182. package/package.json +8 -8
  183. /package/docs/rules/{no-parameter-properties.md → no-parameter-properties.mdx} +0 -0
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow comparing an enum value with a non-enum value.'
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-unsafe-enum-comparison** for documentation.
@@ -26,9 +29,8 @@ The above code snippet should instead be written as `vegetable === Vegetable.Asp
26
29
 
27
30
  ## Examples
28
31
 
29
- <!--tabs-->
30
-
31
- ### ❌ Incorrect
32
+ <Tabs>
33
+ <TabItem value="❌ Incorrect">
32
34
 
33
35
  ```ts
34
36
  enum Fruit {
@@ -50,7 +52,8 @@ declare let vegetable: Vegetable;
50
52
  vegetable === 'asparagus';
51
53
  ```
52
54
 
53
- ### ✅ Correct
55
+ </TabItem>
56
+ <TabItem value="✅ Correct">
54
57
 
55
58
  ```ts
56
59
  enum Fruit {
@@ -72,7 +75,8 @@ declare let vegetable: Vegetable;
72
75
  vegetable === Vegetable.Asparagus;
73
76
  ```
74
77
 
75
- <!--/tabs-->
78
+ </TabItem>
79
+ </Tabs>
76
80
 
77
81
  ## When Not To Use It
78
82
 
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow member access on a value with type `any`.'
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-unsafe-member-access** for documentation.
@@ -16,9 +19,8 @@ This rule disallows member access on any variable that is typed as `any`.
16
19
 
17
20
  ## Examples
18
21
 
19
- <!--tabs-->
20
-
21
- ### ❌ Incorrect
22
+ <Tabs>
23
+ <TabItem value="❌ Incorrect">
22
24
 
23
25
  ```ts
24
26
  declare const anyVar: any;
@@ -41,7 +43,8 @@ arr[anyVar];
41
43
  nestedAny[anyVar];
42
44
  ```
43
45
 
44
- ### ✅ Correct
46
+ </TabItem>
47
+ <TabItem value="✅ Correct">
45
48
 
46
49
  ```ts
47
50
  declare const properlyTyped: { prop: { a: string } };
@@ -59,6 +62,9 @@ arr[idx];
59
62
  arr[idx++];
60
63
  ```
61
64
 
65
+ </TabItem>
66
+ </Tabs>
67
+
62
68
  ## When Not To Use It
63
69
 
64
70
  If your codebase has many existing `any`s or areas of unsafe code, it may be difficult to enable this rule.
@@ -67,8 +73,8 @@ You might consider using [ESLint disable comments](https://eslint.org/docs/lates
67
73
 
68
74
  ## Related To
69
75
 
70
- - [`no-explicit-any`](./no-explicit-any.md)
71
- - [`no-unsafe-argument`](./no-unsafe-argument.md)
72
- - [`no-unsafe-assignment`](./no-unsafe-assignment.md)
73
- - [`no-unsafe-call`](./no-unsafe-call.md)
74
- - [`no-unsafe-return`](./no-unsafe-return.md)
76
+ - [`no-explicit-any`](./no-explicit-any.mdx)
77
+ - [`no-unsafe-argument`](./no-unsafe-argument.mdx)
78
+ - [`no-unsafe-assignment`](./no-unsafe-assignment.mdx)
79
+ - [`no-unsafe-call`](./no-unsafe-call.mdx)
80
+ - [`no-unsafe-return`](./no-unsafe-return.mdx)
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow returning a value with type `any` from a function.'
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-unsafe-return** for documentation.
@@ -19,9 +22,8 @@ For example, it will error if you return `Set<any>` from a function declared as
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
  function foo1() {
@@ -62,7 +64,8 @@ type TAssign = () => Set<string>;
62
64
  const assignability2: TAssign = () => new Set<any>([true]);
63
65
  ```
64
66
 
65
- ### ✅ Correct
67
+ </TabItem>
68
+ <TabItem value="✅ Correct">
66
69
 
67
70
  ```ts
68
71
  function foo1() {
@@ -82,7 +85,8 @@ type TAssign = () => Set<string>;
82
85
  const assignability2: TAssign = () => new Set(['foo']);
83
86
  ```
84
87
 
85
- <!--/tabs-->
88
+ </TabItem>
89
+ </Tabs>
86
90
 
87
91
  There are cases where the rule allows to return `any` to `unknown`.
88
92
 
@@ -106,8 +110,8 @@ You might consider using [ESLint disable comments](https://eslint.org/docs/lates
106
110
 
107
111
  ## Related To
108
112
 
109
- - [`no-explicit-any`](./no-explicit-any.md)
110
- - [`no-unsafe-argument`](./no-unsafe-argument.md)
111
- - [`no-unsafe-assignment`](./no-unsafe-assignment.md)
112
- - [`no-unsafe-call`](./no-unsafe-call.md)
113
- - [`no-unsafe-member-access`](./no-unsafe-member-access.md)
113
+ - [`no-explicit-any`](./no-explicit-any.mdx)
114
+ - [`no-unsafe-argument`](./no-unsafe-argument.mdx)
115
+ - [`no-unsafe-assignment`](./no-unsafe-assignment.mdx)
116
+ - [`no-unsafe-call`](./no-unsafe-call.mdx)
117
+ - [`no-unsafe-member-access`](./no-unsafe-member-access.mdx)
@@ -2,6 +2,9 @@
2
2
  description: 'Require unary negation to take a number.'
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-unsafe-unary-minus** for documentation.
@@ -17,9 +20,8 @@ This rule restricts the unary `-` operator to `number | bigint`.
17
20
 
18
21
  ## Examples
19
22
 
20
- <!-- tabs -->
21
-
22
- ### ❌ Incorrect
23
+ <Tabs>
24
+ <TabItem value="❌ Incorrect">
23
25
 
24
26
  ```ts
25
27
  declare const a: string;
@@ -29,7 +31,8 @@ declare const b: {};
29
31
  -b;
30
32
  ```
31
33
 
32
- ### ✅ Correct
34
+ </TabItem>
35
+ <TabItem value="✅ Correct">
33
36
 
34
37
  ```ts
35
38
  -42;
@@ -51,4 +54,7 @@ declare const e: 1 | 2;
51
54
  -e;
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 unused 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-unused-expressions** for documentation.
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow unused variables.'
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-unused-vars** for documentation.
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow the use of variables before they are defined.'
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-use-before-define** for documentation.
@@ -35,9 +38,8 @@ If this is `false`, this rule will ignore references to enums, when the referenc
35
38
 
36
39
  Examples of code for the `{ "enums": true }` option:
37
40
 
38
- <!--tabs-->
39
-
40
- #### ❌ Incorrect
41
+ <Tabs>
42
+ <TabItem value="❌ Incorrect">
41
43
 
42
44
  ```ts option='{ "enums": true }'
43
45
  const x = Foo.FOO;
@@ -47,7 +49,8 @@ enum Foo {
47
49
  }
48
50
  ```
49
51
 
50
- #### ✅ Correct
52
+ </TabItem>
53
+ <TabItem value="✅ Correct">
51
54
 
52
55
  ```ts option='{ "enums": false }'
53
56
  function foo() {
@@ -59,6 +62,9 @@ enum Foo {
59
62
  }
60
63
  ```
61
64
 
65
+ </TabItem>
66
+ </Tabs>
67
+
62
68
  ### `typedefs`
63
69
 
64
70
  If this is `true`, this rule warns every reference to a type before the type declaration.
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow unnecessary constructors.'
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-useless-constructor** for documentation.
@@ -2,6 +2,9 @@
2
2
  description: "Disallow empty exports that don't change anything in a module file."
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-useless-empty-export** for documentation.
@@ -18,9 +21,8 @@ This rule reports an `export {}` that doesn't do anything in a file already usin
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
  export const value = 'Hello, world!';
@@ -32,7 +34,8 @@ import 'some-other-module';
32
34
  export {};
33
35
  ```
34
36
 
35
- ### ✅ Correct
37
+ </TabItem>
38
+ <TabItem value="✅ Correct">
36
39
 
37
40
  ```ts
38
41
  export const value = 'Hello, world!';
@@ -42,6 +45,9 @@ export const value = 'Hello, world!';
42
45
  import 'some-other-module';
43
46
  ```
44
47
 
48
+ </TabItem>
49
+ </Tabs>
50
+
45
51
  ## When Not To Use It
46
52
 
47
53
  If you don't mind an empty `export {}` at the bottom of files, you likely don't need this rule.
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow unnecessary template literals.'
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-useless-template-literals** for documentation.
@@ -10,9 +13,8 @@ This rule reports template literals that can be simplified to a normal string li
10
13
 
11
14
  ## Examples
12
15
 
13
- <!--tabs-->
14
-
15
- ### ❌ Incorrect
16
+ <Tabs>
17
+ <TabItem value="❌ Incorrect">
16
18
 
17
19
  ```ts
18
20
  const ab1 = `${'a'}${'b'}`;
@@ -29,7 +31,8 @@ declare const intersectionWithString: string & { _brand: 'test-brand' };
29
31
  const wrappedIntersection = `${intersectionWithString}`;
30
32
  ```
31
33
 
32
- ### ✅ Correct
34
+ </TabItem>
35
+ <TabItem value="✅ Correct">
33
36
 
34
37
  ```ts
35
38
  const ab1 = 'ab';
@@ -46,7 +49,8 @@ declare const intersectionWithString: string & { _brand: 'test-brand' };
46
49
  const wrappedIntersection = intersectionWithString;
47
50
  ```
48
51
 
49
- <!--/tabs-->
52
+ </TabItem>
53
+ </Tabs>
50
54
 
51
55
  ## When Not To Use It
52
56
 
@@ -54,4 +58,4 @@ When you want to allow string expressions inside template literals.
54
58
 
55
59
  ## Related To
56
60
 
57
- - [`restrict-template-expressions`](./restrict-template-expressions.md)
61
+ - [`restrict-template-expressions`](./restrict-template-expressions.mdx)
@@ -2,6 +2,9 @@
2
2
  description: 'Disallow `require` statements except in import statements.'
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-var-requires** for documentation.
@@ -10,9 +13,8 @@ In other words, the use of forms such as `var foo = require("foo")` are banned.
10
13
 
11
14
  ## Examples
12
15
 
13
- <!--tabs-->
14
-
15
- ### ❌ Incorrect
16
+ <Tabs>
17
+ <TabItem value="❌ Incorrect">
16
18
 
17
19
  ```ts
18
20
  var foo = require('foo');
@@ -20,7 +22,8 @@ const foo = require('foo');
20
22
  let foo = require('foo');
21
23
  ```
22
24
 
23
- ### ✅ Correct
25
+ </TabItem>
26
+ <TabItem value="✅ Correct">
24
27
 
25
28
  ```ts
26
29
  import foo = require('foo');
@@ -28,6 +31,9 @@ require('foo');
28
31
  import foo from 'foo';
29
32
  ```
30
33
 
34
+ </TabItem>
35
+ </Tabs>
36
+
31
37
  ## Options
32
38
 
33
39
  ### `allow`
@@ -36,20 +42,23 @@ A array of strings. These strings will be compiled into regular expressions with
36
42
 
37
43
  With `{allow: ['/package\\.json$']}`:
38
44
 
39
- <!--tabs-->
40
-
41
- ### ❌ Incorrect
45
+ <Tabs>
46
+ <TabItem value="❌ Incorrect">
42
47
 
43
48
  ```ts
44
49
  const foo = require('../data.json');
45
50
  ```
46
51
 
47
- ### ✅ Correct
52
+ </TabItem>
53
+ <TabItem value="✅ Correct">
48
54
 
49
55
  ```ts
50
56
  const foo = require('../package.json');
51
57
  ```
52
58
 
59
+ </TabItem>
60
+ </Tabs>
61
+
53
62
  ## When Not To Use It
54
63
 
55
64
  If your project frequently uses older CommonJS `require`s, then this rule might not be applicable to you.
@@ -57,4 +66,4 @@ If only a subset of your project uses `require`s then you might consider using [
57
66
 
58
67
  ## Related To
59
68
 
60
- - [`no-require-imports`](./no-require-imports.md)
69
+ - [`no-require-imports`](./no-require-imports.mdx)
@@ -2,6 +2,9 @@
2
2
  description: 'Enforce non-null assertions over explicit type casts.'
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/non-nullable-type-assertion-style** for documentation.
@@ -16,9 +19,8 @@ This rule reports when an `as` cast is doing the same job as a `!` would, and su
16
19
 
17
20
  ## Examples
18
21
 
19
- <!--tabs-->
20
-
21
- ### ❌ Incorrect
22
+ <Tabs>
23
+ <TabItem value="❌ Incorrect">
22
24
 
23
25
  ```ts
24
26
  const maybe = Math.random() > 0.5 ? '' : undefined;
@@ -27,7 +29,8 @@ const definitely = maybe as string;
27
29
  const alsoDefinitely = <string>maybe;
28
30
  ```
29
31
 
30
- ### ✅ Correct
32
+ </TabItem>
33
+ <TabItem value="✅ Correct">
31
34
 
32
35
  ```ts
33
36
  const maybe = Math.random() > 0.5 ? '' : undefined;
@@ -36,6 +39,9 @@ const definitely = maybe!;
36
39
  const alsoDefinitely = maybe!;
37
40
  ```
38
41
 
42
+ </TabItem>
43
+ </Tabs>
44
+
39
45
  ## When Not To Use It
40
46
 
41
47
  If you don't mind having unnecessarily verbose type assertions, you can avoid this rule.
@@ -2,6 +2,9 @@
2
2
  description: 'Enforce consistent spacing inside braces.'
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/object-curly-spacing** for documentation.
@@ -2,6 +2,9 @@
2
2
  description: 'Require or disallow padding lines between statements.'
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/padding-line-between-statements** for documentation.