@typescript-eslint/eslint-plugin 7.0.0-alpha.0 → 7.0.1

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 (484) hide show
  1. package/dist/configs/all.js +12 -40
  2. package/dist/configs/all.js.map +1 -1
  3. package/dist/configs/base.js +0 -6
  4. package/dist/configs/base.js.map +1 -1
  5. package/dist/configs/disable-type-checked.js +7 -1
  6. package/dist/configs/disable-type-checked.js.map +1 -1
  7. package/dist/configs/eslint-recommended-raw.js +40 -0
  8. package/dist/configs/eslint-recommended-raw.js.map +1 -0
  9. package/dist/configs/eslint-recommended.js +10 -27
  10. package/dist/configs/eslint-recommended.js.map +1 -1
  11. package/dist/configs/recommended-type-checked.js.map +1 -1
  12. package/dist/configs/recommended.js.map +1 -1
  13. package/dist/configs/strict-type-checked.js +4 -0
  14. package/dist/configs/strict-type-checked.js.map +1 -1
  15. package/dist/configs/strict.js.map +1 -1
  16. package/dist/configs/stylistic-type-checked.js.map +1 -1
  17. package/dist/configs/stylistic.js.map +1 -1
  18. package/dist/index.js +6 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/rules/adjacent-overload-signatures.js +31 -60
  21. package/dist/rules/adjacent-overload-signatures.js.map +1 -1
  22. package/dist/rules/array-type.js +7 -32
  23. package/dist/rules/array-type.js.map +1 -1
  24. package/dist/rules/await-thenable.js +15 -4
  25. package/dist/rules/await-thenable.js.map +1 -1
  26. package/dist/rules/ban-ts-comment.js +32 -34
  27. package/dist/rules/ban-ts-comment.js.map +1 -1
  28. package/dist/rules/ban-tslint-comment.js +5 -29
  29. package/dist/rules/ban-tslint-comment.js.map +1 -1
  30. package/dist/rules/ban-types.js +4 -27
  31. package/dist/rules/ban-types.js.map +1 -1
  32. package/dist/rules/block-spacing.js +11 -34
  33. package/dist/rules/block-spacing.js.map +1 -1
  34. package/dist/rules/brace-style.js +10 -9
  35. package/dist/rules/brace-style.js.map +1 -1
  36. package/dist/rules/class-literal-property-style.js +20 -31
  37. package/dist/rules/class-literal-property-style.js.map +1 -1
  38. package/dist/rules/class-methods-use-this.js +209 -0
  39. package/dist/rules/class-methods-use-this.js.map +1 -0
  40. package/dist/rules/comma-dangle.js +11 -31
  41. package/dist/rules/comma-dangle.js.map +1 -1
  42. package/dist/rules/comma-spacing.js +11 -12
  43. package/dist/rules/comma-spacing.js.map +1 -1
  44. package/dist/rules/consistent-generic-constructors.js +23 -25
  45. package/dist/rules/consistent-generic-constructors.js.map +1 -1
  46. package/dist/rules/consistent-indexed-object-style.js +10 -14
  47. package/dist/rules/consistent-indexed-object-style.js.map +1 -1
  48. package/dist/rules/consistent-type-assertions.js +36 -21
  49. package/dist/rules/consistent-type-assertions.js.map +1 -1
  50. package/dist/rules/consistent-type-definitions.js +14 -40
  51. package/dist/rules/consistent-type-definitions.js.map +1 -1
  52. package/dist/rules/consistent-type-exports.js +19 -39
  53. package/dist/rules/consistent-type-exports.js.map +1 -1
  54. package/dist/rules/consistent-type-imports.js +88 -101
  55. package/dist/rules/consistent-type-imports.js.map +1 -1
  56. package/dist/rules/default-param-last.js +1 -1
  57. package/dist/rules/default-param-last.js.map +1 -1
  58. package/dist/rules/dot-notation.js.map +1 -1
  59. package/dist/rules/enum-utils/shared.js +57 -6
  60. package/dist/rules/enum-utils/shared.js.map +1 -1
  61. package/dist/rules/explicit-function-return-type.js +6 -31
  62. package/dist/rules/explicit-function-return-type.js.map +1 -1
  63. package/dist/rules/explicit-member-accessibility.js +8 -32
  64. package/dist/rules/explicit-member-accessibility.js.map +1 -1
  65. package/dist/rules/explicit-module-boundary-types.js +11 -35
  66. package/dist/rules/explicit-module-boundary-types.js.map +1 -1
  67. package/dist/rules/func-call-spacing.js +12 -35
  68. package/dist/rules/func-call-spacing.js.map +1 -1
  69. package/dist/rules/indent.js +18 -42
  70. package/dist/rules/indent.js.map +1 -1
  71. package/dist/rules/index.js +16 -0
  72. package/dist/rules/index.js.map +1 -1
  73. package/dist/rules/init-declarations.js.map +1 -1
  74. package/dist/rules/key-spacing.js +27 -59
  75. package/dist/rules/key-spacing.js.map +1 -1
  76. package/dist/rules/keyword-spacing.js +9 -31
  77. package/dist/rules/keyword-spacing.js.map +1 -1
  78. package/dist/rules/lines-around-comment.js +24 -48
  79. package/dist/rules/lines-around-comment.js.map +1 -1
  80. package/dist/rules/lines-between-class-members.js +5 -26
  81. package/dist/rules/lines-between-class-members.js.map +1 -1
  82. package/dist/rules/max-params.js +67 -0
  83. package/dist/rules/max-params.js.map +1 -0
  84. package/dist/rules/member-delimiter-style.js +12 -34
  85. package/dist/rules/member-delimiter-style.js.map +1 -1
  86. package/dist/rules/member-ordering.js +48 -40
  87. package/dist/rules/member-ordering.js.map +1 -1
  88. package/dist/rules/method-signature-style.js +14 -38
  89. package/dist/rules/method-signature-style.js.map +1 -1
  90. package/dist/rules/naming-convention-utils/enums.js +13 -5
  91. package/dist/rules/naming-convention-utils/enums.js.map +1 -1
  92. package/dist/rules/naming-convention-utils/format.js.map +1 -1
  93. package/dist/rules/naming-convention-utils/parse-options.js +3 -25
  94. package/dist/rules/naming-convention-utils/parse-options.js.map +1 -1
  95. package/dist/rules/naming-convention-utils/schema.js +8 -33
  96. package/dist/rules/naming-convention-utils/schema.js.map +1 -1
  97. package/dist/rules/naming-convention-utils/validator.js +3 -26
  98. package/dist/rules/naming-convention-utils/validator.js.map +1 -1
  99. package/dist/rules/naming-convention.js +59 -60
  100. package/dist/rules/naming-convention.js.map +1 -1
  101. package/dist/rules/no-array-constructor.js +4 -27
  102. package/dist/rules/no-array-constructor.js.map +1 -1
  103. package/dist/rules/no-array-delete.js +81 -0
  104. package/dist/rules/no-array-delete.js.map +1 -0
  105. package/dist/rules/no-base-to-string.js +7 -7
  106. package/dist/rules/no-base-to-string.js.map +1 -1
  107. package/dist/rules/no-confusing-non-null-assertion.js +5 -30
  108. package/dist/rules/no-confusing-non-null-assertion.js.map +1 -1
  109. package/dist/rules/no-confusing-void-expression.js +33 -20
  110. package/dist/rules/no-confusing-void-expression.js.map +1 -1
  111. package/dist/rules/no-dupe-class-members.js +3 -37
  112. package/dist/rules/no-dupe-class-members.js.map +1 -1
  113. package/dist/rules/no-duplicate-enum-values.js +2 -25
  114. package/dist/rules/no-duplicate-enum-values.js.map +1 -1
  115. package/dist/rules/no-duplicate-type-constituents.js +7 -31
  116. package/dist/rules/no-duplicate-type-constituents.js.map +1 -1
  117. package/dist/rules/no-dynamic-delete.js +4 -5
  118. package/dist/rules/no-dynamic-delete.js.map +1 -1
  119. package/dist/rules/no-empty-function.js +9 -32
  120. package/dist/rules/no-empty-function.js.map +1 -1
  121. package/dist/rules/no-empty-interface.js +8 -33
  122. package/dist/rules/no-empty-interface.js.map +1 -1
  123. package/dist/rules/no-explicit-any.js +12 -36
  124. package/dist/rules/no-explicit-any.js.map +1 -1
  125. package/dist/rules/no-extra-non-null-assertion.js +2 -25
  126. package/dist/rules/no-extra-non-null-assertion.js.map +1 -1
  127. package/dist/rules/no-extra-parens.js +47 -86
  128. package/dist/rules/no-extra-parens.js.map +1 -1
  129. package/dist/rules/no-extra-semi.js +5 -37
  130. package/dist/rules/no-extra-semi.js.map +1 -1
  131. package/dist/rules/no-extraneous-class.js +2 -25
  132. package/dist/rules/no-extraneous-class.js.map +1 -1
  133. package/dist/rules/no-floating-promises.js +137 -54
  134. package/dist/rules/no-floating-promises.js.map +1 -1
  135. package/dist/rules/no-for-in-array.js +6 -6
  136. package/dist/rules/no-for-in-array.js.map +1 -1
  137. package/dist/rules/no-implied-eval.js +7 -7
  138. package/dist/rules/no-implied-eval.js.map +1 -1
  139. package/dist/rules/no-import-type-side-effects.js +4 -28
  140. package/dist/rules/no-import-type-side-effects.js.map +1 -1
  141. package/dist/rules/no-inferrable-types.js +12 -36
  142. package/dist/rules/no-inferrable-types.js.map +1 -1
  143. package/dist/rules/no-invalid-this.js +2 -10
  144. package/dist/rules/no-invalid-this.js.map +1 -1
  145. package/dist/rules/no-invalid-void-type.js +6 -30
  146. package/dist/rules/no-invalid-void-type.js.map +1 -1
  147. package/dist/rules/no-loop-func.js +4 -28
  148. package/dist/rules/no-loop-func.js.map +1 -1
  149. package/dist/rules/no-loss-of-precision.js +5 -32
  150. package/dist/rules/no-loss-of-precision.js.map +1 -1
  151. package/dist/rules/no-magic-numbers.js +5 -28
  152. package/dist/rules/no-magic-numbers.js.map +1 -1
  153. package/dist/rules/no-meaningless-void-operator.js +4 -5
  154. package/dist/rules/no-meaningless-void-operator.js.map +1 -1
  155. package/dist/rules/no-misused-new.js +2 -25
  156. package/dist/rules/no-misused-new.js.map +1 -1
  157. package/dist/rules/no-misused-promises.js +5 -5
  158. package/dist/rules/no-misused-promises.js.map +1 -1
  159. package/dist/rules/no-mixed-enums.js +6 -7
  160. package/dist/rules/no-mixed-enums.js.map +1 -1
  161. package/dist/rules/no-namespace.js +4 -29
  162. package/dist/rules/no-namespace.js.map +1 -1
  163. package/dist/rules/no-non-null-asserted-nullish-coalescing.js +5 -29
  164. package/dist/rules/no-non-null-asserted-nullish-coalescing.js.map +1 -1
  165. package/dist/rules/no-non-null-asserted-optional-chain.js +2 -25
  166. package/dist/rules/no-non-null-asserted-optional-chain.js.map +1 -1
  167. package/dist/rules/no-non-null-assertion.js +20 -46
  168. package/dist/rules/no-non-null-assertion.js.map +1 -1
  169. package/dist/rules/no-redeclare.js +7 -31
  170. package/dist/rules/no-redeclare.js.map +1 -1
  171. package/dist/rules/no-redundant-type-constituents.js +12 -13
  172. package/dist/rules/no-redundant-type-constituents.js.map +1 -1
  173. package/dist/rules/no-require-imports.js +30 -4
  174. package/dist/rules/no-require-imports.js.map +1 -1
  175. package/dist/rules/no-restricted-imports.js +100 -77
  176. package/dist/rules/no-restricted-imports.js.map +1 -1
  177. package/dist/rules/no-shadow.js +30 -56
  178. package/dist/rules/no-shadow.js.map +1 -1
  179. package/dist/rules/no-this-alias.js +2 -25
  180. package/dist/rules/no-this-alias.js.map +1 -1
  181. package/dist/rules/no-throw-literal.js +6 -36
  182. package/dist/rules/no-throw-literal.js.map +1 -1
  183. package/dist/rules/no-type-alias.js +2 -25
  184. package/dist/rules/no-type-alias.js.map +1 -1
  185. package/dist/rules/no-unnecessary-boolean-literal-compare.js +6 -7
  186. package/dist/rules/no-unnecessary-boolean-literal-compare.js.map +1 -1
  187. package/dist/rules/no-unnecessary-condition.js +62 -22
  188. package/dist/rules/no-unnecessary-condition.js.map +1 -1
  189. package/dist/rules/no-unnecessary-qualifier.js +8 -7
  190. package/dist/rules/no-unnecessary-qualifier.js.map +1 -1
  191. package/dist/rules/no-unnecessary-type-arguments.js +5 -6
  192. package/dist/rules/no-unnecessary-type-arguments.js.map +1 -1
  193. package/dist/rules/no-unnecessary-type-assertion.js +37 -32
  194. package/dist/rules/no-unnecessary-type-assertion.js.map +1 -1
  195. package/dist/rules/no-unnecessary-type-constraint.js +18 -6
  196. package/dist/rules/no-unnecessary-type-constraint.js.map +1 -1
  197. package/dist/rules/no-unsafe-argument.js +11 -11
  198. package/dist/rules/no-unsafe-argument.js.map +1 -1
  199. package/dist/rules/no-unsafe-assignment.js +15 -17
  200. package/dist/rules/no-unsafe-assignment.js.map +1 -1
  201. package/dist/rules/no-unsafe-call.js +5 -6
  202. package/dist/rules/no-unsafe-call.js.map +1 -1
  203. package/dist/rules/no-unsafe-declaration-merging.js +4 -27
  204. package/dist/rules/no-unsafe-declaration-merging.js.map +1 -1
  205. package/dist/rules/no-unsafe-enum-comparison.js +94 -45
  206. package/dist/rules/no-unsafe-enum-comparison.js.map +1 -1
  207. package/dist/rules/no-unsafe-member-access.js +8 -10
  208. package/dist/rules/no-unsafe-member-access.js.map +1 -1
  209. package/dist/rules/no-unsafe-return.js +15 -15
  210. package/dist/rules/no-unsafe-return.js.map +1 -1
  211. package/dist/rules/no-unsafe-unary-minus.js +68 -0
  212. package/dist/rules/no-unsafe-unary-minus.js.map +1 -0
  213. package/dist/rules/no-unused-expressions.js +10 -25
  214. package/dist/rules/no-unused-expressions.js.map +1 -1
  215. package/dist/rules/no-unused-vars.js +37 -79
  216. package/dist/rules/no-unused-vars.js.map +1 -1
  217. package/dist/rules/no-use-before-define.js +8 -35
  218. package/dist/rules/no-use-before-define.js.map +1 -1
  219. package/dist/rules/no-useless-constructor.js +3 -27
  220. package/dist/rules/no-useless-constructor.js.map +1 -1
  221. package/dist/rules/no-useless-empty-export.js +18 -36
  222. package/dist/rules/no-useless-empty-export.js.map +1 -1
  223. package/dist/rules/no-useless-template-literals.js +138 -0
  224. package/dist/rules/no-useless-template-literals.js.map +1 -0
  225. package/dist/rules/no-var-requires.js +36 -39
  226. package/dist/rules/no-var-requires.js.map +1 -1
  227. package/dist/rules/non-nullable-type-assertion-style.js +9 -8
  228. package/dist/rules/non-nullable-type-assertion-style.js.map +1 -1
  229. package/dist/rules/object-curly-spacing.js +20 -19
  230. package/dist/rules/object-curly-spacing.js.map +1 -1
  231. package/dist/rules/padding-line-between-statements.js +28 -54
  232. package/dist/rules/padding-line-between-statements.js.map +1 -1
  233. package/dist/rules/parameter-properties.js +4 -29
  234. package/dist/rules/parameter-properties.js.map +1 -1
  235. package/dist/rules/prefer-as-const.js +2 -25
  236. package/dist/rules/prefer-as-const.js.map +1 -1
  237. package/dist/rules/prefer-destructuring.js +200 -0
  238. package/dist/rules/prefer-destructuring.js.map +1 -0
  239. package/dist/rules/prefer-enum-initializers.js +3 -27
  240. package/dist/rules/prefer-enum-initializers.js.map +1 -1
  241. package/dist/rules/prefer-find.js +237 -0
  242. package/dist/rules/prefer-find.js.map +1 -0
  243. package/dist/rules/prefer-for-of.js +7 -32
  244. package/dist/rules/prefer-for-of.js.map +1 -1
  245. package/dist/rules/prefer-function-type.js +9 -32
  246. package/dist/rules/prefer-function-type.js.map +1 -1
  247. package/dist/rules/prefer-includes.js +2 -2
  248. package/dist/rules/prefer-includes.js.map +1 -1
  249. package/dist/rules/prefer-literal-enum-member.js.map +1 -1
  250. package/dist/rules/prefer-namespace-keyword.js +4 -28
  251. package/dist/rules/prefer-namespace-keyword.js.map +1 -1
  252. package/dist/rules/prefer-nullish-coalescing.js +42 -30
  253. package/dist/rules/prefer-nullish-coalescing.js.map +1 -1
  254. package/dist/rules/prefer-optional-chain-utils/analyzeChain.js +20 -22
  255. package/dist/rules/prefer-optional-chain-utils/analyzeChain.js.map +1 -1
  256. package/dist/rules/prefer-optional-chain-utils/compareNodes.js.map +1 -1
  257. package/dist/rules/prefer-optional-chain-utils/gatherLogicalOperands.js +8 -10
  258. package/dist/rules/prefer-optional-chain-utils/gatherLogicalOperands.js.map +1 -1
  259. package/dist/rules/prefer-optional-chain.js +9 -11
  260. package/dist/rules/prefer-optional-chain.js.map +1 -1
  261. package/dist/rules/prefer-promise-reject-errors.js +108 -0
  262. package/dist/rules/prefer-promise-reject-errors.js.map +1 -0
  263. package/dist/rules/prefer-readonly-parameter-types.js +8 -31
  264. package/dist/rules/prefer-readonly-parameter-types.js.map +1 -1
  265. package/dist/rules/prefer-readonly.js +61 -17
  266. package/dist/rules/prefer-readonly.js.map +1 -1
  267. package/dist/rules/prefer-reduce-type-parameter.js +6 -32
  268. package/dist/rules/prefer-reduce-type-parameter.js.map +1 -1
  269. package/dist/rules/prefer-regexp-exec.js +8 -10
  270. package/dist/rules/prefer-regexp-exec.js.map +1 -1
  271. package/dist/rules/prefer-return-this-type.js +2 -4
  272. package/dist/rules/prefer-return-this-type.js.map +1 -1
  273. package/dist/rules/prefer-string-starts-ends-with.js +44 -26
  274. package/dist/rules/prefer-string-starts-ends-with.js.map +1 -1
  275. package/dist/rules/prefer-ts-expect-error.js +3 -27
  276. package/dist/rules/prefer-ts-expect-error.js.map +1 -1
  277. package/dist/rules/promise-function-async.js +11 -12
  278. package/dist/rules/promise-function-async.js.map +1 -1
  279. package/dist/rules/quotes.js +5 -26
  280. package/dist/rules/quotes.js.map +1 -1
  281. package/dist/rules/require-array-sort-compare.js +17 -39
  282. package/dist/rules/require-array-sort-compare.js.map +1 -1
  283. package/dist/rules/require-await.js +22 -50
  284. package/dist/rules/require-await.js.map +1 -1
  285. package/dist/rules/restrict-plus-operands.js +7 -7
  286. package/dist/rules/restrict-plus-operands.js.map +1 -1
  287. package/dist/rules/restrict-template-expressions.js +11 -11
  288. package/dist/rules/restrict-template-expressions.js.map +1 -1
  289. package/dist/rules/return-await.js +12 -15
  290. package/dist/rules/return-await.js.map +1 -1
  291. package/dist/rules/semi.js +4 -25
  292. package/dist/rules/semi.js.map +1 -1
  293. package/dist/rules/sort-type-constituents.js +5 -30
  294. package/dist/rules/sort-type-constituents.js.map +1 -1
  295. package/dist/rules/space-before-blocks.js +8 -31
  296. package/dist/rules/space-before-blocks.js.map +1 -1
  297. package/dist/rules/space-before-function-paren.js +14 -39
  298. package/dist/rules/space-before-function-paren.js.map +1 -1
  299. package/dist/rules/space-infix-ops.js +18 -40
  300. package/dist/rules/space-infix-ops.js.map +1 -1
  301. package/dist/rules/strict-boolean-expressions.js +94 -85
  302. package/dist/rules/strict-boolean-expressions.js.map +1 -1
  303. package/dist/rules/switch-exhaustiveness-check.js +153 -50
  304. package/dist/rules/switch-exhaustiveness-check.js.map +1 -1
  305. package/dist/rules/triple-slash-reference.js +3 -27
  306. package/dist/rules/triple-slash-reference.js.map +1 -1
  307. package/dist/rules/type-annotation-spacing.js +17 -46
  308. package/dist/rules/type-annotation-spacing.js.map +1 -1
  309. package/dist/rules/typedef.js +6 -30
  310. package/dist/rules/typedef.js.map +1 -1
  311. package/dist/rules/unbound-method.js +21 -61
  312. package/dist/rules/unbound-method.js.map +1 -1
  313. package/dist/rules/unified-signatures.js +12 -37
  314. package/dist/rules/unified-signatures.js.map +1 -1
  315. package/dist/util/astUtils.js +4 -4
  316. package/dist/util/astUtils.js.map +1 -1
  317. package/dist/util/collectUnusedVariables.js +8 -9
  318. package/dist/util/collectUnusedVariables.js.map +1 -1
  319. package/dist/util/explicitReturnTypeUtils.js +43 -34
  320. package/dist/util/explicitReturnTypeUtils.js.map +1 -1
  321. package/dist/util/getESLintCoreRule.js +3 -31
  322. package/dist/util/getESLintCoreRule.js.map +1 -1
  323. package/dist/util/getFunctionHeadLoc.js +146 -36
  324. package/dist/util/getFunctionHeadLoc.js.map +1 -1
  325. package/dist/util/getOperatorPrecedence.js +1 -0
  326. package/dist/util/getOperatorPrecedence.js.map +1 -1
  327. package/dist/util/getStaticStringValue.js +46 -0
  328. package/dist/util/getStaticStringValue.js.map +1 -0
  329. package/dist/util/getStringLength.js.map +1 -1
  330. package/dist/util/getThisExpression.js +1 -1
  331. package/dist/util/getThisExpression.js.map +1 -1
  332. package/dist/util/getWrappedCode.js +8 -0
  333. package/dist/util/getWrappedCode.js.map +1 -0
  334. package/dist/util/getWrappingFixer.js +19 -5
  335. package/dist/util/getWrappingFixer.js.map +1 -1
  336. package/dist/util/index.js +1 -0
  337. package/dist/util/index.js.map +1 -1
  338. package/dist/util/isNodeEqual.js.map +1 -1
  339. package/dist/util/misc.js +5 -7
  340. package/dist/util/misc.js.map +1 -1
  341. package/dist/util/objectIterators.js.map +1 -1
  342. package/docs/rules/README.md +44 -7
  343. package/docs/rules/TEMPLATE.md +5 -1
  344. package/docs/rules/adjacent-overload-signatures.md +7 -1
  345. package/docs/rules/array-type.md +14 -6
  346. package/docs/rules/await-thenable.md +3 -1
  347. package/docs/rules/ban-ts-comment.md +12 -9
  348. package/docs/rules/ban-tslint-comment.md +3 -3
  349. package/docs/rules/ban-types.md +11 -62
  350. package/docs/rules/block-spacing.md +0 -2
  351. package/docs/rules/brace-style.md +0 -2
  352. package/docs/rules/camelcase.md +5 -2
  353. package/docs/rules/class-literal-property-style.md +5 -14
  354. package/docs/rules/class-methods-use-this.md +96 -0
  355. package/docs/rules/comma-dangle.md +0 -2
  356. package/docs/rules/comma-spacing.md +0 -2
  357. package/docs/rules/consistent-generic-constructors.md +7 -4
  358. package/docs/rules/consistent-indexed-object-style.md +12 -12
  359. package/docs/rules/consistent-type-assertions.md +27 -22
  360. package/docs/rules/consistent-type-definitions.md +12 -13
  361. package/docs/rules/consistent-type-exports.md +9 -4
  362. package/docs/rules/consistent-type-imports.md +9 -6
  363. package/docs/rules/default-param-last.md +16 -6
  364. package/docs/rules/dot-notation.md +10 -5
  365. package/docs/rules/explicit-function-return-type.md +31 -30
  366. package/docs/rules/explicit-member-accessibility.md +49 -36
  367. package/docs/rules/explicit-module-boundary-types.md +30 -31
  368. package/docs/rules/func-call-spacing.md +0 -2
  369. package/docs/rules/indent.md +0 -2
  370. package/docs/rules/init-declarations.md +0 -2
  371. package/docs/rules/key-spacing.md +1 -3
  372. package/docs/rules/keyword-spacing.md +1 -3
  373. package/docs/rules/lines-around-comment.md +0 -2
  374. package/docs/rules/lines-between-class-members.md +2 -10
  375. package/docs/rules/max-params.md +10 -0
  376. package/docs/rules/member-delimiter-style.md +4 -1
  377. package/docs/rules/member-ordering.md +278 -200
  378. package/docs/rules/method-signature-style.md +7 -4
  379. package/docs/rules/naming-convention.md +31 -16
  380. package/docs/rules/no-array-constructor.md +0 -6
  381. package/docs/rules/no-array-delete.md +40 -0
  382. package/docs/rules/no-base-to-string.md +2 -2
  383. package/docs/rules/no-confusing-void-expression.md +3 -3
  384. package/docs/rules/no-dupe-class-members.md +3 -1
  385. package/docs/rules/no-duplicate-enum-values.md +8 -0
  386. package/docs/rules/no-duplicate-imports.md +5 -2
  387. package/docs/rules/no-duplicate-type-constituents.md +7 -2
  388. package/docs/rules/no-dynamic-delete.md +1 -1
  389. package/docs/rules/no-empty-function.md +13 -9
  390. package/docs/rules/no-empty-interface.md +2 -13
  391. package/docs/rules/no-explicit-any.md +28 -34
  392. package/docs/rules/no-extra-non-null-assertion.md +2 -0
  393. package/docs/rules/no-extra-parens.md +0 -2
  394. package/docs/rules/no-extra-semi.md +2 -2
  395. package/docs/rules/no-extraneous-class.md +10 -9
  396. package/docs/rules/no-floating-promises.md +24 -6
  397. package/docs/rules/no-for-in-array.md +13 -8
  398. package/docs/rules/no-implied-eval.md +2 -1
  399. package/docs/rules/no-import-type-side-effects.md +1 -2
  400. package/docs/rules/no-inferrable-types.md +4 -4
  401. package/docs/rules/no-invalid-this.md +3 -1
  402. package/docs/rules/no-invalid-void-type.md +5 -6
  403. package/docs/rules/no-loop-func.md +0 -2
  404. package/docs/rules/no-loss-of-precision.md +0 -2
  405. package/docs/rules/no-magic-numbers.md +14 -26
  406. package/docs/rules/no-meaningless-void-operator.md +6 -0
  407. package/docs/rules/no-misused-new.md +2 -1
  408. package/docs/rules/no-misused-promises.md +14 -13
  409. package/docs/rules/no-namespace.md +9 -7
  410. package/docs/rules/no-non-null-asserted-nullish-coalescing.md +5 -0
  411. package/docs/rules/no-non-null-asserted-optional-chain.md +5 -0
  412. package/docs/rules/no-non-null-assertion.md +2 -2
  413. package/docs/rules/no-parameter-properties.md +12 -0
  414. package/docs/rules/no-redeclare.md +5 -3
  415. package/docs/rules/no-redundant-type-constituents.md +14 -0
  416. package/docs/rules/no-require-imports.md +24 -1
  417. package/docs/rules/no-restricted-imports.md +24 -16
  418. package/docs/rules/no-shadow.md +15 -11
  419. package/docs/rules/no-this-alias.md +73 -3
  420. package/docs/rules/no-throw-literal.md +9 -11
  421. package/docs/rules/no-type-alias.md +55 -48
  422. package/docs/rules/no-unnecessary-boolean-literal-compare.md +5 -5
  423. package/docs/rules/no-unnecessary-condition.md +18 -2
  424. package/docs/rules/no-unnecessary-qualifier.md +1 -1
  425. package/docs/rules/no-unnecessary-type-arguments.md +7 -1
  426. package/docs/rules/no-unnecessary-type-assertion.md +2 -2
  427. package/docs/rules/no-unnecessary-type-constraint.md +1 -1
  428. package/docs/rules/no-unsafe-argument.md +12 -2
  429. package/docs/rules/no-unsafe-assignment.md +11 -1
  430. package/docs/rules/no-unsafe-call.md +10 -0
  431. package/docs/rules/no-unsafe-declaration-merging.md +5 -0
  432. package/docs/rules/no-unsafe-enum-comparison.md +15 -10
  433. package/docs/rules/no-unsafe-member-access.md +11 -1
  434. package/docs/rules/no-unsafe-return.md +11 -1
  435. package/docs/rules/no-unsafe-unary-minus.md +52 -0
  436. package/docs/rules/no-unused-expressions.md +0 -2
  437. package/docs/rules/no-unused-vars.md +17 -2
  438. package/docs/rules/no-use-before-define.md +4 -14
  439. package/docs/rules/no-useless-constructor.md +0 -2
  440. package/docs/rules/no-useless-empty-export.md +4 -0
  441. package/docs/rules/no-useless-template-literals.md +57 -0
  442. package/docs/rules/no-var-requires.md +24 -1
  443. package/docs/rules/non-nullable-type-assertion-style.md +1 -1
  444. package/docs/rules/object-curly-spacing.md +0 -2
  445. package/docs/rules/padding-line-between-statements.md +3 -5
  446. package/docs/rules/parameter-properties.md +22 -19
  447. package/docs/rules/prefer-as-const.md +4 -1
  448. package/docs/rules/prefer-destructuring.md +91 -0
  449. package/docs/rules/prefer-enum-initializers.md +1 -1
  450. package/docs/rules/prefer-find.md +39 -0
  451. package/docs/rules/prefer-for-of.md +3 -5
  452. package/docs/rules/prefer-function-type.md +1 -1
  453. package/docs/rules/prefer-includes.md +1 -3
  454. package/docs/rules/prefer-literal-enum-member.md +6 -4
  455. package/docs/rules/prefer-namespace-keyword.md +1 -1
  456. package/docs/rules/prefer-nullish-coalescing.md +27 -15
  457. package/docs/rules/prefer-optional-chain.md +18 -17
  458. package/docs/rules/prefer-promise-reject-errors.md +50 -0
  459. package/docs/rules/prefer-readonly-parameter-types.md +58 -32
  460. package/docs/rules/prefer-readonly.md +19 -4
  461. package/docs/rules/prefer-reduce-type-parameter.md +3 -1
  462. package/docs/rules/prefer-string-starts-ends-with.md +2 -1
  463. package/docs/rules/prefer-ts-expect-error.md +1 -0
  464. package/docs/rules/promise-function-async.md +73 -0
  465. package/docs/rules/quotes.md +0 -2
  466. package/docs/rules/require-array-sort-compare.md +7 -7
  467. package/docs/rules/require-await.md +2 -2
  468. package/docs/rules/restrict-plus-operands.md +16 -16
  469. package/docs/rules/restrict-template-expressions.md +11 -7
  470. package/docs/rules/return-await.md +8 -8
  471. package/docs/rules/semi.md +0 -4
  472. package/docs/rules/sort-type-constituents.md +62 -0
  473. package/docs/rules/space-before-blocks.md +5 -4
  474. package/docs/rules/space-before-function-paren.md +0 -2
  475. package/docs/rules/strict-boolean-expressions.md +7 -0
  476. package/docs/rules/switch-exhaustiveness-check.md +127 -8
  477. package/docs/rules/triple-slash-reference.md +76 -25
  478. package/docs/rules/type-annotation-spacing.md +8 -8
  479. package/docs/rules/typedef.md +19 -19
  480. package/docs/rules/unbound-method.md +4 -2
  481. package/docs/rules/unified-signatures.md +11 -2
  482. package/index.d.ts +6 -2
  483. package/package.json +32 -24
  484. package/rules.d.ts +46 -0
@@ -7,7 +7,7 @@ description: 'Require explicit accessibility modifiers on class properties and m
7
7
  > See **https://typescript-eslint.io/rules/explicit-member-accessibility** for documentation.
8
8
 
9
9
  TypeScript allows placing explicit `public`, `protected`, and `private` accessibility modifiers in front of class members.
10
- The modifiers exist solely in the type system and just server to describe who is allowed to access those members.
10
+ The modifiers exist solely in the type system and just serve to describe who is allowed to access those members.
11
11
 
12
12
  Leaving off accessibility modifiers makes for less code to read and write.
13
13
  Members are `public` by default.
@@ -30,17 +30,17 @@ If you are working on a codebase within which you lint non-TypeScript code (i.e.
30
30
  {
31
31
  "rules": {
32
32
  // disable the rule for all files
33
- "@typescript-eslint/explicit-member-accessibility": "off"
33
+ "@typescript-eslint/explicit-member-accessibility": "off",
34
34
  },
35
35
  "overrides": [
36
36
  {
37
37
  // enable the rule specifically for TypeScript files
38
38
  "files": ["*.ts", "*.mts", "*.cts", "*.tsx"],
39
39
  "rules": {
40
- "@typescript-eslint/explicit-member-accessibility": "error"
41
- }
42
- }
43
- ]
40
+ "@typescript-eslint/explicit-member-accessibility": "error",
41
+ },
42
+ },
43
+ ],
44
44
  }
45
45
  ```
46
46
 
@@ -48,16 +48,16 @@ If you are working on a codebase within which you lint non-TypeScript code (i.e.
48
48
 
49
49
  This rule in its default state requires no configuration and will enforce that every class member has an accessibility modifier. If you would like to allow for some implicit public members then you have the following options:
50
50
 
51
- ```ts
51
+ ```jsonc
52
52
  {
53
- accessibility: 'explicit',
54
- overrides: {
55
- accessors: 'explicit',
56
- constructors: 'no-public',
57
- methods: 'explicit',
58
- properties: 'off',
59
- parameterProperties: 'explicit'
60
- }
53
+ "accessibility": "explicit",
54
+ "overrides": {
55
+ "accessors": "explicit",
56
+ "constructors": "no-public",
57
+ "methods": "explicit",
58
+ "properties": "off",
59
+ "parameterProperties": "explicit",
60
+ },
61
61
  }
62
62
  ```
63
63
 
@@ -65,7 +65,7 @@ Note the above is an example of a possible configuration you could use - it is n
65
65
 
66
66
  The following patterns are considered incorrect code if no options are provided:
67
67
 
68
- ```ts
68
+ ```ts showPlaygroundButton
69
69
  class Animal {
70
70
  constructor(name) {
71
71
  // No accessibility modifier
@@ -88,9 +88,12 @@ class Animal {
88
88
 
89
89
  The following patterns are considered correct with the default options `{ accessibility: 'explicit' }`:
90
90
 
91
- ```ts
91
+ ```ts option='{ "accessibility": "explicit" }' showPlaygroundButton
92
92
  class Animal {
93
- public constructor(public breed, name) {
93
+ public constructor(
94
+ public breed,
95
+ name,
96
+ ) {
94
97
  // Parameter property and constructor
95
98
  this.animalName = name;
96
99
  }
@@ -111,9 +114,12 @@ class Animal {
111
114
 
112
115
  The following patterns are considered incorrect with the accessibility set to **no-public** `[{ accessibility: 'no-public' }]`:
113
116
 
114
- ```ts
117
+ ```ts option='{ "accessibility": "no-public" }' showPlaygroundButton
115
118
  class Animal {
116
- public constructor(public breed, name) {
119
+ public constructor(
120
+ public breed,
121
+ name,
122
+ ) {
117
123
  // Parameter property and constructor
118
124
  this.animalName = name;
119
125
  }
@@ -134,9 +140,12 @@ class Animal {
134
140
 
135
141
  The following patterns are considered correct with the accessibility set to **no-public** `[{ accessibility: 'no-public' }]`:
136
142
 
137
- ```ts
143
+ ```ts option='{ "accessibility": "no-public" }' showPlaygroundButton
138
144
  class Animal {
139
- constructor(protected breed, name) {
145
+ constructor(
146
+ protected breed,
147
+ name,
148
+ ) {
140
149
  // Parameter property and constructor
141
150
  this.name = name;
142
151
  }
@@ -155,7 +164,7 @@ class Animal {
155
164
  }
156
165
  ```
157
166
 
158
- ### Overrides
167
+ ### `overrides`
159
168
 
160
169
  There are three ways in which an override can be used.
161
170
 
@@ -169,7 +178,7 @@ e.g. `[ { overrides: { constructors: 'no-public' } } ]`
169
178
 
170
179
  The following patterns are considered incorrect with the example override
171
180
 
172
- ```ts
181
+ ```ts option='{ "overrides": { "constructors": "no-public" } }' showPlaygroundButton
173
182
  class Animal {
174
183
  public constructor(protected animalName) {}
175
184
  public get name() {
@@ -180,7 +189,7 @@ class Animal {
180
189
 
181
190
  The following patterns are considered correct with the example override
182
191
 
183
- ```ts
192
+ ```ts option='{ "overrides": { "constructors": "no-public" } }' showPlaygroundButton
184
193
  class Animal {
185
194
  constructor(protected animalName) {}
186
195
  public get name() {
@@ -195,7 +204,7 @@ e.g. `[ { accessibility: 'no-public', overrides: { properties: 'explicit' } } ]`
195
204
 
196
205
  The following patterns are considered incorrect with the example override
197
206
 
198
- ```ts
207
+ ```ts option='{ "accessibility": "no-public", "overrides": { "properties": "explicit" } }' showPlaygroundButton
199
208
  class Animal {
200
209
  constructor(protected animalName) {}
201
210
  get name() {
@@ -211,7 +220,7 @@ class Animal {
211
220
 
212
221
  The following patterns are considered correct with the example override
213
222
 
214
- ```ts
223
+ ```ts option='{ "accessibility": "no-public", "overrides": { "properties": "explicit" } }' showPlaygroundButton
215
224
  class Animal {
216
225
  constructor(protected animalName) {}
217
226
  get name() {
@@ -229,7 +238,7 @@ e.g. `[ { accessibility: 'off', overrides: { parameterProperties: 'explicit' } }
229
238
 
230
239
  The following code is considered incorrect with the example override
231
240
 
232
- ```ts
241
+ ```ts option='{ "accessibility": "off", "overrides": { "parameterProperties": "explicit" } }' showPlaygroundButton
233
242
  class Animal {
234
243
  constructor(readonly animalName: string) {}
235
244
  }
@@ -237,7 +246,7 @@ class Animal {
237
246
 
238
247
  The following code patterns are considered correct with the example override
239
248
 
240
- ```ts
249
+ ```ts option='{ "accessibility": "off", "overrides": { "parameterProperties": "explicit" } }' showPlaygroundButton
241
250
  class Animal {
242
251
  constructor(public readonly animalName: string) {}
243
252
  }
@@ -255,7 +264,7 @@ e.g. `[ { accessibility: 'off', overrides: { parameterProperties: 'no-public' }
255
264
 
256
265
  The following code is considered incorrect with the example override
257
266
 
258
- ```ts
267
+ ```ts option='{ "accessibility": "off", "overrides": { "parameterProperties": "no-public" } }' showPlaygroundButton
259
268
  class Animal {
260
269
  constructor(public readonly animalName: string) {}
261
270
  }
@@ -263,7 +272,7 @@ class Animal {
263
272
 
264
273
  The following code is considered correct with the example override
265
274
 
266
- ```ts
275
+ ```ts option='{ "accessibility": "off", "overrides": { "parameterProperties": "no-public" } }' showPlaygroundButton
267
276
  class Animal {
268
277
  constructor(public animalName: string) {}
269
278
  }
@@ -277,7 +286,7 @@ As no checks on the overridden member type are performed all permutations of vis
277
286
 
278
287
  The follow pattern is considered incorrect for the given configuration
279
288
 
280
- ```ts
289
+ ```ts option='{ "overrides": { "accessors" : "off" } }' showPlaygroundButton
281
290
  class Animal {
282
291
  constructor(protected animalName) {}
283
292
  public get name() {
@@ -291,7 +300,7 @@ class Animal {
291
300
 
292
301
  The following patterns are considered correct with the example override
293
302
 
294
- ```ts
303
+ ```ts option='{ "overrides": { "accessors" : "off" } }' showPlaygroundButton
295
304
  class Animal {
296
305
  public constructor(protected animalName) {}
297
306
  public get name() {
@@ -303,12 +312,12 @@ class Animal {
303
312
  }
304
313
  ```
305
314
 
306
- ### Except specific methods
315
+ ### `ignoredMethodNames`
307
316
 
308
317
  If you want to ignore some specific methods, you can do it by specifying method names. Note that this option does not care for the context, and will ignore every method with these names, which could lead to it missing some cases. You should use this sparingly.
309
318
  e.g. `[ { ignoredMethodNames: ['specificMethod', 'whateverMethod'] } ]`
310
319
 
311
- ```ts
320
+ ```ts option='{ "ignoredMethodNames": ["specificMethod", "whateverMethod"] }' showPlaygroundButton
312
321
  class Animal {
313
322
  get specificMethod() {
314
323
  console.log('No error because you specified this method on option');
@@ -324,7 +333,11 @@ class Animal {
324
333
 
325
334
  ## When Not To Use It
326
335
 
327
- If you think defaulting to public is a good default, then you should consider using the `no-public` setting. If you want to mix implicit and explicit public members then disable this rule.
336
+ If you think defaulting to public is a good default, then you should consider using the `no-public` setting.
337
+ If you want to mix implicit and explicit public members then you can disable this rule.
338
+
339
+ However, keep in mind that inconsistent style can harm readability in a project.
340
+ We recommend picking a single option for this rule that works best for your project.
328
341
 
329
342
  ## Further Reading
330
343
 
@@ -22,11 +22,6 @@ export function test() {
22
22
  return;
23
23
  }
24
24
 
25
- // Should indicate that a number is returned
26
- export default function () {
27
- return 1;
28
- }
29
-
30
25
  // Should indicate that a string is returned
31
26
  export var arrowFn = () => 'test';
32
27
 
@@ -45,16 +40,11 @@ export class Test {
45
40
  ### ✅ Correct
46
41
 
47
42
  ```ts
48
- // Function is not exported
49
- function test() {
43
+ // A function with no return value (void)
44
+ export function test(): void {
50
45
  return;
51
46
  }
52
47
 
53
- // A return value of type number
54
- export var fn = function (): number {
55
- return 1;
56
- };
57
-
58
48
  // A return value of type string
59
49
  export var arrowFn = (): string => 'test';
60
50
 
@@ -62,12 +52,17 @@ export var arrowFn = (): string => 'test';
62
52
  export var arrowFn = (arg: string): string => `test ${arg}`;
63
53
  export var arrowFn = (arg: unknown): string => `test ${arg}`;
64
54
 
65
- // Class is not exported
66
- class Test {
67
- method() {
55
+ export class Test {
56
+ // A class method with no return value (void)
57
+ method(): void {
68
58
  return;
69
59
  }
70
60
  }
61
+
62
+ // The function does not apply because it is not an exported function.
63
+ function test() {
64
+ return;
65
+ }
71
66
  ```
72
67
 
73
68
  ## Options
@@ -80,17 +75,17 @@ If you are working on a codebase within which you lint non-TypeScript code (i.e.
80
75
  {
81
76
  "rules": {
82
77
  // disable the rule for all files
83
- "@typescript-eslint/explicit-module-boundary-types": "off"
78
+ "@typescript-eslint/explicit-module-boundary-types": "off",
84
79
  },
85
80
  "overrides": [
86
81
  {
87
82
  // enable the rule specifically for TypeScript files
88
83
  "files": ["*.ts", "*.mts", "*.cts", "*.tsx"],
89
84
  "rules": {
90
- "@typescript-eslint/explicit-module-boundary-types": "error"
91
- }
92
- }
93
- ]
85
+ "@typescript-eslint/explicit-module-boundary-types": "error",
86
+ },
87
+ },
88
+ ],
94
89
  }
95
90
  ```
96
91
 
@@ -102,13 +97,13 @@ Examples of code for this rule with `{ allowArgumentsExplicitlyTypedAsAny: false
102
97
 
103
98
  #### ❌ Incorrect
104
99
 
105
- ```ts
100
+ ```ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
106
101
  export const func = (value: any): number => value + 1;
107
102
  ```
108
103
 
109
104
  #### ✅ Correct
110
105
 
111
- ```ts
106
+ ```ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
112
107
  export const func = (value: number): number => value + 1;
113
108
  ```
114
109
 
@@ -120,7 +115,7 @@ Examples of code for this rule with `{ allowDirectConstAssertionInArrowFunctions
120
115
 
121
116
  #### ❌ Incorrect
122
117
 
123
- ```ts
118
+ ```ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
124
119
  export const func = (value: number) => ({ type: 'X', value });
125
120
  export const foo = () => ({
126
121
  bar: true,
@@ -130,12 +125,12 @@ export const bar = () => 1;
130
125
 
131
126
  #### ✅ Correct
132
127
 
133
- ```ts
134
- export const func = (value: number) => ({ type: 'X', value } as const);
128
+ ```ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
129
+ export const func = (value: number) => ({ type: 'X', value }) as const;
135
130
  export const foo = () =>
136
131
  ({
137
132
  bar: true,
138
- } as const);
133
+ }) as const;
139
134
  export const bar = () => 1 as const;
140
135
  ```
141
136
 
@@ -162,7 +157,7 @@ Examples of code for this rule with `{ allowHigherOrderFunctions: false }`:
162
157
 
163
158
  #### ❌ Incorrect
164
159
 
165
- ```ts
160
+ ```ts option='{ "allowHigherOrderFunctions": false }'
166
161
  export const arrowFn = () => () => {};
167
162
 
168
163
  export function fn() {
@@ -176,7 +171,7 @@ export function foo(outer: string) {
176
171
 
177
172
  #### ✅ Correct
178
173
 
179
- ```ts
174
+ ```ts option='{ "allowHigherOrderFunctions": false }'
180
175
  export const arrowFn = () => (): void => {};
181
176
 
182
177
  export function fn() {
@@ -196,7 +191,7 @@ Examples of code for this rule with `{ allowTypedFunctionExpressions: false }`:
196
191
 
197
192
  #### ❌ Incorrect
198
193
 
199
- ```ts
194
+ ```ts option='{ "allowTypedFunctionExpressions": false }'
200
195
  export let arrowFn = () => 'test';
201
196
 
202
197
  export let funcExpr = function () {
@@ -212,7 +207,7 @@ export const foo = bar => {};
212
207
 
213
208
  #### ✅ Correct
214
209
 
215
- ```ts
210
+ ```ts option='{ "allowTypedFunctionExpressions": false }'
216
211
  type FuncType = () => string;
217
212
 
218
213
  export let arrowFn: FuncType = () => 'test';
@@ -243,8 +238,12 @@ export const foo: FooType = bar => {};
243
238
 
244
239
  ## When Not To Use It
245
240
 
246
- If you wish to make sure all functions have explicit return types, as opposed to only the module boundaries, you can use [explicit-function-return-type](./explicit-function-return-type.md)
241
+ If your project is not used by downstream consumers that are sensitive to API types, you can disable this rule.
247
242
 
248
243
  ## Further Reading
249
244
 
250
245
  - TypeScript [Functions](https://www.typescriptlang.org/docs/handbook/functions.html#function-types)
246
+
247
+ ## Related To
248
+
249
+ - [explicit-function-return-type](./explicit-function-return-type.md)
@@ -6,7 +6,5 @@ description: 'Require or disallow spacing between function identifiers and their
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/func-call-spacing** for documentation.
8
8
 
9
- ## Examples
10
-
11
9
  This rule extends the base [`eslint/func-call-spacing`](https://eslint.org/docs/rules/func-call-spacing) rule.
12
10
  It adds support for generic type parameters on function calls.
@@ -14,7 +14,5 @@ Please read [Issue #1824: Problems with the indent rule](https://github.com/type
14
14
 
15
15
  :::
16
16
 
17
- ## Examples
18
-
19
17
  This rule extends the base [`eslint/indent`](https://eslint.org/docs/rules/indent) rule.
20
18
  It adds support for TypeScript nodes.
@@ -6,7 +6,5 @@ description: 'Require or disallow initialization in variable declarations.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/init-declarations** for documentation.
8
8
 
9
- ## Examples
10
-
11
9
  This rule extends the base [`eslint/init-declarations`](https://eslint.org/docs/rules/init-declarations) rule.
12
10
  It adds support for TypeScript's `declare` variables.
@@ -6,7 +6,5 @@ description: 'Enforce consistent spacing between property names and type annotat
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/key-spacing** for documentation.
8
8
 
9
- ## Examples
10
-
11
9
  This rule extends the base [`eslint/key-spacing`](https://eslint.org/docs/rules/key-spacing) rule.
12
- This version adds support for type annotations on interfaces, classes and type literals properties.
10
+ It adds support for type annotations on interfaces, classes and type literals properties.
@@ -6,7 +6,5 @@ description: 'Enforce consistent spacing before and after keywords.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/keyword-spacing** for documentation.
8
8
 
9
- ## Examples
10
-
11
9
  This rule extends the base [`eslint/keyword-spacing`](https://eslint.org/docs/rules/keyword-spacing) rule.
12
- This version adds support for generic type parameters on function calls.
10
+ It adds support for generic type parameters on function calls.
@@ -6,8 +6,6 @@ description: 'Require empty lines around comments.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/lines-around-comment** for documentation.
8
8
 
9
- ## Rule Details
10
-
11
9
  This rule extends the base [`eslint/lines-around-comment`](https://eslint.org/docs/rules/lines-around-comment) rule.
12
10
  It adds support for TypeScript syntax.
13
11
 
@@ -6,10 +6,6 @@ description: 'Require or disallow an empty line between class members.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/lines-between-class-members** for documentation.
8
8
 
9
- This rule improves readability by enforcing lines between class members. It will not check empty lines before the first member and after the last member. This rule will require or disallow an empty line between class members.
10
-
11
- ## Examples
12
-
13
9
  This rule extends the base [`eslint/lines-between-class-members`](https://eslint.org/docs/rules/lines-between-class-members) rule.
14
10
  It adds support for ignoring overload methods in a class.
15
11
 
@@ -28,9 +24,7 @@ In addition to the options supported by the `lines-between-class-members` rule i
28
24
 
29
25
  Examples of **correct** code for the `{ "exceptAfterOverload": true }` option:
30
26
 
31
- ```ts
32
- /*eslint @typescript-eslint/lines-between-class-members: ["error", "always", { "exceptAfterOverload": true }]*/
33
-
27
+ ```ts option='"always", { "exceptAfterOverload": true }' showPlaygroundButton
34
28
  class foo {
35
29
  bar(a: string): void;
36
30
  bar(a: string, b: string): void;
@@ -46,9 +40,7 @@ class foo {
46
40
 
47
41
  Examples of **correct** code for the `{ "exceptAfterOverload": false }` option:
48
42
 
49
- ```ts
50
- /*eslint @typescript-eslint/lines-between-class-members: ["error", "always", { "exceptAfterOverload": false }]*/
51
-
43
+ ```ts option='"always", { "exceptAfterOverload": false }' showPlaygroundButton
52
44
  class foo {
53
45
  bar(a: string): void;
54
46
 
@@ -0,0 +1,10 @@
1
+ ---
2
+ description: 'Enforce a maximum number of parameters in function definitions.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/max-params** for documentation.
8
+
9
+ This rule extends the base [`eslint/max-params`](https://eslint.org/docs/rules/max-params) rule.
10
+ This version adds support for TypeScript `this` parameters so they won't be counted as a parameter.
@@ -158,4 +158,7 @@ type FooBar = { name: string; greet(): string }
158
158
 
159
159
  ## When Not To Use It
160
160
 
161
- If you don't care about enforcing a consistent member delimiter in interfaces and type literals, then you will not need this rule.
161
+ If you specifically want to use both member delimiter kinds for stylistic reasons, or don't wish to enforce one style over the other, you can avoid this rule.
162
+
163
+ However, keep in mind that inconsistent style can harm readability in a project.
164
+ We recommend picking a single option for this rule that works best for your project.