@typescript-eslint/eslint-plugin 8.67.0 → 8.68.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 (244) hide show
  1. package/CHANGELOG.md +5906 -0
  2. package/dist/configs/eslint-recommended-raw.js +1 -0
  3. package/dist/configs/eslintrc/all.js +1 -0
  4. package/dist/configs/eslintrc/base.js +1 -0
  5. package/dist/configs/eslintrc/disable-type-checked.js +1 -0
  6. package/dist/configs/eslintrc/eslint-recommended.js +1 -0
  7. package/dist/configs/eslintrc/recommended-type-checked-only.js +1 -0
  8. package/dist/configs/eslintrc/recommended-type-checked.js +1 -0
  9. package/dist/configs/eslintrc/recommended.js +1 -0
  10. package/dist/configs/eslintrc/strict-type-checked-only.js +1 -0
  11. package/dist/configs/eslintrc/strict-type-checked.js +1 -0
  12. package/dist/configs/eslintrc/strict.js +1 -0
  13. package/dist/configs/eslintrc/stylistic-type-checked-only.js +1 -0
  14. package/dist/configs/eslintrc/stylistic-type-checked.js +1 -0
  15. package/dist/configs/eslintrc/stylistic.js +1 -0
  16. package/dist/configs/flat/all.js +1 -0
  17. package/dist/configs/flat/base.js +1 -0
  18. package/dist/configs/flat/disable-type-checked.js +1 -0
  19. package/dist/configs/flat/eslint-recommended.js +1 -0
  20. package/dist/configs/flat/recommended-type-checked-only.js +1 -0
  21. package/dist/configs/flat/recommended-type-checked.js +1 -0
  22. package/dist/configs/flat/recommended.js +1 -0
  23. package/dist/configs/flat/strict-type-checked-only.js +1 -0
  24. package/dist/configs/flat/strict-type-checked.js +1 -0
  25. package/dist/configs/flat/strict.js +1 -0
  26. package/dist/configs/flat/stylistic-type-checked-only.js +1 -0
  27. package/dist/configs/flat/stylistic-type-checked.js +1 -0
  28. package/dist/configs/flat/stylistic.js +1 -0
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +1 -0
  31. package/dist/raw-plugin.d.ts +1 -1
  32. package/dist/raw-plugin.js +1 -0
  33. package/dist/rules/adjacent-overload-signatures.js +1 -0
  34. package/dist/rules/array-type.js +1 -0
  35. package/dist/rules/await-thenable.js +1 -0
  36. package/dist/rules/ban-ts-comment.js +1 -0
  37. package/dist/rules/ban-tslint-comment.js +1 -0
  38. package/dist/rules/class-literal-property-style.js +1 -0
  39. package/dist/rules/class-methods-use-this.js +1 -0
  40. package/dist/rules/consistent-generic-constructors.js +1 -0
  41. package/dist/rules/consistent-indexed-object-style.js +1 -0
  42. package/dist/rules/consistent-return.js +1 -0
  43. package/dist/rules/consistent-type-assertions.js +1 -0
  44. package/dist/rules/consistent-type-definitions.js +1 -0
  45. package/dist/rules/consistent-type-exports.js +1 -0
  46. package/dist/rules/consistent-type-imports.js +1 -0
  47. package/dist/rules/default-param-last.js +1 -0
  48. package/dist/rules/dot-notation.js +1 -0
  49. package/dist/rules/enum-utils/shared.d.ts +5 -0
  50. package/dist/rules/enum-utils/shared.js +68 -0
  51. package/dist/rules/explicit-function-return-type.js +1 -0
  52. package/dist/rules/explicit-member-accessibility.js +1 -0
  53. package/dist/rules/explicit-module-boundary-types.js +1 -0
  54. package/dist/rules/index.d.ts +1 -1
  55. package/dist/rules/index.js +1 -0
  56. package/dist/rules/init-declarations.js +1 -0
  57. package/dist/rules/max-params.js +1 -0
  58. package/dist/rules/member-ordering.js +1 -0
  59. package/dist/rules/method-signature-style.js +1 -0
  60. package/dist/rules/naming-convention-utils/enums.js +1 -0
  61. package/dist/rules/naming-convention-utils/format.js +1 -0
  62. package/dist/rules/naming-convention-utils/index.js +1 -0
  63. package/dist/rules/naming-convention-utils/parse-options.js +1 -0
  64. package/dist/rules/naming-convention-utils/schema.js +1 -0
  65. package/dist/rules/naming-convention-utils/shared.js +1 -0
  66. package/dist/rules/naming-convention-utils/types.js +1 -0
  67. package/dist/rules/naming-convention-utils/validator.js +1 -0
  68. package/dist/rules/naming-convention.js +1 -0
  69. package/dist/rules/no-array-constructor.js +1 -0
  70. package/dist/rules/no-array-delete.js +1 -0
  71. package/dist/rules/no-base-to-string.js +1 -0
  72. package/dist/rules/no-confusing-non-null-assertion.js +1 -0
  73. package/dist/rules/no-confusing-void-expression.js +8 -9
  74. package/dist/rules/no-deprecated.js +1 -0
  75. package/dist/rules/no-dupe-class-members.js +1 -0
  76. package/dist/rules/no-duplicate-enum-values.js +1 -0
  77. package/dist/rules/no-duplicate-type-constituents.js +1 -0
  78. package/dist/rules/no-dynamic-delete.js +1 -0
  79. package/dist/rules/no-empty-function.js +1 -0
  80. package/dist/rules/no-empty-interface.js +1 -0
  81. package/dist/rules/no-empty-object-type.js +9 -4
  82. package/dist/rules/no-explicit-any.js +1 -0
  83. package/dist/rules/no-extra-non-null-assertion.js +1 -0
  84. package/dist/rules/no-extraneous-class.js +1 -0
  85. package/dist/rules/no-floating-promises.js +64 -55
  86. package/dist/rules/no-for-in-array.js +1 -0
  87. package/dist/rules/no-implied-eval.js +1 -0
  88. package/dist/rules/no-import-type-side-effects.js +1 -0
  89. package/dist/rules/no-inferrable-types.js +1 -0
  90. package/dist/rules/no-invalid-this.js +1 -0
  91. package/dist/rules/no-invalid-void-type.js +1 -0
  92. package/dist/rules/no-loop-func.js +1 -0
  93. package/dist/rules/no-loss-of-precision.js +1 -0
  94. package/dist/rules/no-magic-numbers.js +1 -0
  95. package/dist/rules/no-meaningless-void-operator.js +1 -0
  96. package/dist/rules/no-misused-new.js +1 -0
  97. package/dist/rules/no-misused-promises.js +1 -0
  98. package/dist/rules/no-misused-spread.js +1 -0
  99. package/dist/rules/no-mixed-enums.js +1 -0
  100. package/dist/rules/no-namespace.js +1 -0
  101. package/dist/rules/no-non-null-asserted-nullish-coalescing.js +1 -0
  102. package/dist/rules/no-non-null-asserted-optional-chain.js +1 -0
  103. package/dist/rules/no-non-null-assertion.js +1 -0
  104. package/dist/rules/no-redeclare.js +1 -0
  105. package/dist/rules/no-redundant-type-constituents.js +1 -0
  106. package/dist/rules/no-require-imports.js +1 -0
  107. package/dist/rules/no-restricted-imports.js +1 -0
  108. package/dist/rules/no-restricted-types.js +1 -0
  109. package/dist/rules/no-shadow.js +1 -0
  110. package/dist/rules/no-this-alias.js +1 -0
  111. package/dist/rules/no-type-alias.js +1 -0
  112. package/dist/rules/no-unnecessary-boolean-literal-compare.js +1 -0
  113. package/dist/rules/no-unnecessary-condition.js +1 -0
  114. package/dist/rules/no-unnecessary-parameter-property-assignment.js +1 -0
  115. package/dist/rules/no-unnecessary-qualifier.js +1 -0
  116. package/dist/rules/no-unnecessary-template-expression.js +3 -14
  117. package/dist/rules/no-unnecessary-type-arguments.js +1 -0
  118. package/dist/rules/no-unnecessary-type-assertion.d.ts +1 -2
  119. package/dist/rules/no-unnecessary-type-assertion.js +14 -39
  120. package/dist/rules/no-unnecessary-type-constraint.js +1 -0
  121. package/dist/rules/no-unnecessary-type-conversion.js +1 -0
  122. package/dist/rules/no-unnecessary-type-parameters.js +1 -0
  123. package/dist/rules/no-unsafe-argument.js +2 -91
  124. package/dist/rules/no-unsafe-assignment.js +1 -0
  125. package/dist/rules/no-unsafe-call.js +1 -0
  126. package/dist/rules/no-unsafe-declaration-merging.js +1 -0
  127. package/dist/rules/no-unsafe-enum-comparison.js +3 -113
  128. package/dist/rules/no-unsafe-function-type.js +1 -0
  129. package/dist/rules/no-unsafe-member-access.js +1 -0
  130. package/dist/rules/no-unsafe-return.js +1 -0
  131. package/dist/rules/no-unsafe-type-assertion.js +1 -0
  132. package/dist/rules/no-unsafe-unary-minus.js +1 -0
  133. package/dist/rules/no-unused-expressions.js +1 -0
  134. package/dist/rules/no-unused-private-class-members.js +1 -0
  135. package/dist/rules/no-unused-vars.js +1 -0
  136. package/dist/rules/no-use-before-define.js +1 -0
  137. package/dist/rules/no-useless-constructor.js +1 -0
  138. package/dist/rules/no-useless-default-assignment.js +1 -0
  139. package/dist/rules/no-useless-empty-export.js +1 -0
  140. package/dist/rules/no-var-requires.js +1 -0
  141. package/dist/rules/no-wrapper-object-types.js +1 -0
  142. package/dist/rules/non-nullable-type-assertion-style.js +1 -0
  143. package/dist/rules/only-throw-error.js +1 -0
  144. package/dist/rules/parameter-properties.js +1 -0
  145. package/dist/rules/prefer-as-const.js +1 -0
  146. package/dist/rules/prefer-destructuring.js +1 -0
  147. package/dist/rules/prefer-enum-initializers.js +1 -0
  148. package/dist/rules/prefer-find.js +1 -0
  149. package/dist/rules/prefer-for-of.js +1 -0
  150. package/dist/rules/prefer-function-type.js +1 -0
  151. package/dist/rules/prefer-includes.js +1 -0
  152. package/dist/rules/prefer-literal-enum-member.js +1 -0
  153. package/dist/rules/prefer-namespace-keyword.js +1 -0
  154. package/dist/rules/prefer-nullish-coalescing.js +1 -0
  155. package/dist/rules/prefer-optional-chain-utils/PreferOptionalChainOptions.js +1 -0
  156. package/dist/rules/prefer-optional-chain-utils/analyzeChain.js +1 -0
  157. package/dist/rules/prefer-optional-chain-utils/checkNullishAndReport.js +1 -0
  158. package/dist/rules/prefer-optional-chain-utils/compareNodes.js +1 -0
  159. package/dist/rules/prefer-optional-chain-utils/gatherLogicalOperands.js +1 -0
  160. package/dist/rules/prefer-optional-chain.js +1 -0
  161. package/dist/rules/prefer-promise-reject-errors.js +1 -0
  162. package/dist/rules/prefer-readonly-parameter-types.js +1 -0
  163. package/dist/rules/prefer-readonly.js +1 -0
  164. package/dist/rules/prefer-reduce-type-parameter.js +1 -0
  165. package/dist/rules/prefer-regexp-exec.js +1 -0
  166. package/dist/rules/prefer-return-this-type.js +1 -0
  167. package/dist/rules/prefer-string-starts-ends-with.js +1 -0
  168. package/dist/rules/prefer-ts-expect-error.js +1 -0
  169. package/dist/rules/promise-function-async.js +1 -0
  170. package/dist/rules/related-getter-setter-pairs.js +1 -0
  171. package/dist/rules/require-array-sort-compare.js +1 -0
  172. package/dist/rules/require-await.js +1 -0
  173. package/dist/rules/restrict-plus-operands.js +1 -0
  174. package/dist/rules/restrict-template-expressions.js +1 -0
  175. package/dist/rules/return-await.js +13 -1
  176. package/dist/rules/sort-type-constituents.js +1 -0
  177. package/dist/rules/strict-boolean-expressions.js +1 -0
  178. package/dist/rules/strict-void-return.d.ts +3 -2
  179. package/dist/rules/strict-void-return.js +97 -5
  180. package/dist/rules/switch-exhaustiveness-check.js +1 -0
  181. package/dist/rules/triple-slash-reference.js +1 -0
  182. package/dist/rules/typedef.js +1 -0
  183. package/dist/rules/unbound-method.js +1 -0
  184. package/dist/rules/unified-signatures.d.ts +1 -1
  185. package/dist/rules/unified-signatures.js +73 -32
  186. package/dist/rules/use-unknown-in-catch-callback-variable.js +1 -0
  187. package/dist/util/FunctionSignature.d.ts +15 -0
  188. package/dist/util/FunctionSignature.js +123 -0
  189. package/dist/util/assertionFunctionUtils.js +1 -0
  190. package/dist/util/astUtils.js +1 -0
  191. package/dist/util/baseTypeUtils.d.ts +2 -0
  192. package/dist/util/baseTypeUtils.js +17 -0
  193. package/dist/util/class-scope-analyzer/classScopeAnalyzer.js +1 -0
  194. package/dist/util/class-scope-analyzer/extractComputedName.js +1 -0
  195. package/dist/util/class-scope-analyzer/types.js +1 -0
  196. package/dist/util/collectUnusedVariables.js +1 -0
  197. package/dist/util/createRule.js +1 -0
  198. package/dist/util/escapeRegExp.js +1 -0
  199. package/dist/util/explicitReturnTypeUtils.js +1 -0
  200. package/dist/util/getBaseTypesOfClassMember.js +1 -0
  201. package/dist/util/getConstraintInfo.js +1 -0
  202. package/dist/util/getESLintCoreRule.js +1 -0
  203. package/dist/util/getFixOrSuggest.js +1 -0
  204. package/dist/util/getForStatementHeadLoc.js +1 -0
  205. package/dist/util/getFunctionHeadLoc.js +1 -0
  206. package/dist/util/getMemberHeadLoc.js +1 -0
  207. package/dist/util/getOperatorPrecedence.js +1 -0
  208. package/dist/util/getParentFunctionNode.js +1 -0
  209. package/dist/util/getStaticStringValue.js +1 -0
  210. package/dist/util/getStringLength.js +1 -0
  211. package/dist/util/getTextWithParentheses.js +1 -0
  212. package/dist/util/getThisExpression.js +1 -0
  213. package/dist/util/getValueOfLiteralType.js +1 -0
  214. package/dist/util/getWrappedCode.js +1 -0
  215. package/dist/util/getWrappingFixer.js +1 -0
  216. package/dist/util/hasOverloadSignatures.js +1 -0
  217. package/dist/util/index.d.ts +2 -0
  218. package/dist/util/index.js +3 -0
  219. package/dist/util/isArrayMethodCallWithPredicate.js +1 -0
  220. package/dist/util/isAssignee.js +1 -0
  221. package/dist/util/isConditionalTest.js +1 -0
  222. package/dist/util/isHigherPrecedenceThanAwait.js +1 -0
  223. package/dist/util/isNodeEqual.js +1 -0
  224. package/dist/util/isNullLiteral.js +1 -0
  225. package/dist/util/isPromiseAggregatorMethod.js +1 -0
  226. package/dist/util/isStartOfArrowFunctionBody.d.ts +2 -0
  227. package/dist/util/isStartOfArrowFunctionBody.js +26 -0
  228. package/dist/util/isStartOfExpressionStatement.js +1 -0
  229. package/dist/util/isTypeImport.js +1 -0
  230. package/dist/util/isUndefinedIdentifier.js +1 -0
  231. package/dist/util/misc.js +1 -0
  232. package/dist/util/needsPrecedingSemiColon.js +1 -0
  233. package/dist/util/needsToBeAwaited.js +1 -0
  234. package/dist/util/objectIterators.js +1 -0
  235. package/dist/util/promiseUtils.js +1 -0
  236. package/dist/util/rangeToLoc.js +1 -0
  237. package/dist/util/referenceContainsTypePredicate.js +1 -0
  238. package/dist/util/referenceContainsTypeQuery.js +1 -0
  239. package/dist/util/scopeUtils.js +1 -0
  240. package/dist/util/skipChainExpression.js +1 -0
  241. package/dist/util/truthinessUtils.js +1 -0
  242. package/dist/util/types.js +1 -0
  243. package/dist/util/walkStatements.js +1 -0
  244. package/package.json +12 -11
@@ -72,15 +72,19 @@ exports.default = (0, util_1.createRule)({
72
72
  return;
73
73
  }
74
74
  const scope = context.sourceCode.getScope(node);
75
- const mergedWithClassDeclaration = scope.set
75
+ const mergedWithOtherDeclaration = scope.set
76
76
  .get(node.id.name)
77
- ?.defs.some(def => def.node.type === utils_1.AST_NODE_TYPES.ClassDeclaration);
77
+ ?.defs.some(def => def.node !== node &&
78
+ (def.node.type === utils_1.AST_NODE_TYPES.ClassDeclaration ||
79
+ def.node.type === utils_1.AST_NODE_TYPES.TSInterfaceDeclaration));
80
+ const isDefaultExport = node.parent.type === utils_1.AST_NODE_TYPES.ExportDefaultDeclaration;
81
+ const shouldSuggest = !mergedWithOtherDeclaration && !isDefaultExport;
78
82
  if (extend.length === 0) {
79
83
  context.report({
80
84
  node: node.id,
81
85
  messageId: 'noEmptyInterface',
82
86
  data: { option: 'allowInterfaces' },
83
- ...(!mergedWithClassDeclaration && {
87
+ ...(shouldSuggest && {
84
88
  suggest: ['object', 'unknown'].map(replacement => ({
85
89
  messageId: 'replaceEmptyInterface',
86
90
  data: { replacement },
@@ -99,7 +103,7 @@ exports.default = (0, util_1.createRule)({
99
103
  context.report({
100
104
  node: node.id,
101
105
  messageId: 'noEmptyInterfaceWithSuper',
102
- ...(!mergedWithClassDeclaration && {
106
+ ...(shouldSuggest && {
103
107
  suggest: [
104
108
  {
105
109
  messageId: 'replaceEmptyInterfaceWithSuper',
@@ -141,3 +145,4 @@ exports.default = (0, util_1.createRule)({
141
145
  };
142
146
  },
143
147
  });
148
+ //# sourceMappingURL=no-empty-object-type.js.map
@@ -195,3 +195,4 @@ exports.default = (0, util_1.createRule)({
195
195
  };
196
196
  },
197
197
  });
198
+ //# sourceMappingURL=no-explicit-any.js.map
@@ -33,3 +33,4 @@ exports.default = (0, util_1.createRule)({
33
33
  };
34
34
  },
35
35
  });
36
+ //# sourceMappingURL=no-extra-non-null-assertion.js.map
@@ -119,3 +119,4 @@ exports.default = (0, util_1.createRule)({
119
119
  };
120
120
  },
121
121
  });
122
+ //# sourceMappingURL=no-extraneous-class.js.map
@@ -112,69 +112,77 @@ exports.default = (0, util_1.createRule)({
112
112
  const allowForKnownSafeCalls = options.allowForKnownSafeCalls;
113
113
  /* eslint-enable @typescript-eslint/no-non-null-assertion */
114
114
  return {
115
+ ArrowFunctionExpression(node) {
116
+ if (node.body.type === utils_1.AST_NODE_TYPES.UnaryExpression) {
117
+ checkNode(node.body, node.body);
118
+ }
119
+ },
115
120
  ExpressionStatement(node) {
116
121
  if (options.ignoreIIFE && isAsyncIife(node)) {
117
122
  return;
118
123
  }
119
124
  const expression = (0, util_1.skipChainExpression)(node.expression);
120
- if (isKnownSafePromiseCall(expression)) {
121
- return;
125
+ checkNode(node, expression);
126
+ },
127
+ };
128
+ function checkNode(node, expression) {
129
+ if (isKnownSafePromiseCall(expression)) {
130
+ return;
131
+ }
132
+ const { isUnhandled, nonFunctionHandler, promiseArray } = isUnhandledPromise(checker, expression);
133
+ if (isUnhandled) {
134
+ if (promiseArray) {
135
+ context.report({
136
+ node,
137
+ messageId: options.ignoreVoid
138
+ ? 'floatingPromiseArrayVoid'
139
+ : 'floatingPromiseArray',
140
+ });
122
141
  }
123
- const { isUnhandled, nonFunctionHandler, promiseArray } = isUnhandledPromise(checker, expression);
124
- if (isUnhandled) {
125
- if (promiseArray) {
126
- context.report({
127
- node,
128
- messageId: options.ignoreVoid
129
- ? 'floatingPromiseArrayVoid'
130
- : 'floatingPromiseArray',
131
- });
132
- }
133
- else if (options.ignoreVoid) {
134
- context.report({
135
- node,
136
- messageId: nonFunctionHandler
137
- ? 'floatingUselessRejectionHandlerVoid'
138
- : 'floatingVoid',
139
- suggest: [
140
- {
141
- messageId: 'floatingFixVoid',
142
- fix(fixer) {
143
- if ((0, util_1.isParenthesized)(expression, context.sourceCode) ||
144
- (0, util_1.getOperatorPrecedenceForNode)(expression) >
145
- util_1.OperatorPrecedence.Unary) {
146
- return fixer.insertTextBefore(node, 'void ');
147
- }
148
- return [
149
- fixer.insertTextBefore(node, 'void ('),
150
- fixer.insertTextAfterRange([expression.range[1], expression.range[1]], ')'),
151
- ];
152
- },
153
- },
154
- {
155
- messageId: 'floatingFixAwait',
156
- fix: (fixer) => addAwait(fixer, expression, node),
142
+ else if (options.ignoreVoid) {
143
+ context.report({
144
+ node,
145
+ messageId: nonFunctionHandler
146
+ ? 'floatingUselessRejectionHandlerVoid'
147
+ : 'floatingVoid',
148
+ suggest: [
149
+ {
150
+ messageId: 'floatingFixVoid',
151
+ fix(fixer) {
152
+ if ((0, util_1.isParenthesized)(expression, context.sourceCode) ||
153
+ (0, util_1.getOperatorPrecedenceForNode)(expression) >
154
+ util_1.OperatorPrecedence.Unary) {
155
+ return fixer.insertTextBefore(node, 'void ');
156
+ }
157
+ return [
158
+ fixer.insertTextBefore(node, 'void ('),
159
+ fixer.insertTextAfterRange([expression.range[1], expression.range[1]], ')'),
160
+ ];
157
161
  },
158
- ],
159
- });
160
- }
161
- else {
162
- context.report({
163
- node,
164
- messageId: nonFunctionHandler
165
- ? 'floatingUselessRejectionHandler'
166
- : 'floating',
167
- suggest: [
168
- {
169
- messageId: 'floatingFixAwait',
170
- fix: (fixer) => addAwait(fixer, expression, node),
171
- },
172
- ],
173
- });
174
- }
162
+ },
163
+ {
164
+ messageId: 'floatingFixAwait',
165
+ fix: (fixer) => addAwait(fixer, expression, node),
166
+ },
167
+ ],
168
+ });
175
169
  }
176
- },
177
- };
170
+ else {
171
+ context.report({
172
+ node,
173
+ messageId: nonFunctionHandler
174
+ ? 'floatingUselessRejectionHandler'
175
+ : 'floating',
176
+ suggest: [
177
+ {
178
+ messageId: 'floatingFixAwait',
179
+ fix: (fixer) => addAwait(fixer, expression, node),
180
+ },
181
+ ],
182
+ });
183
+ }
184
+ }
185
+ }
178
186
  function addAwait(fixer, expression, node) {
179
187
  if (expression.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
180
188
  expression.operator === 'void') {
@@ -375,3 +383,4 @@ function getTypeAtLocation(checker, node) {
375
383
  return null;
376
384
  }
377
385
  }
386
+ //# sourceMappingURL=no-floating-promises.js.map
@@ -84,3 +84,4 @@ function isTypeRecurser(type, predicate) {
84
84
  }
85
85
  return predicate(type);
86
86
  }
87
+ //# sourceMappingURL=no-for-in-array.js.map
@@ -150,3 +150,4 @@ exports.default = (0, util_1.createRule)({
150
150
  };
151
151
  },
152
152
  });
153
+ //# sourceMappingURL=no-implied-eval.js.map
@@ -51,3 +51,4 @@ exports.default = (0, util_1.createRule)({
51
51
  };
52
52
  },
53
53
  });
54
+ //# sourceMappingURL=no-import-type-side-effects.js.map
@@ -180,3 +180,4 @@ exports.default = (0, util_1.createRule)({
180
180
  };
181
181
  },
182
182
  });
183
+ //# sourceMappingURL=no-inferrable-types.js.map
@@ -73,3 +73,4 @@ exports.default = (0, util_1.createRule)({
73
73
  };
74
74
  },
75
75
  });
76
+ //# sourceMappingURL=no-invalid-this.js.map
@@ -208,3 +208,4 @@ function getParentFunctionDeclarationNode(node) {
208
208
  }
209
209
  return null;
210
210
  }
211
+ //# sourceMappingURL=no-invalid-void-type.js.map
@@ -199,3 +199,4 @@ function isIIFE(node) {
199
199
  return (node.parent.type === utils_1.AST_NODE_TYPES.CallExpression &&
200
200
  node.parent.callee === node);
201
201
  }
202
+ //# sourceMappingURL=no-loop-func.js.map
@@ -33,3 +33,4 @@ exports.default = (0, util_1.createRule)({
33
33
  return baseRule.create(context);
34
34
  },
35
35
  });
36
+ //# sourceMappingURL=no-loss-of-precision.js.map
@@ -247,3 +247,4 @@ function isAncestorTSIndexedAccessType(node) {
247
247
  }
248
248
  return ancestor?.parent?.type === utils_1.AST_NODE_TYPES.TSIndexedAccessType;
249
249
  }
250
+ //# sourceMappingURL=no-magic-numbers.js.map
@@ -100,3 +100,4 @@ exports.default = (0, util_1.createRule)({
100
100
  };
101
101
  },
102
102
  });
103
+ //# sourceMappingURL=no-meaningless-void-operator.js.map
@@ -79,3 +79,4 @@ exports.default = (0, util_1.createRule)({
79
79
  };
80
80
  },
81
81
  });
82
+ //# sourceMappingURL=no-misused-new.js.map
@@ -801,3 +801,4 @@ function hasWellKnownSymbolWithVoidReturn(checker, node, type, symbolName) {
801
801
  return isVoidReturningFunctionType(checker, node, checker.getTypeOfSymbolAtLocation(symbol, node));
802
802
  });
803
803
  }
804
+ //# sourceMappingURL=no-misused-promises.js.map
@@ -258,3 +258,4 @@ function isTypeRecurser(type, predicate) {
258
258
  }
259
259
  return predicate(type);
260
260
  }
261
+ //# sourceMappingURL=no-misused-spread.js.map
@@ -198,3 +198,4 @@ exports.default = (0, util_1.createRule)({
198
198
  };
199
199
  },
200
200
  });
201
+ //# sourceMappingURL=no-mixed-enums.js.map
@@ -58,3 +58,4 @@ exports.default = (0, util_1.createRule)({
58
58
  };
59
59
  },
60
60
  });
61
+ //# sourceMappingURL=no-namespace.js.map
@@ -71,3 +71,4 @@ exports.default = (0, util_1.createRule)({
71
71
  };
72
72
  },
73
73
  });
74
+ //# sourceMappingURL=no-non-null-asserted-nullish-coalescing.js.map
@@ -63,3 +63,4 @@ exports.default = (0, util_1.createRule)({
63
63
  };
64
64
  },
65
65
  });
66
+ //# sourceMappingURL=no-non-null-asserted-optional-chain.js.map
@@ -91,3 +91,4 @@ exports.default = (0, util_1.createRule)({
91
91
  };
92
92
  },
93
93
  });
94
+ //# sourceMappingURL=no-non-null-assertion.js.map
@@ -197,3 +197,4 @@ exports.default = (0, util_1.createRule)({
197
197
  };
198
198
  },
199
199
  });
200
+ //# sourceMappingURL=no-redeclare.js.map
@@ -429,3 +429,4 @@ exports.default = (0, util_1.createRule)({
429
429
  };
430
430
  },
431
431
  });
432
+ //# sourceMappingURL=no-redundant-type-constituents.js.map
@@ -113,3 +113,4 @@ exports.default = util.createRule({
113
113
  };
114
114
  },
115
115
  });
116
+ //# sourceMappingURL=no-require-imports.js.map
@@ -253,3 +253,4 @@ exports.default = (0, util_1.createRule)({
253
253
  };
254
254
  },
255
255
  });
256
+ //# sourceMappingURL=no-restricted-imports.js.map
@@ -169,3 +169,4 @@ exports.default = (0, util_1.createRule)({
169
169
  };
170
170
  },
171
171
  });
172
+ //# sourceMappingURL=no-restricted-types.js.map
@@ -550,3 +550,4 @@ exports.default = (0, util_1.createRule)({
550
550
  };
551
551
  },
552
552
  });
553
+ //# sourceMappingURL=no-shadow.js.map
@@ -64,3 +64,4 @@ exports.default = (0, util_1.createRule)({
64
64
  };
65
65
  },
66
66
  });
67
+ //# sourceMappingURL=no-this-alias.js.map
@@ -266,3 +266,4 @@ exports.default = (0, util_1.createRule)({
266
266
  };
267
267
  },
268
268
  });
269
+ //# sourceMappingURL=no-type-alias.js.map
@@ -283,3 +283,4 @@ function booleanXor(arg0, ...args) {
283
283
  function parenthesize(text) {
284
284
  return `(${text})`;
285
285
  }
286
+ //# sourceMappingURL=no-unnecessary-boolean-literal-compare.js.map
@@ -687,3 +687,4 @@ function normalizeAllowConstantLoopConditions(allowConstantLoopConditions) {
687
687
  }
688
688
  return allowConstantLoopConditions;
689
689
  }
690
+ //# sourceMappingURL=no-unnecessary-condition.js.map
@@ -146,3 +146,4 @@ exports.default = (0, util_1.createRule)({
146
146
  };
147
147
  },
148
148
  });
149
+ //# sourceMappingURL=no-unnecessary-parameter-property-assignment.js.map
@@ -154,3 +154,4 @@ exports.default = (0, util_1.createRule)({
154
154
  };
155
155
  },
156
156
  });
157
+ //# sourceMappingURL=no-unnecessary-qualifier.js.map
@@ -64,18 +64,6 @@ exports.default = (0, util_1.createRule)({
64
64
  create(context) {
65
65
  const services = (0, util_1.getParserServices)(context);
66
66
  const checker = services.program.getTypeChecker();
67
- function isStringLike(type) {
68
- return (0, util_1.isTypeFlagSet)(type, ts.TypeFlags.StringLike);
69
- }
70
- function isUnderlyingTypeString(type) {
71
- if (type.isUnion()) {
72
- return type.types.every(isStringLike);
73
- }
74
- if (type.isIntersection()) {
75
- return type.types.some(isStringLike);
76
- }
77
- return isStringLike(type);
78
- }
79
67
  function isEnumMemberType(type) {
80
68
  return tsutils.typeConstituents(type).some(t => {
81
69
  const symbol = t.getSymbol();
@@ -315,7 +303,7 @@ exports.default = (0, util_1.createRule)({
315
303
  if (isTrivialInterpolation(node) &&
316
304
  !hasCommentsBetweenQuasi(node.quasis[0], node.quasis[1])) {
317
305
  const { constraintType } = (0, util_1.getConstraintInfo)(checker, services.getTypeAtLocation(node.expressions[0]));
318
- if (constraintType && isUnderlyingTypeString(constraintType)) {
306
+ if (constraintType && (0, util_1.isStringLike)(constraintType)) {
319
307
  reportSingleInterpolation(node);
320
308
  return;
321
309
  }
@@ -331,7 +319,7 @@ exports.default = (0, util_1.createRule)({
331
319
  const { constraintType, isTypeParameter } = (0, util_1.getConstraintInfo)(checker, services.getTypeAtLocation(node.types[0]));
332
320
  if (constraintType &&
333
321
  !isTypeParameter &&
334
- isUnderlyingTypeString(constraintType) &&
322
+ (0, util_1.isStringLike)(constraintType) &&
335
323
  !isEnumMemberType(constraintType)) {
336
324
  reportSingleInterpolation(node);
337
325
  return;
@@ -359,3 +347,4 @@ function isWhitespace(x) {
359
347
  function startsWithNewLine(x) {
360
348
  return utils_1.ASTUtils.LINEBREAK_MATCHER.exec(x)?.index === 0;
361
349
  }
350
+ //# sourceMappingURL=no-unnecessary-template-expression.js.map
@@ -200,3 +200,4 @@ function getConstructSignatureDeclaration(symbol, checker) {
200
200
  const sig = type.getConstructSignatures();
201
201
  return sig.at(0)?.getDeclaration();
202
202
  }
203
+ //# sourceMappingURL=no-unnecessary-type-arguments.js.map
@@ -1,4 +1,3 @@
1
- import type { TSESLint } from '@typescript-eslint/utils';
2
1
  export type Options = [
3
2
  {
4
3
  checkLiteralConstAssertions?: boolean;
@@ -6,7 +5,7 @@ export type Options = [
6
5
  }
7
6
  ];
8
7
  export type MessageIds = 'contextuallyUnnecessary' | 'unnecessaryAssertion';
9
- declare const _default: TSESLint.RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
8
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
9
  name: string;
11
10
  };
12
11
  export default _default;
@@ -37,42 +37,6 @@ const utils_1 = require("@typescript-eslint/utils");
37
37
  const tsutils = __importStar(require("ts-api-utils"));
38
38
  const ts = __importStar(require("typescript"));
39
39
  const util_1 = require("../util");
40
- function isAtExpressionStatementStart(node) {
41
- let current = node;
42
- while (true) {
43
- const { parent } = current;
44
- if (parent == null) {
45
- return false;
46
- }
47
- if (parent.range[0] !== current.range[0]) {
48
- return false;
49
- }
50
- if (parent.type === utils_1.AST_NODE_TYPES.ExpressionStatement) {
51
- return true;
52
- }
53
- current = parent;
54
- }
55
- }
56
- function isAtArrowFunctionBodyStart(node, sourceCode) {
57
- let current = node;
58
- while (true) {
59
- if ((0, util_1.isParenthesized)(current, sourceCode)) {
60
- return false;
61
- }
62
- const { parent } = current;
63
- if (parent == null) {
64
- return false;
65
- }
66
- if (parent.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
67
- parent.body === current) {
68
- return true;
69
- }
70
- if (parent.range[0] !== current.range[0]) {
71
- return false;
72
- }
73
- current = parent;
74
- }
75
- }
76
40
  exports.default = (0, util_1.createRule)({
77
41
  name: 'no-unnecessary-type-assertion',
78
42
  meta: {
@@ -285,7 +249,17 @@ exports.default = (0, util_1.createRule)({
285
249
  return nestedTypes.some(t => typeContains(t, predicate, seen));
286
250
  }
287
251
  function containsAny(type) {
288
- return typeContains(type, t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Any));
252
+ try {
253
+ return typeContains(type, t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Any));
254
+ }
255
+ catch (error) {
256
+ // Workaround for https://github.com/typescript-eslint/typescript-eslint/issues/12705
257
+ if (error instanceof RangeError &&
258
+ error.message === 'Maximum call stack size exceeded') {
259
+ return false;
260
+ }
261
+ throw error;
262
+ }
289
263
  }
290
264
  function containsTypeVariable(type) {
291
265
  return typeContains(type, t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.TypeVariable | ts.TypeFlags.Index));
@@ -614,9 +588,9 @@ exports.default = (0, util_1.createRule)({
614
588
  // wrapped in parentheses to stay an expression.
615
589
  const firstOperandToken = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(closingAngleBracket), util_1.NullThrowsReasons.MissingToken('operand', 'type assertion'));
616
590
  const breaksExpressionStatement = ['{', 'function', 'class'].includes(firstOperandToken.value) &&
617
- isAtExpressionStatementStart(node);
591
+ (0, util_1.isStartOfExpressionStatement)(node);
618
592
  const breaksArrowFunctionBody = firstOperandToken.value === '{' &&
619
- isAtArrowFunctionBodyStart(node, context.sourceCode);
593
+ (0, util_1.isStartOfArrowFunctionBody)(node, context.sourceCode);
620
594
  const needsParens = breaksExpressionStatement || breaksArrowFunctionBody;
621
595
  const fixes = [];
622
596
  if (needsParens) {
@@ -812,3 +786,4 @@ exports.default = (0, util_1.createRule)({
812
786
  };
813
787
  },
814
788
  });
789
+ //# sourceMappingURL=no-unnecessary-type-assertion.js.map
@@ -117,3 +117,4 @@ exports.default = (0, util_1.createRule)({
117
117
  };
118
118
  },
119
119
  });
120
+ //# sourceMappingURL=no-unnecessary-type-constraint.js.map
@@ -354,3 +354,4 @@ exports.default = (0, util_1.createRule)({
354
354
  };
355
355
  },
356
356
  });
357
+ //# sourceMappingURL=no-unnecessary-type-conversion.js.map
@@ -425,3 +425,4 @@ function isMappedType(type) {
425
425
  function isOperatorType(type) {
426
426
  return 'type' in type && !!type.type;
427
427
  }
428
+ //# sourceMappingURL=no-unnecessary-type-parameters.js.map