xo 0.52.4 → 0.53.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 (355) hide show
  1. package/cli.js +1 -0
  2. package/index.js +6 -11
  3. package/node_modules/@types/semver/LICENSE +21 -0
  4. package/node_modules/@types/semver/README.md +16 -0
  5. package/node_modules/@types/semver/classes/comparator.d.ts +17 -0
  6. package/node_modules/@types/semver/classes/range.d.ts +21 -0
  7. package/node_modules/@types/semver/classes/semver.d.ts +62 -0
  8. package/node_modules/@types/semver/functions/clean.d.ts +8 -0
  9. package/node_modules/@types/semver/functions/cmp.d.ts +16 -0
  10. package/node_modules/@types/semver/functions/coerce.d.ts +12 -0
  11. package/node_modules/@types/semver/functions/compare-build.d.ts +21 -0
  12. package/node_modules/@types/semver/functions/compare-loose.d.ts +5 -0
  13. package/node_modules/@types/semver/functions/compare.d.ts +20 -0
  14. package/node_modules/@types/semver/functions/diff.d.ts +9 -0
  15. package/node_modules/@types/semver/functions/eq.d.ts +9 -0
  16. package/node_modules/@types/semver/functions/gt.d.ts +9 -0
  17. package/node_modules/@types/semver/functions/gte.d.ts +9 -0
  18. package/node_modules/@types/semver/functions/inc.d.ts +15 -0
  19. package/node_modules/@types/semver/functions/lt.d.ts +9 -0
  20. package/node_modules/@types/semver/functions/lte.d.ts +8 -0
  21. package/node_modules/@types/semver/functions/major.d.ts +9 -0
  22. package/node_modules/@types/semver/functions/minor.d.ts +9 -0
  23. package/node_modules/@types/semver/functions/neq.d.ts +9 -0
  24. package/node_modules/@types/semver/functions/parse.d.ts +12 -0
  25. package/node_modules/@types/semver/functions/patch.d.ts +9 -0
  26. package/node_modules/@types/semver/functions/prerelease.d.ts +12 -0
  27. package/node_modules/@types/semver/functions/rcompare.d.ts +15 -0
  28. package/node_modules/@types/semver/functions/rsort.d.ts +9 -0
  29. package/node_modules/@types/semver/functions/satisfies.d.ts +14 -0
  30. package/node_modules/@types/semver/functions/sort.d.ts +9 -0
  31. package/node_modules/@types/semver/functions/valid.d.ts +11 -0
  32. package/node_modules/@types/semver/index.d.ts +136 -0
  33. package/node_modules/@types/semver/internals/identifiers.d.ts +13 -0
  34. package/node_modules/@types/semver/package.json +50 -0
  35. package/node_modules/@types/semver/preload.d.ts +2 -0
  36. package/node_modules/@types/semver/ranges/gtr.d.ts +14 -0
  37. package/node_modules/@types/semver/ranges/intersects.d.ts +13 -0
  38. package/node_modules/@types/semver/ranges/ltr.d.ts +14 -0
  39. package/node_modules/@types/semver/ranges/max-satisfying.d.ts +14 -0
  40. package/node_modules/@types/semver/ranges/min-satisfying.d.ts +14 -0
  41. package/node_modules/@types/semver/ranges/min-version.d.ts +10 -0
  42. package/node_modules/@types/semver/ranges/outside.d.ts +15 -0
  43. package/node_modules/@types/semver/ranges/simplify.d.ts +14 -0
  44. package/node_modules/@types/semver/ranges/subset.d.ts +9 -0
  45. package/node_modules/@types/semver/ranges/to-comparators.d.ts +9 -0
  46. package/node_modules/@types/semver/ranges/valid.d.ts +12 -0
  47. package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js +2 -1
  48. package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js.map +1 -1
  49. package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js +1 -0
  50. package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js.map +1 -1
  51. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js +1 -1
  52. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js.map +1 -1
  53. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js +1 -1
  54. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js.map +1 -1
  55. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js +1 -1
  56. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js.map +1 -1
  57. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js +1 -1
  58. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js.map +1 -1
  59. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js +1 -1
  60. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js.map +1 -1
  61. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js +99 -24
  62. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js.map +1 -1
  63. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js +4 -0
  64. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map +1 -1
  65. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-delimiter-style.js +2 -2
  66. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-delimiter-style.js.map +1 -1
  67. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js +29 -10
  68. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js.map +1 -1
  69. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/enums.js +4 -0
  70. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/enums.js.map +1 -1
  71. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/schema.js +19 -2
  72. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/schema.js.map +1 -1
  73. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js +29 -0
  74. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js.map +1 -1
  75. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js +1 -1
  76. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js.map +1 -1
  77. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extra-non-null-assertion.js +1 -1
  78. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extra-non-null-assertion.js.map +1 -1
  79. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extra-parens.js +14 -2
  80. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extra-parens.js.map +1 -1
  81. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-invalid-void-type.js +11 -5
  82. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-invalid-void-type.js.map +1 -1
  83. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js +51 -11
  84. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js.map +1 -1
  85. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-namespace.js +2 -2
  86. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-namespace.js.map +1 -1
  87. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js +1 -2
  88. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js.map +1 -1
  89. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-condition.js +4 -3
  90. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-condition.js.map +1 -1
  91. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-declaration-merging.js +78 -0
  92. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-declaration-merging.js.map +1 -0
  93. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-nullish-coalescing.js +0 -3
  94. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-nullish-coalescing.js.map +1 -1
  95. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain.js +167 -68
  96. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain.js.map +1 -1
  97. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/promise-function-async.js +2 -1
  98. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/promise-function-async.js.map +1 -1
  99. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/restrict-plus-operands.js +1 -1
  100. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/restrict-plus-operands.js.map +1 -1
  101. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/sort-type-constituents.js +245 -0
  102. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/sort-type-constituents.js.map +1 -0
  103. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/sort-type-union-intersection-members.js +3 -0
  104. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/sort-type-union-intersection-members.js.map +1 -1
  105. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/TEMPLATE.md +1 -1
  106. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md +5 -5
  107. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md +4 -6
  108. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.md +5 -4
  109. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md +3 -4
  110. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-tslint-comment.md +2 -2
  111. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md +2 -2
  112. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/brace-style.md +1 -1
  113. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-literal-property-style.md +4 -4
  114. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +1 -1
  115. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-spacing.md +1 -1
  116. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md +3 -3
  117. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-indexed-object-style.md +1 -3
  118. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md +12 -5
  119. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +4 -1
  120. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-exports.md +7 -13
  121. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-imports.md +47 -6
  122. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/default-param-last.md +1 -1
  123. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/dot-notation.md +1 -1
  124. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-function-return-type.md +7 -6
  125. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md +10 -6
  126. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +3 -3
  127. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/func-call-spacing.md +1 -1
  128. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/indent.md +1 -1
  129. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/init-declarations.md +1 -1
  130. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/keyword-spacing.md +1 -1
  131. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-between-class-members.md +1 -1
  132. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-delimiter-style.md +7 -60
  133. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md +19 -6
  134. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/method-signature-style.md +6 -6
  135. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/naming-convention.md +29 -30
  136. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-array-constructor.md +1 -1
  137. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-base-to-string.md +12 -11
  138. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md +4 -2
  139. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md +4 -5
  140. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dupe-class-members.md +1 -1
  141. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-enum-values.md +5 -2
  142. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dynamic-delete.md +4 -4
  143. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-function.md +1 -1
  144. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-interface.md +5 -5
  145. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md +13 -8
  146. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-non-null-assertion.md +4 -3
  147. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-parens.md +1 -1
  148. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-semi.md +1 -1
  149. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md +4 -6
  150. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md +2 -4
  151. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-for-in-array.md +26 -18
  152. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implicit-any-catch.md +1 -3
  153. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implied-eval.md +1 -3
  154. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +12 -43
  155. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-this.md +1 -1
  156. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md +6 -13
  157. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loop-func.md +1 -1
  158. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loss-of-precision.md +1 -1
  159. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-magic-numbers.md +1 -1
  160. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-meaningless-void-operator.md +8 -21
  161. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-new.md +13 -6
  162. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.md +53 -91
  163. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md +6 -7
  164. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md +3 -13
  165. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md +4 -27
  166. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-assertion.md +14 -13
  167. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.md +1 -1
  168. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redeclare.md +1 -1
  169. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redundant-type-constituents.md +1 -6
  170. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-require-imports.md +12 -15
  171. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-restricted-imports.md +1 -1
  172. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-shadow.md +1 -1
  173. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-this-alias.md +9 -15
  174. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-throw-literal.md +1 -3
  175. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md +1 -1
  176. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +15 -14
  177. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.md +3 -4
  178. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +12 -46
  179. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +22 -8
  180. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +4 -6
  181. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +6 -20
  182. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md +10 -7
  183. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md +9 -6
  184. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-call.md +6 -5
  185. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md +54 -0
  186. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-member-access.md +5 -4
  187. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md +9 -6
  188. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-expressions.md +1 -1
  189. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-vars.md +1 -1
  190. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-use-before-define.md +1 -1
  191. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-constructor.md +1 -1
  192. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-empty-export.md +4 -4
  193. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-var-requires.md +6 -4
  194. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md +7 -3
  195. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/object-curly-spacing.md +1 -1
  196. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md +1 -1
  197. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md +3 -6
  198. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-as-const.md +7 -3
  199. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-enum-initializers.md +5 -23
  200. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-for-of.md +15 -16
  201. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-function-type.md +22 -22
  202. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-includes.md +28 -30
  203. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.md +12 -13
  204. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md +27 -4
  205. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +6 -54
  206. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +21 -49
  207. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +1 -3
  208. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md +3 -5
  209. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md +6 -8
  210. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-regexp-exec.md +6 -11
  211. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-return-this-type.md +10 -25
  212. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +10 -6
  213. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-ts-expect-error.md +5 -11
  214. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/promise-function-async.md +1 -1
  215. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/quotes.md +1 -1
  216. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-array-sort-compare.md +5 -14
  217. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-await.md +1 -1
  218. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-plus-operands.md +18 -4
  219. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-template-expressions.md +9 -2
  220. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/return-await.md +1 -1
  221. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/semi.md +1 -1
  222. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-constituents.md +101 -0
  223. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +8 -16
  224. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-blocks.md +1 -1
  225. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-function-paren.md +1 -1
  226. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md +0 -2
  227. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/switch-exhaustiveness-check.md +15 -24
  228. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/triple-slash-reference.md +4 -2
  229. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md +1 -1
  230. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/typedef.md +5 -7
  231. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unbound-method.md +7 -4
  232. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unified-signatures.md +5 -3
  233. package/node_modules/@typescript-eslint/eslint-plugin/package.json +7 -5
  234. package/node_modules/@typescript-eslint/parser/README.md +2 -0
  235. package/node_modules/@typescript-eslint/parser/package.json +5 -5
  236. package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
  237. package/node_modules/@typescript-eslint/type-utils/dist/isTypeReadonly.d.ts.map +1 -1
  238. package/node_modules/@typescript-eslint/type-utils/dist/isTypeReadonly.js +3 -0
  239. package/node_modules/@typescript-eslint/type-utils/dist/isTypeReadonly.js.map +1 -1
  240. package/node_modules/@typescript-eslint/type-utils/package.json +5 -5
  241. package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +3 -3
  242. package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +3 -3
  243. package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
  244. package/node_modules/@typescript-eslint/types/package.json +2 -2
  245. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ast-converter.d.ts +2 -2
  246. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createDefaultProgram.d.ts +3 -6
  247. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createIsolatedProgram.d.ts +2 -2
  248. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createProjectProgram.d.ts +4 -6
  249. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createSourceFile.d.ts +2 -2
  250. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createWatchProgram.d.ts +4 -7
  251. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts +5 -4
  252. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/useProvidedPrograms.d.ts +2 -2
  253. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/createParseSettings.d.ts +4 -0
  254. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/index.d.ts +102 -0
  255. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/inferSingleRun.d.ts +15 -0
  256. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/warnAboutTSVersion.d.ts +3 -0
  257. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser-options.d.ts +0 -26
  258. package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.d.ts +2 -2
  259. package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.d.ts.map +1 -1
  260. package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.js +8 -8
  261. package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.js.map +1 -1
  262. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.d.ts +3 -6
  263. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.d.ts.map +1 -1
  264. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.js +13 -15
  265. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.js.map +1 -1
  266. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.d.ts +2 -2
  267. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.d.ts.map +1 -1
  268. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.js +7 -7
  269. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.js.map +1 -1
  270. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.d.ts +4 -6
  271. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.d.ts.map +1 -1
  272. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js +51 -38
  273. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js.map +1 -1
  274. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.d.ts +2 -2
  275. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.d.ts.map +1 -1
  276. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.js +4 -4
  277. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.js.map +1 -1
  278. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.d.ts +4 -7
  279. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.d.ts.map +1 -1
  280. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js +21 -22
  281. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js.map +1 -1
  282. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.d.ts +5 -4
  283. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.d.ts.map +1 -1
  284. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.js +7 -7
  285. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.js.map +1 -1
  286. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.d.ts +2 -2
  287. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.d.ts.map +1 -1
  288. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.js +4 -4
  289. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.js.map +1 -1
  290. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.d.ts +4 -0
  291. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.d.ts.map +1 -0
  292. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.js +145 -0
  293. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.js.map +1 -0
  294. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.d.ts +102 -0
  295. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.d.ts.map +1 -0
  296. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.js +3 -0
  297. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.js.map +1 -0
  298. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.d.ts +15 -0
  299. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.d.ts.map +1 -0
  300. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.js +53 -0
  301. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.js.map +1 -0
  302. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.d.ts +3 -0
  303. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.d.ts.map +1 -0
  304. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js +68 -0
  305. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js.map +1 -0
  306. package/node_modules/@typescript-eslint/typescript-estree/dist/parser-options.d.ts +0 -26
  307. package/node_modules/@typescript-eslint/typescript-estree/dist/parser-options.d.ts.map +1 -1
  308. package/node_modules/@typescript-eslint/typescript-estree/dist/parser.d.ts.map +1 -1
  309. package/node_modules/@typescript-eslint/typescript-estree/dist/parser.js +32 -388
  310. package/node_modules/@typescript-eslint/typescript-estree/dist/parser.js.map +1 -1
  311. package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
  312. package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/batchedSingleLineTests.d.ts +1 -1
  313. package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/index.d.ts +1 -1
  314. package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/rule-tester/RuleTester.d.ts +48 -0
  315. package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts +17 -0
  316. package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/RuleTester.d.ts +21 -17
  317. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/batchedSingleLineTests.d.ts +1 -1
  318. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/batchedSingleLineTests.d.ts.map +1 -1
  319. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/batchedSingleLineTests.js.map +1 -1
  320. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.d.ts +1 -1
  321. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.d.ts.map +1 -1
  322. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js +1 -1
  323. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js.map +1 -1
  324. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.d.ts +49 -0
  325. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.d.ts.map +1 -0
  326. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.js +238 -0
  327. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.js.map +1 -0
  328. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts +17 -0
  329. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts.map +1 -0
  330. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/dependencyConstraints.js +52 -0
  331. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/dependencyConstraints.js.map +1 -0
  332. package/node_modules/@typescript-eslint/utils/dist/ts-eslint/RuleTester.d.ts +16 -9
  333. package/node_modules/@typescript-eslint/utils/dist/ts-eslint/RuleTester.d.ts.map +1 -1
  334. package/node_modules/@typescript-eslint/utils/dist/ts-eslint/RuleTester.js.map +1 -1
  335. package/node_modules/@typescript-eslint/utils/package.json +9 -6
  336. package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
  337. package/node_modules/eslint-config-xo-typescript/index.js +7 -1
  338. package/node_modules/eslint-config-xo-typescript/package.json +5 -5
  339. package/node_modules/natural-compare-lite/README.md +126 -0
  340. package/node_modules/natural-compare-lite/index.js +57 -0
  341. package/node_modules/natural-compare-lite/package.json +42 -0
  342. package/node_modules/semver/classes/range.js +3 -0
  343. package/node_modules/semver/index.js +81 -41
  344. package/node_modules/{lru-cache → semver/node_modules/lru-cache}/LICENSE +0 -0
  345. package/node_modules/{lru-cache → semver/node_modules/lru-cache}/README.md +0 -0
  346. package/node_modules/{lru-cache → semver/node_modules/lru-cache}/index.js +0 -0
  347. package/node_modules/{lru-cache → semver/node_modules/lru-cache}/package.json +0 -0
  348. package/node_modules/semver/package.json +21 -10
  349. package/package.json +24 -24
  350. package/readme.md +1 -1
  351. package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/RuleTester.d.ts +0 -18
  352. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleTester.d.ts +0 -18
  353. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleTester.d.ts.map +0 -1
  354. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleTester.js +0 -133
  355. package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleTester.js.map +0 -1
@@ -6,40 +6,48 @@ description: 'Disallow iterating over an array with a for-in loop.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-for-in-array** for documentation.
8
8
 
9
- This rule prohibits iterating over an array with a for-in loop.
10
-
11
- ## Rule Details
12
-
13
- A for-in loop (`for (var k in o)`) iterates over the properties of an Object.
9
+ A for-in loop (`for (var i in o)`) iterates over the properties of an Object.
14
10
  While it is legal to use for-in loops with array types, it is not common.
15
11
  for-in will iterate over the indices of the array as strings, omitting any "holes" in
16
12
  the array.
17
- More common is to use for-of, which iterates over the values of an array.
18
- If you want to iterate over the indices, alternatives include:
19
13
 
20
- ```js
21
- array.forEach((value, index) => { ... });
22
- for (const [index, value] of array.entries()) { ... }
23
- for (let i = 0; i < array.length; i++) { ... }
24
- ```
25
-
26
- Examples of code for this rule:
14
+ ## Examples
27
15
 
28
16
  <!--tabs-->
29
17
 
30
18
  ### ❌ Incorrect
31
19
 
32
20
  ```js
33
- for (const x in [3, 4, 5]) {
34
- console.log(x);
21
+ declare const array: string[];
22
+
23
+ for (const i in array) {
24
+ console.log(array[i]);
25
+ }
26
+
27
+ for (const i in array) {
28
+ console.log(i, array[i]);
35
29
  }
36
30
  ```
37
31
 
38
32
  ### ✅ Correct
39
33
 
40
34
  ```js
41
- for (const x in { a: 3, b: 4, c: 5 }) {
42
- console.log(x);
35
+ declare const array: string[];
36
+
37
+ for (const value of array) {
38
+ console.log(value);
39
+ }
40
+
41
+ for (let i = 0; i < array.length; i += 1) {
42
+ console.log(i, array[i]);
43
+ }
44
+
45
+ array.forEach((value, i) => {
46
+ console.log(i, value);
47
+ })
48
+
49
+ for (const [i, value] of array.entries()) {
50
+ console.log(i, value);
43
51
  }
44
52
  ```
45
53
 
@@ -19,12 +19,10 @@ The `noImplicitAny` flag in TypeScript does not cover this for backwards compati
19
19
 
20
20
  ## DEPRECATED
21
21
 
22
- ## Rule Details
22
+ ## Examples
23
23
 
24
24
  This rule requires an explicit type to be declared on a catch clause variable.
25
25
 
26
- Examples of code for this rule:
27
-
28
26
  <!--tabs-->
29
27
 
30
28
  ### ❌ Incorrect
@@ -25,12 +25,10 @@ passed in to be interpreted. The same can be done with `setInterval()`, `setImme
25
25
 
26
26
  The best practice is to avoid using `new Function()` or `execScript()` and always use a function for the first argument of `setTimeout()`, `setInterval()` and `setImmediate()`.
27
27
 
28
- ## Rule Details
28
+ ## Examples
29
29
 
30
30
  This rule aims to eliminate implied `eval()` through the use of `new Function()`, `setTimeout()`, `setInterval()`, `setImmediate()` or `execScript()`.
31
31
 
32
- Examples of code for this rule:
33
-
34
32
  <!--tabs-->
35
33
 
36
34
  ### ❌ Incorrect
@@ -6,14 +6,11 @@ description: 'Disallow explicit type declarations for variables or parameters in
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-inferrable-types** for documentation.
8
8
 
9
- Explicit types where they can be easily inferred may add unnecessary verbosity.
9
+ TypeScript is able to infer the types of parameters, properties, and variables from their default or initial values.
10
+ There is no need to use an explicit `:` type annotation on one of those constructs initialized to a boolean, number, or string.
11
+ Doing so adds unnecessary verbosity to code -making it harder to read- and in some cases can prevent TypeScript from inferring a more specific literal type (e.g. `10`) instead of the more general primitive type (e.g. `number`)
10
12
 
11
- ## Rule Details
12
-
13
- This rule disallows explicit type declarations on parameters, variables
14
- and properties where the type can be easily inferred from its value.
15
-
16
- Examples of code with the default options:
13
+ ## Examples
17
14
 
18
15
  <!--tabs-->
19
16
 
@@ -21,30 +18,17 @@ Examples of code with the default options:
21
18
 
22
19
  ```ts
23
20
  const a: bigint = 10n;
24
- const a: bigint = -10n;
25
21
  const a: bigint = BigInt(10);
26
- const a: bigint = -BigInt(10);
27
- const a: boolean = false;
28
- const a: boolean = true;
29
- const a: boolean = Boolean(null);
30
22
  const a: boolean = !0;
23
+ const a: boolean = Boolean(null);
24
+ const a: boolean = true;
25
+ const a: null = null;
31
26
  const a: number = 10;
32
- const a: number = +10;
33
- const a: number = -10;
34
- const a: number = Number('1');
35
- const a: number = +Number('1');
36
- const a: number = -Number('1');
37
27
  const a: number = Infinity;
38
- const a: number = +Infinity;
39
- const a: number = -Infinity;
40
28
  const a: number = NaN;
41
- const a: number = +NaN;
42
- const a: number = -NaN;
43
- const a: null = null;
29
+ const a: number = Number('1');
44
30
  const a: RegExp = /a/;
45
- const a: RegExp = RegExp('a');
46
31
  const a: RegExp = new RegExp('a');
47
- const a: string = 'str';
48
32
  const a: string = `str`;
49
33
  const a: string = String(1);
50
34
  const a: symbol = Symbol('a');
@@ -62,30 +46,17 @@ function fn(a: number = 5, b: boolean = true) {}
62
46
 
63
47
  ```ts
64
48
  const a = 10n;
65
- const a = -10n;
66
49
  const a = BigInt(10);
67
- const a = -BigInt(10);
68
- const a = false;
69
- const a = true;
70
- const a = Boolean(null);
71
50
  const a = !0;
51
+ const a = Boolean(null);
52
+ const a = true;
53
+ const a = null;
72
54
  const a = 10;
73
- const a = +10;
74
- const a = -10;
75
- const a = Number('1');
76
- const a = +Number('1');
77
- const a = -Number('1');
78
55
  const a = Infinity;
79
- const a = +Infinity;
80
- const a = -Infinity;
81
56
  const a = NaN;
82
- const a = +NaN;
83
- const a = -NaN;
84
- const a = null;
57
+ const a = Number('1');
85
58
  const a = /a/;
86
- const a = RegExp('a');
87
59
  const a = new RegExp('a');
88
- const a = 'str';
89
60
  const a = `str`;
90
61
  const a = String(1);
91
62
  const a = Symbol('a');
@@ -97,8 +68,6 @@ class Foo {
97
68
  }
98
69
 
99
70
  function fn(a = 5, b = true) {}
100
-
101
- function fn(a: number, b: boolean, c: string) {}
102
71
  ```
103
72
 
104
73
  <!--/tabs-->
@@ -6,7 +6,7 @@ description: 'Disallow `this` keywords outside of classes or class-like objects.
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-invalid-this** for documentation.
8
8
 
9
- ## Rule Details
9
+ ## Examples
10
10
 
11
11
  This rule extends the base [`eslint/no-invalid-this`](https://eslint.org/docs/rules/no-invalid-this) rule.
12
12
  It adds support for TypeScript's `this` parameters.
@@ -6,21 +6,14 @@ description: 'Disallow `void` type outside of generic or return types.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-invalid-void-type** for documentation.
8
8
 
9
- Disallows usage of `void` type outside of return types or generic type arguments.
10
- If `void` is used as return type, it shouldn’t be a part of intersection/union type with most other types.
9
+ `void` in TypeScript refers to a function return that is meant to be ignored.
10
+ Attempting to use a `void` type outside of a return type or generic type argument is often a sign of programmer error.
11
+ `void` can also be misleading for other developers even if used correctly.
11
12
 
12
- ## Rationale
13
+ > The `void` type means cannot be mixed with any other types, other than `never`, which accepts all types.
14
+ > If you think you need this then you probably want the `undefined` type instead.
13
15
 
14
- The `void` type means “nothing” or that a function does not return any value,
15
- in contrast with implicit `undefined` type which means that a function returns a value `undefined`.
16
- So “nothing” cannot be mixed with any other types, other than `never`, which accepts all types.
17
- If you need this - use the `undefined` type instead.
18
-
19
- ## Rule Details
20
-
21
- This rule aims to ensure that the `void` type is only used in valid places.
22
-
23
- Examples of code for this rule:
16
+ ## Examples
24
17
 
25
18
  <!--tabs-->
26
19
 
@@ -6,7 +6,7 @@ description: 'Disallow function declarations that contain unsafe references insi
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-loop-func** for documentation.
8
8
 
9
- ## Rule Details
9
+ ## Examples
10
10
 
11
11
  This rule extends the base [`eslint/no-loop-func`](https://eslint.org/docs/rules/no-loop-func) rule.
12
12
  It adds support for TypeScript types.
@@ -6,7 +6,7 @@ description: 'Disallow literal numbers that lose precision.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-loss-of-precision** for documentation.
8
8
 
9
- ## Rule Details
9
+ ## Examples
10
10
 
11
11
  This rule extends the base [`eslint/no-loss-of-precision`](https://eslint.org/docs/rules/no-loss-of-precision) rule.
12
12
  It adds support for [numeric separators](https://github.com/tc39/proposal-numeric-separator).
@@ -6,7 +6,7 @@ description: 'Disallow magic numbers.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-magic-numbers** for documentation.
8
8
 
9
- ## Rule Details
9
+ ## Examples
10
10
 
11
11
  This rule extends the base [`eslint/no-magic-numbers`](https://eslint.org/docs/rules/no-magic-numbers) rule.
12
12
  It adds support for:
@@ -6,15 +6,15 @@ description: 'Disallow the `void` operator except when used to discard a value.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-meaningless-void-operator** for documentation.
8
8
 
9
- Disallows the `void` operator when its argument is already of type `void` or `undefined`.
9
+ `void` in TypeScript refers to a function return that is meant to be ignored.
10
+ The `void` operator is a useful tool to convey the programmer's intent to discard a value.
11
+ For example, it is recommended as one way of suppressing [`@typescript-eslint/no-floating-promises`](./no-floating-promises.md) instead of adding `.catch()` to a promise.
10
12
 
11
- ## Rule Details
13
+ This rule helps an authors catch API changes where previously a value was being discarded at a call site, but the callee changed so it no longer returns a value.
14
+ When combined with [no-unused-expressions](https://eslint.org/docs/rules/no-unused-expressions), it also helps _readers_ of the code by ensuring consistency: a statement that looks like `void foo();` is **always** discarding a return value, and a statement that looks like `foo();` is **never** discarding a return value.
15
+ This rule reports on any `void` operator whose argument is already of type `void` or `undefined`.
12
16
 
13
- The `void` operator is a useful tool to convey the programmer's intent to discard a value. For example, it is recommended as one way of suppressing [`@typescript-eslint/no-floating-promises`](./no-floating-promises.md) instead of adding `.catch()` to a promise.
14
-
15
- This rule helps an author catch API changes where previously a value was being discarded at a call site, but the callee changed so it no longer returns a value. When combined with [no-unused-expressions](https://eslint.org/docs/rules/no-unused-expressions), it also helps _readers_ of the code by ensuring consistency: a statement that looks like `void foo();` is **always** discarding a return value, and a statement that looks like `foo();` is **never** discarding a return value.
16
-
17
- Examples of code for this rule:
17
+ ## Examples
18
18
 
19
19
  <!--tabs-->
20
20
 
@@ -44,17 +44,4 @@ void bar(); // discarding a number
44
44
 
45
45
  ## Options
46
46
 
47
- This rule accepts a single object option with the following default configuration:
48
-
49
- ```json
50
- {
51
- "@typescript-eslint/no-meaningless-void-operator": [
52
- "error",
53
- {
54
- "checkNever": false
55
- }
56
- ]
57
- }
58
- ```
59
-
60
- - `checkNever: true` will suggest removing `void` when the argument has type `never`.
47
+ `checkNever: true` will suggest removing `void` when the argument has type `never`.
@@ -6,18 +6,20 @@ description: 'Enforce valid definition of `new` and `constructor`.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-misused-new** for documentation.
8
8
 
9
- Warns on apparent attempts to define constructors for interfaces or `new` for classes.
9
+ JavaScript classes may define a `constructor` method that runs when a class instance is newly created.
10
+ TypeScript allows interfaces that describe a static class object to define a `new()` method (though this is rarely used in real world code).
11
+ Developers new to JavaScript classes and/or TypeScript interfaces may sometimes confuse when to use `constructor` or `new`.
10
12
 
11
- ## Rule Details
13
+ This rule reports when a class defines a method named `new` or an interface defines a method named `constructor`.
12
14
 
13
- Examples of code for this rule:
15
+ ## Examples
14
16
 
15
17
  <!--tabs-->
16
18
 
17
19
  ### ❌ Incorrect
18
20
 
19
21
  ```ts
20
- class C {
22
+ declare class C {
21
23
  new(): C;
22
24
  }
23
25
 
@@ -30,10 +32,15 @@ interface I {
30
32
  ### ✅ Correct
31
33
 
32
34
  ```ts
33
- class C {
34
- constructor() {}
35
+ declare class C {
36
+ constructor();
35
37
  }
38
+
36
39
  interface I {
37
40
  new (): C;
38
41
  }
39
42
  ```
43
+
44
+ ## When Not To Use It
45
+
46
+ If you intentionally want a class with a `new` method, and you're confident nobody working in your code will mistake it with a constructor.
@@ -15,40 +15,8 @@ functions are handled/awaited.
15
15
  See [`no-floating-promises`](./no-floating-promises.md) for detecting unhandled Promise _statements_.
16
16
  :::
17
17
 
18
- ## Rule Details
19
-
20
- This rule accepts a single option which is an object with `checksConditionals`,
21
- `checksVoidReturn`, and `checksSpreads` properties indicating which types of
22
- misuse to flag. All are enabled by default.
23
-
24
18
  ## Options
25
19
 
26
- ```ts
27
- type Options = [
28
- {
29
- checksConditionals?: boolean;
30
- checksVoidReturn?: boolean | ChecksVoidReturnOptions;
31
- checksSpreads?: boolean;
32
- },
33
- ];
34
-
35
- interface ChecksVoidReturnOptions {
36
- arguments?: boolean;
37
- attributes?: boolean;
38
- properties?: boolean;
39
- returns?: boolean;
40
- variables?: boolean;
41
- }
42
-
43
- const defaultOptions: Options = [
44
- {
45
- checksConditionals: true,
46
- checksVoidReturn: true,
47
- checksSpreads: true,
48
- },
49
- ];
50
- ```
51
-
52
20
  ### `"checksConditionals"`
53
21
 
54
22
  If you don't want to check conditionals, you can configure the rule with `"checksConditionals": false`:
@@ -66,6 +34,45 @@ If you don't want to check conditionals, you can configure the rule with `"check
66
34
 
67
35
  Doing so prevents the rule from looking at code like `if (somePromise)`.
68
36
 
37
+ Examples of code for this rule with `checksConditionals: true`:
38
+
39
+ <!--tabs-->
40
+
41
+ #### ❌ Incorrect
42
+
43
+ ```ts
44
+ const promise = Promise.resolve('value');
45
+
46
+ if (promise) {
47
+ // Do something
48
+ }
49
+
50
+ const val = promise ? 123 : 456;
51
+
52
+ while (promise) {
53
+ // Do something
54
+ }
55
+ ```
56
+
57
+ #### ✅ Correct
58
+
59
+ ```ts
60
+ const promise = Promise.resolve('value');
61
+
62
+ // Always `await` the Promise in a conditional
63
+ if (await promise) {
64
+ // Do something
65
+ }
66
+
67
+ const val = (await promise) ? 123 : 456;
68
+
69
+ while (await promise) {
70
+ // Do something
71
+ }
72
+ ```
73
+
74
+ <!--/tabs-->
75
+
69
76
  ### `"checksVoidReturn"`
70
77
 
71
78
  Likewise, if you don't want functions that return promises where a void return is
@@ -107,64 +114,6 @@ For example, if you don't mind that passing a `() => Promise<void>` to a `() =>
107
114
  }
108
115
  ```
109
116
 
110
- ### `"checksSpreads"`
111
-
112
- If you don't want to check object spreads, you can add this configuration:
113
-
114
- ```json
115
- {
116
- "@typescript-eslint/no-misused-promises": [
117
- "error",
118
- {
119
- "checksSpreads": false
120
- }
121
- ]
122
- }
123
- ```
124
-
125
- ### `checksConditionals: true`
126
-
127
- Examples of code for this rule with `checksConditionals: true`:
128
-
129
- <!--tabs-->
130
-
131
- #### ❌ Incorrect
132
-
133
- ```ts
134
- const promise = Promise.resolve('value');
135
-
136
- if (promise) {
137
- // Do something
138
- }
139
-
140
- const val = promise ? 123 : 456;
141
-
142
- while (promise) {
143
- // Do something
144
- }
145
- ```
146
-
147
- #### ✅ Correct
148
-
149
- ```ts
150
- const promise = Promise.resolve('value');
151
-
152
- // Always `await` the Promise in a conditional
153
- if (await promise) {
154
- // Do something
155
- }
156
-
157
- const val = (await promise) ? 123 : 456;
158
-
159
- while (await promise) {
160
- // Do something
161
- }
162
- ```
163
-
164
- <!--/tabs-->
165
-
166
- ### `checksVoidReturn: true`
167
-
168
117
  Examples of code for this rule with `checksVoidReturn: true`:
169
118
 
170
119
  <!--tabs-->
@@ -233,7 +182,20 @@ eventEmitter.on('some-event', () => {
233
182
 
234
183
  <!--/tabs-->
235
184
 
236
- ### `checksSpreads: true`
185
+ ### `"checksSpreads"`
186
+
187
+ If you don't want to check object spreads, you can add this configuration:
188
+
189
+ ```json
190
+ {
191
+ "@typescript-eslint/no-misused-promises": [
192
+ "error",
193
+ {
194
+ "checksSpreads": false
195
+ }
196
+ ]
197
+ }
198
+ ```
237
199
 
238
200
  Examples of code for this rule with `checksSpreads: true`:
239
201
 
@@ -1,19 +1,18 @@
1
1
  ---
2
- description: 'Disallow custom TypeScript modules and namespaces.'
2
+ description: 'Disallow TypeScript namespaces.'
3
3
  ---
4
4
 
5
5
  > 🛑 This file is source code, not the primary documentation location! 🛑
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-namespace** for documentation.
8
8
 
9
- Custom TypeScript modules (`module foo {}`) and namespaces (`namespace foo {}`) are considered outdated
10
- ways to organize TypeScript code. ES2015 module syntax is now preferred (`import`/`export`).
9
+ TypeScript historically allowed a form of code organization called "custom modules" (`module Example {}`), later renamed to "namespaces" (`namespace Example`).
10
+ Namespaces are an outdated way to organize TypeScript code.
11
+ ES2015 module syntax is now preferred (`import`/`export`).
11
12
 
12
- This rule still allows the use of TypeScript module declarations to describe external APIs (`declare module 'foo' {}`).
13
+ > This rule does not report on the use of TypeScript module declarations to describe external APIs (`declare module 'foo' {}`).
13
14
 
14
- ## Rule Details
15
-
16
- This rule aims to standardize the way modules are declared.
15
+ ## Examples
17
16
 
18
17
  Examples of code with the default options:
19
18
 
@@ -6,20 +6,16 @@ description: 'Disallow non-null assertions in the left operand of a nullish coal
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing** for documentation.
8
8
 
9
- ## Rule Details
9
+ The `??` nullish coalescing runtime operator allows providing a default value when dealing with `null` or `undefined`.
10
+ Using a `!` non-null assertion type operator in the left operand of a nullish coalescing operator is redundant, and likely a sign of programmer error or confusion over the two operators.
10
11
 
11
- The nullish coalescing operator is designed to provide a default value when dealing with `null` or `undefined`.
12
- Using non-null assertions in the left operand of the nullish coalescing operator is redundant.
13
-
14
- Examples of code for this rule:
12
+ ## Examples
15
13
 
16
14
  <!--tabs-->
17
15
 
18
16
  ### ❌ Incorrect
19
17
 
20
18
  ```ts
21
- /* eslint @typescript-eslint/no-non-null-asserted-nullish-coalescing: "error" */
22
-
23
19
  foo! ?? bar;
24
20
  foo.bazz! ?? bar;
25
21
  foo!.bazz! ?? bar;
@@ -36,8 +32,6 @@ x! ?? '';
36
32
  ### ✅ Correct
37
33
 
38
34
  ```ts
39
- /* eslint @typescript-eslint/no-non-null-asserted-nullish-coalescing: "error" */
40
-
41
35
  foo ?? bar;
42
36
  foo ?? bar!;
43
37
  foo!.bazz ?? bar;
@@ -49,10 +43,6 @@ let x: string;
49
43
  x! ?? '';
50
44
  ```
51
45
 
52
- ## When Not To Use It
53
-
54
- If you are not using TypeScript 3.7 (or greater), then you will not need to use this rule, as the nullish coalescing operator is not supported.
55
-
56
46
  ## Further Reading
57
47
 
58
48
  - [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html)
@@ -6,52 +6,29 @@ description: 'Disallow non-null assertions after an optional chain expression.'
6
6
  >
7
7
  > See **https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain** for documentation.
8
8
 
9
- ## Rule Details
9
+ `?.` optional chain expressions provide `undefined` if an object is `null` or `undefined`.
10
+ Using a `!` non-null assertion to assert the result of an `?.` optional chain expression is non-nullable is likely wrong.
10
11
 
11
- Optional chain expressions are designed to return `undefined` if the optional property is nullish.
12
- Using non-null assertions after an optional chain expression is wrong, and introduces a serious type safety hole into your code.
12
+ > Most of the time, either the object was not nullable and did not need the `?.` for its property lookup, or the `!` is incorrect and introducing a type safety hole.
13
13
 
14
- Examples of code for this rule:
14
+ ## Examples
15
15
 
16
16
  <!--tabs-->
17
17
 
18
18
  ### ❌ Incorrect
19
19
 
20
20
  ```ts
21
- /* eslint @typescript-eslint/no-non-null-asserted-optional-chain: "error" */
22
-
23
21
  foo?.bar!;
24
22
  foo?.bar()!;
25
-
26
- // Prior to TS3.9, foo?.bar!.baz meant (foo?.bar).baz - i.e. the non-null assertion is applied to the entire chain so far.
27
- // For TS3.9 and greater, the non-null assertion is only applied to the property itself, so it's safe.
28
- // The following is incorrect code if you're using less than TS3.9
29
- foo?.bar!.baz;
30
- foo?.bar!();
31
- foo?.bar!().baz;
32
23
  ```
33
24
 
34
25
  ### ✅ Correct
35
26
 
36
27
  ```ts
37
- /* eslint @typescript-eslint/no-non-null-asserted-optional-chain: "error" */
38
-
39
28
  foo?.bar;
40
- (foo?.bar).baz;
41
- foo?.bar();
42
29
  foo?.bar();
43
- foo?.bar().baz;
44
-
45
- // The following is correct code if you're using TS3.9 or greater
46
- foo?.bar!.baz;
47
- foo?.bar!();
48
- foo?.bar!().baz;
49
30
  ```
50
31
 
51
- ## When Not To Use It
52
-
53
- If you are not using TypeScript 3.7 (or greater), then you will not need to use this rule, as the operator is not supported.
54
-
55
32
  ## Further Reading
56
33
 
57
34
  - [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html)