eslint 8.0.0-beta.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/README.md +4 -4
  2. package/bin/eslint.js +1 -1
  3. package/conf/eslint-recommended.js +1 -1
  4. package/conf/{category-list.json → rule-type-list.json} +4 -7
  5. package/lib/cli-engine/cli-engine.js +11 -3
  6. package/lib/cli-engine/file-enumerator.js +4 -3
  7. package/lib/cli-engine/formatters/html.js +1 -1
  8. package/lib/cli-engine/hash.js +2 -2
  9. package/lib/cli-engine/xml-escape.js +1 -1
  10. package/lib/config/flat-config-array.js +2 -2
  11. package/lib/config/flat-config-schema.js +1 -1
  12. package/lib/config/rule-validator.js +25 -8
  13. package/lib/eslint/eslint.js +4 -0
  14. package/lib/init/autoconfig.js +17 -18
  15. package/lib/init/config-file.js +3 -3
  16. package/lib/init/config-initializer.js +11 -10
  17. package/lib/init/config-rule.js +15 -16
  18. package/lib/init/npm-utils.js +16 -15
  19. package/lib/init/source-code-utils.js +6 -5
  20. package/lib/linter/apply-disable-directives.js +80 -11
  21. package/lib/linter/code-path-analysis/code-path-analyzer.js +115 -36
  22. package/lib/linter/code-path-analysis/code-path-segment.js +0 -1
  23. package/lib/linter/code-path-analysis/code-path-state.js +4 -1
  24. package/lib/linter/code-path-analysis/code-path.js +14 -5
  25. package/lib/linter/code-path-analysis/debug-helpers.js +2 -2
  26. package/lib/linter/code-path-analysis/fork-context.js +0 -1
  27. package/lib/linter/code-path-analysis/id-generator.js +0 -1
  28. package/lib/linter/config-comment-parser.js +1 -1
  29. package/lib/linter/linter.js +51 -22
  30. package/lib/linter/node-event-generator.js +0 -1
  31. package/lib/linter/report-translator.js +12 -12
  32. package/lib/linter/rules.js +3 -0
  33. package/lib/linter/safe-emitter.js +2 -2
  34. package/lib/linter/source-code-fixer.js +2 -2
  35. package/lib/linter/timing.js +2 -2
  36. package/lib/rule-tester/rule-tester.js +12 -2
  37. package/lib/rules/accessor-pairs.js +0 -1
  38. package/lib/rules/array-bracket-newline.js +0 -1
  39. package/lib/rules/array-bracket-spacing.js +0 -1
  40. package/lib/rules/array-callback-return.js +0 -1
  41. package/lib/rules/array-element-newline.js +0 -1
  42. package/lib/rules/arrow-body-style.js +0 -1
  43. package/lib/rules/arrow-parens.js +0 -1
  44. package/lib/rules/arrow-spacing.js +0 -1
  45. package/lib/rules/block-scoped-var.js +0 -1
  46. package/lib/rules/block-spacing.js +0 -1
  47. package/lib/rules/brace-style.js +0 -1
  48. package/lib/rules/callback-return.js +1 -1
  49. package/lib/rules/camelcase.js +17 -19
  50. package/lib/rules/capitalized-comments.js +0 -1
  51. package/lib/rules/class-methods-use-this.js +51 -9
  52. package/lib/rules/comma-dangle.js +0 -1
  53. package/lib/rules/comma-spacing.js +0 -1
  54. package/lib/rules/comma-style.js +0 -1
  55. package/lib/rules/complexity.js +47 -56
  56. package/lib/rules/computed-property-spacing.js +0 -1
  57. package/lib/rules/consistent-return.js +0 -1
  58. package/lib/rules/consistent-this.js +1 -2
  59. package/lib/rules/constructor-super.js +0 -1
  60. package/lib/rules/curly.js +0 -1
  61. package/lib/rules/default-case-last.js +0 -1
  62. package/lib/rules/default-case.js +2 -3
  63. package/lib/rules/default-param-last.js +1 -2
  64. package/lib/rules/dot-location.js +0 -1
  65. package/lib/rules/dot-notation.js +0 -1
  66. package/lib/rules/eol-last.js +6 -2
  67. package/lib/rules/eqeqeq.js +1 -2
  68. package/lib/rules/for-direction.js +0 -1
  69. package/lib/rules/func-call-spacing.js +0 -1
  70. package/lib/rules/func-name-matching.js +9 -6
  71. package/lib/rules/func-names.js +0 -1
  72. package/lib/rules/func-style.js +0 -1
  73. package/lib/rules/function-call-argument-newline.js +0 -1
  74. package/lib/rules/function-paren-newline.js +1 -1
  75. package/lib/rules/generator-star-spacing.js +0 -1
  76. package/lib/rules/getter-return.js +0 -1
  77. package/lib/rules/global-require.js +1 -1
  78. package/lib/rules/grouped-accessor-pairs.js +0 -1
  79. package/lib/rules/guard-for-in.js +0 -1
  80. package/lib/rules/handle-callback-err.js +1 -1
  81. package/lib/rules/id-blacklist.js +1 -1
  82. package/lib/rules/id-denylist.js +0 -1
  83. package/lib/rules/id-length.js +0 -1
  84. package/lib/rules/id-match.js +0 -1
  85. package/lib/rules/implicit-arrow-linebreak.js +0 -1
  86. package/lib/rules/indent-legacy.js +1 -1
  87. package/lib/rules/indent.js +7 -10
  88. package/lib/rules/index.js +1 -1
  89. package/lib/rules/init-declarations.js +0 -1
  90. package/lib/rules/jsx-quotes.js +0 -1
  91. package/lib/rules/key-spacing.js +4 -5
  92. package/lib/rules/keyword-spacing.js +19 -3
  93. package/lib/rules/line-comment-position.js +0 -1
  94. package/lib/rules/linebreak-style.js +0 -1
  95. package/lib/rules/lines-around-comment.js +0 -1
  96. package/lib/rules/lines-around-directive.js +1 -2
  97. package/lib/rules/lines-between-class-members.js +50 -3
  98. package/lib/rules/max-classes-per-file.js +31 -8
  99. package/lib/rules/max-depth.js +0 -1
  100. package/lib/rules/max-len.js +1 -2
  101. package/lib/rules/max-lines-per-function.js +1 -2
  102. package/lib/rules/max-lines.js +0 -1
  103. package/lib/rules/max-nested-callbacks.js +0 -1
  104. package/lib/rules/max-params.js +0 -1
  105. package/lib/rules/max-statements-per-line.js +0 -1
  106. package/lib/rules/max-statements.js +0 -1
  107. package/lib/rules/multiline-comment-style.js +0 -1
  108. package/lib/rules/multiline-ternary.js +0 -1
  109. package/lib/rules/new-cap.js +2 -2
  110. package/lib/rules/new-parens.js +0 -1
  111. package/lib/rules/newline-after-var.js +4 -5
  112. package/lib/rules/newline-before-return.js +2 -3
  113. package/lib/rules/newline-per-chained-call.js +1 -2
  114. package/lib/rules/no-alert.js +0 -1
  115. package/lib/rules/no-array-constructor.js +0 -1
  116. package/lib/rules/no-async-promise-executor.js +0 -1
  117. package/lib/rules/no-await-in-loop.js +0 -1
  118. package/lib/rules/no-bitwise.js +5 -6
  119. package/lib/rules/no-buffer-constructor.js +1 -1
  120. package/lib/rules/no-caller.js +0 -1
  121. package/lib/rules/no-case-declarations.js +0 -1
  122. package/lib/rules/no-catch-shadow.js +0 -1
  123. package/lib/rules/no-class-assign.js +0 -1
  124. package/lib/rules/no-compare-neg-zero.js +0 -1
  125. package/lib/rules/no-cond-assign.js +0 -1
  126. package/lib/rules/no-confusing-arrow.js +0 -1
  127. package/lib/rules/no-console.js +0 -1
  128. package/lib/rules/no-const-assign.js +0 -1
  129. package/lib/rules/no-constant-condition.js +0 -1
  130. package/lib/rules/no-constructor-return.js +0 -1
  131. package/lib/rules/no-continue.js +0 -1
  132. package/lib/rules/no-control-regex.js +0 -1
  133. package/lib/rules/no-debugger.js +0 -1
  134. package/lib/rules/no-delete-var.js +0 -1
  135. package/lib/rules/no-div-regex.js +0 -1
  136. package/lib/rules/no-dupe-args.js +0 -1
  137. package/lib/rules/no-dupe-class-members.js +0 -1
  138. package/lib/rules/no-dupe-else-if.js +0 -1
  139. package/lib/rules/no-dupe-keys.js +0 -2
  140. package/lib/rules/no-duplicate-case.js +0 -1
  141. package/lib/rules/no-duplicate-imports.js +0 -1
  142. package/lib/rules/no-else-return.js +0 -1
  143. package/lib/rules/no-empty-character-class.js +0 -1
  144. package/lib/rules/no-empty-function.js +0 -1
  145. package/lib/rules/no-empty-pattern.js +0 -1
  146. package/lib/rules/no-empty.js +0 -1
  147. package/lib/rules/no-eq-null.js +0 -1
  148. package/lib/rules/no-eval.js +0 -1
  149. package/lib/rules/no-ex-assign.js +0 -1
  150. package/lib/rules/no-extend-native.js +0 -1
  151. package/lib/rules/no-extra-bind.js +0 -1
  152. package/lib/rules/no-extra-boolean-cast.js +1 -1
  153. package/lib/rules/no-extra-label.js +0 -1
  154. package/lib/rules/no-extra-parens.js +0 -1
  155. package/lib/rules/no-extra-semi.js +0 -1
  156. package/lib/rules/no-fallthrough.js +0 -1
  157. package/lib/rules/no-floating-decimal.js +0 -1
  158. package/lib/rules/no-func-assign.js +0 -1
  159. package/lib/rules/no-global-assign.js +0 -1
  160. package/lib/rules/no-implicit-coercion.js +0 -1
  161. package/lib/rules/no-implicit-globals.js +0 -1
  162. package/lib/rules/no-implied-eval.js +0 -1
  163. package/lib/rules/no-import-assign.js +0 -1
  164. package/lib/rules/no-inline-comments.js +0 -1
  165. package/lib/rules/no-inner-declarations.js +0 -1
  166. package/lib/rules/no-invalid-regexp.js +0 -1
  167. package/lib/rules/no-invalid-this.js +0 -1
  168. package/lib/rules/no-irregular-whitespace.js +0 -1
  169. package/lib/rules/no-iterator.js +0 -1
  170. package/lib/rules/no-label-var.js +0 -1
  171. package/lib/rules/no-labels.js +0 -1
  172. package/lib/rules/no-lone-blocks.js +0 -1
  173. package/lib/rules/no-lonely-if.js +0 -1
  174. package/lib/rules/no-loop-func.js +1 -2
  175. package/lib/rules/no-loss-of-precision.js +0 -1
  176. package/lib/rules/no-magic-numbers.js +0 -1
  177. package/lib/rules/no-misleading-character-class.js +0 -1
  178. package/lib/rules/no-mixed-operators.js +1 -2
  179. package/lib/rules/no-mixed-requires.js +1 -1
  180. package/lib/rules/no-mixed-spaces-and-tabs.js +0 -1
  181. package/lib/rules/no-multi-assign.js +0 -1
  182. package/lib/rules/no-multi-spaces.js +0 -1
  183. package/lib/rules/no-multi-str.js +0 -1
  184. package/lib/rules/no-multiple-empty-lines.js +0 -1
  185. package/lib/rules/no-native-reassign.js +0 -1
  186. package/lib/rules/no-negated-condition.js +0 -1
  187. package/lib/rules/no-negated-in-lhs.js +0 -1
  188. package/lib/rules/no-nested-ternary.js +0 -1
  189. package/lib/rules/no-new-func.js +34 -7
  190. package/lib/rules/no-new-object.js +0 -1
  191. package/lib/rules/no-new-require.js +1 -1
  192. package/lib/rules/no-new-symbol.js +0 -1
  193. package/lib/rules/no-new-wrappers.js +0 -1
  194. package/lib/rules/no-new.js +0 -1
  195. package/lib/rules/no-nonoctal-decimal-escape.js +0 -1
  196. package/lib/rules/no-obj-calls.js +0 -1
  197. package/lib/rules/no-octal-escape.js +0 -1
  198. package/lib/rules/no-octal.js +0 -1
  199. package/lib/rules/no-param-reassign.js +0 -1
  200. package/lib/rules/no-path-concat.js +1 -1
  201. package/lib/rules/no-plusplus.js +0 -1
  202. package/lib/rules/no-process-env.js +1 -1
  203. package/lib/rules/no-process-exit.js +1 -1
  204. package/lib/rules/no-promise-executor-return.js +0 -1
  205. package/lib/rules/no-proto.js +0 -1
  206. package/lib/rules/no-prototype-builtins.js +0 -1
  207. package/lib/rules/no-redeclare.js +0 -1
  208. package/lib/rules/no-regex-spaces.js +0 -1
  209. package/lib/rules/no-restricted-exports.js +0 -1
  210. package/lib/rules/no-restricted-globals.js +1 -2
  211. package/lib/rules/no-restricted-imports.js +5 -6
  212. package/lib/rules/no-restricted-modules.js +3 -3
  213. package/lib/rules/no-restricted-properties.js +2 -3
  214. package/lib/rules/no-restricted-syntax.js +1 -2
  215. package/lib/rules/no-return-assign.js +0 -1
  216. package/lib/rules/no-return-await.js +0 -1
  217. package/lib/rules/no-script-url.js +1 -3
  218. package/lib/rules/no-self-assign.js +0 -1
  219. package/lib/rules/no-self-compare.js +0 -1
  220. package/lib/rules/no-sequences.js +0 -1
  221. package/lib/rules/no-setter-return.js +0 -1
  222. package/lib/rules/no-shadow-restricted-names.js +0 -1
  223. package/lib/rules/no-shadow.js +1 -2
  224. package/lib/rules/no-spaced-func.js +0 -1
  225. package/lib/rules/no-sparse-arrays.js +0 -1
  226. package/lib/rules/no-sync.js +1 -3
  227. package/lib/rules/no-tabs.js +0 -1
  228. package/lib/rules/no-template-curly-in-string.js +0 -1
  229. package/lib/rules/no-ternary.js +0 -1
  230. package/lib/rules/no-this-before-super.js +0 -1
  231. package/lib/rules/no-throw-literal.js +0 -1
  232. package/lib/rules/no-trailing-spaces.js +0 -1
  233. package/lib/rules/no-undef-init.js +9 -61
  234. package/lib/rules/no-undef.js +0 -1
  235. package/lib/rules/no-undefined.js +0 -1
  236. package/lib/rules/no-underscore-dangle.js +0 -1
  237. package/lib/rules/no-unexpected-multiline.js +0 -1
  238. package/lib/rules/no-unmodified-loop-condition.js +0 -1
  239. package/lib/rules/no-unneeded-ternary.js +0 -1
  240. package/lib/rules/no-unreachable-loop.js +0 -1
  241. package/lib/rules/no-unreachable.js +26 -25
  242. package/lib/rules/no-unsafe-finally.js +0 -1
  243. package/lib/rules/no-unsafe-negation.js +0 -1
  244. package/lib/rules/no-unsafe-optional-chaining.js +0 -1
  245. package/lib/rules/no-unused-expressions.js +4 -5
  246. package/lib/rules/no-unused-labels.js +0 -1
  247. package/lib/rules/no-unused-vars.js +26 -28
  248. package/lib/rules/no-use-before-define.js +0 -1
  249. package/lib/rules/no-useless-backreference.js +0 -1
  250. package/lib/rules/no-useless-call.js +0 -1
  251. package/lib/rules/no-useless-catch.js +0 -1
  252. package/lib/rules/no-useless-computed-key.js +1 -1
  253. package/lib/rules/no-useless-concat.js +0 -1
  254. package/lib/rules/no-useless-constructor.js +0 -1
  255. package/lib/rules/no-useless-escape.js +9 -9
  256. package/lib/rules/no-useless-rename.js +0 -1
  257. package/lib/rules/no-useless-return.js +0 -1
  258. package/lib/rules/no-var.js +0 -1
  259. package/lib/rules/no-void.js +0 -1
  260. package/lib/rules/no-warning-comments.js +0 -1
  261. package/lib/rules/no-whitespace-before-property.js +0 -1
  262. package/lib/rules/no-with.js +0 -1
  263. package/lib/rules/nonblock-statement-body-position.js +0 -1
  264. package/lib/rules/object-curly-newline.js +0 -1
  265. package/lib/rules/object-curly-spacing.js +0 -1
  266. package/lib/rules/object-property-newline.js +0 -1
  267. package/lib/rules/object-shorthand.js +3 -8
  268. package/lib/rules/one-var-declaration-per-line.js +0 -1
  269. package/lib/rules/one-var.js +1 -2
  270. package/lib/rules/operator-assignment.js +6 -7
  271. package/lib/rules/operator-linebreak.js +0 -1
  272. package/lib/rules/padded-blocks.js +1 -1
  273. package/lib/rules/padding-line-between-statements.js +0 -1
  274. package/lib/rules/prefer-arrow-callback.js +1 -1
  275. package/lib/rules/prefer-const.js +0 -1
  276. package/lib/rules/prefer-destructuring.js +1 -2
  277. package/lib/rules/prefer-exponentiation-operator.js +0 -1
  278. package/lib/rules/prefer-named-capture-group.js +0 -1
  279. package/lib/rules/prefer-numeric-literals.js +0 -1
  280. package/lib/rules/prefer-object-spread.js +0 -1
  281. package/lib/rules/prefer-promise-reject-errors.js +0 -1
  282. package/lib/rules/prefer-reflect.js +0 -1
  283. package/lib/rules/prefer-regex-literals.js +0 -1
  284. package/lib/rules/prefer-rest-params.js +0 -1
  285. package/lib/rules/prefer-spread.js +0 -1
  286. package/lib/rules/prefer-template.js +0 -1
  287. package/lib/rules/quote-props.js +8 -9
  288. package/lib/rules/quotes.js +0 -1
  289. package/lib/rules/radix.js +0 -1
  290. package/lib/rules/require-atomic-updates.js +24 -9
  291. package/lib/rules/require-await.js +0 -1
  292. package/lib/rules/require-jsdoc.js +1 -1
  293. package/lib/rules/require-unicode-regexp.js +0 -1
  294. package/lib/rules/require-yield.js +0 -1
  295. package/lib/rules/rest-spread-spacing.js +0 -1
  296. package/lib/rules/semi-spacing.js +0 -1
  297. package/lib/rules/semi-style.js +0 -1
  298. package/lib/rules/semi.js +66 -6
  299. package/lib/rules/sort-imports.js +0 -1
  300. package/lib/rules/sort-keys.js +0 -1
  301. package/lib/rules/sort-vars.js +0 -1
  302. package/lib/rules/space-before-blocks.js +14 -3
  303. package/lib/rules/space-before-function-paren.js +0 -1
  304. package/lib/rules/space-in-parens.js +0 -1
  305. package/lib/rules/space-infix-ops.js +0 -1
  306. package/lib/rules/space-unary-ops.js +0 -1
  307. package/lib/rules/spaced-comment.js +0 -1
  308. package/lib/rules/strict.js +0 -1
  309. package/lib/rules/switch-colon-spacing.js +1 -14
  310. package/lib/rules/symbol-description.js +0 -1
  311. package/lib/rules/template-curly-spacing.js +0 -1
  312. package/lib/rules/template-tag-spacing.js +0 -1
  313. package/lib/rules/unicode-bom.js +0 -1
  314. package/lib/rules/use-isnan.js +0 -1
  315. package/lib/rules/utils/ast-utils.js +29 -7
  316. package/lib/rules/utils/lazy-loading-rule-map.js +3 -3
  317. package/lib/rules/valid-jsdoc.js +1 -1
  318. package/lib/rules/valid-typeof.js +0 -1
  319. package/lib/rules/vars-on-top.js +1 -2
  320. package/lib/rules/wrap-iife.js +0 -1
  321. package/lib/rules/wrap-regex.js +0 -1
  322. package/lib/rules/yield-star-spacing.js +0 -1
  323. package/lib/rules/yoda.js +0 -1
  324. package/lib/shared/ajv.js +1 -1
  325. package/lib/shared/config-validator.js +10 -5
  326. package/lib/shared/logging.js +1 -1
  327. package/lib/shared/relative-module-resolver.js +1 -0
  328. package/lib/shared/runtime-info.js +3 -0
  329. package/lib/shared/traverser.js +2 -2
  330. package/lib/shared/types.js +2 -2
  331. package/lib/source-code/source-code.js +11 -5
  332. package/lib/source-code/token-store/cursor.js +1 -1
  333. package/package.json +5 -5
package/README.md CHANGED
@@ -123,7 +123,7 @@ Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [confi
123
123
 
124
124
  ### What ECMAScript versions does ESLint support?
125
125
 
126
- ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, and 2020. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/user-guide/configuring).
126
+ ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021 and 2022. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/user-guide/configuring).
127
127
 
128
128
  ### What about experimental features?
129
129
 
@@ -296,9 +296,9 @@ The following companies, organizations, and individuals support ESLint's ongoing
296
296
  <!--sponsorsstart-->
297
297
  <h3>Platinum Sponsors</h3>
298
298
  <p><a href="https://automattic.com"><img src="https://images.opencollective.com/photomatt/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
299
- <p><a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="96"></a> <a href="https://google.com/chrome"><img src="https://images.opencollective.com/chrome/dc55bd4/logo.png" alt="Chrome's Web Framework & Tools Performance Fund" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://coinbase.com"><img src="https://avatars.githubusercontent.com/u/1885080?v=4" alt="Coinbase" height="96"></a> <a href="https://substack.com/"><img src="https://avatars.githubusercontent.com/u/53023767?v=4" alt="Substack" height="96"></a></p><h3>Silver Sponsors</h3>
300
- <p><a href="https://retool.com/"><img src="https://images.opencollective.com/retool/98ea68e/logo.png" alt="Retool" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a></p><h3>Bronze Sponsors</h3>
301
- <p><a href="https://troypoint.com"><img src="https://images.opencollective.com/troypoint/080f96f/avatar.png" alt="TROYPOINT" height="32"></a> <a href="https://mobilen.nu"><img src="https://images.opencollective.com/mobilen/e19860d/logo.png" alt="Mobilen" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a> <a href="https://www.practiceignition.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Practice Ignition" height="32"></a></p>
299
+ <p><a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="96"></a> <a href="https://google.com/chrome"><img src="https://images.opencollective.com/chrome/dc55bd4/logo.png" alt="Chrome's Web Framework & Tools Performance Fund" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://coinbase.com"><img src="https://avatars.githubusercontent.com/u/1885080?v=4" alt="Coinbase" height="96"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="96"></a> <a href="https://substack.com/"><img src="https://avatars.githubusercontent.com/u/53023767?v=4" alt="Substack" height="96"></a></p><h3>Silver Sponsors</h3>
300
+ <p><a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a></p><h3>Bronze Sponsors</h3>
301
+ <p><a href="https://launchdarkly.com"><img src="https://images.opencollective.com/launchdarkly/574bb9e/logo.png" alt="launchdarkly" height="32"></a> <a href="https://troypoint.com"><img src="https://images.opencollective.com/troypoint/080f96f/avatar.png" alt="TROYPOINT" height="32"></a> <a href="https://mobilen.nu"><img src="https://images.opencollective.com/mobilen/e19860d/logo.png" alt="Mobilen" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a> <a href="https://www.practiceignition.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Practice Ignition" height="32"></a></p>
302
302
  <!--sponsorsend-->
303
303
 
304
304
  ## <a name="technology-sponsors"></a>Technology Sponsors
package/bin/eslint.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * @author Nicholas C. Zakas
6
6
  */
7
7
 
8
- /* eslint no-console:off */
8
+ /* eslint no-console:off -- CLI */
9
9
 
10
10
  "use strict";
11
11
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  "use strict";
8
8
 
9
- /* eslint sort-keys: ["error", "asc"] */
9
+ /* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */
10
10
 
11
11
  /** @type {import("../lib/shared/types").ConfigData} */
12
12
  module.exports = {
@@ -1,11 +1,8 @@
1
1
  {
2
- "categories": [
3
- { "name": "Possible Errors", "description": "These rules relate to possible syntax or logic errors in JavaScript code:" },
4
- { "name": "Best Practices", "description": "These rules relate to better ways of doing things to help you avoid problems:" },
5
- { "name": "Strict Mode", "description": "These rules relate to strict mode directives:" },
6
- { "name": "Variables", "description": "These rules relate to variable declarations:" },
7
- { "name": "Stylistic Issues", "description": "These rules relate to style guidelines, and are therefore quite subjective:" },
8
- { "name": "ECMAScript 6", "description": "These rules relate to ES6, also known as ES2015:" }
2
+ "types": [
3
+ { "name": "problem", "displayName": "Possible Problems", "description": "These rules relate to possible logic errors in code:" },
4
+ { "name": "suggestion", "displayName": "Suggestions", "description": "These rules suggest alternate ways of doing things:" },
5
+ { "name": "layout", "displayName": "Layout & Formatting", "description": "These rules care about how the code looks rather than how it executes:" }
9
6
  ],
10
7
  "deprecated": {
11
8
  "name": "Deprecated",
@@ -55,8 +55,8 @@ const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
55
55
  /** @typedef {import("../shared/types").Plugin} Plugin */
56
56
  /** @typedef {import("../shared/types").RuleConf} RuleConf */
57
57
  /** @typedef {import("../shared/types").Rule} Rule */
58
- /** @typedef {ReturnType<CascadingConfigArrayFactory["getConfigArrayForFile"]>} ConfigArray */
59
- /** @typedef {ReturnType<ConfigArray["extractConfig"]>} ExtractedConfig */
58
+ /** @typedef {ReturnType<CascadingConfigArrayFactory.getConfigArrayForFile>} ConfigArray */
59
+ /** @typedef {ReturnType<ConfigArray.extractConfig>} ExtractedConfig */
60
60
 
61
61
  /**
62
62
  * The options to configure a CLI engine with.
@@ -280,7 +280,7 @@ function verifyText({
280
280
  /**
281
281
  * Returns result with warning by ignore settings
282
282
  * @param {string} filePath File path of checked code
283
- * @param {string} baseDir Absolute path of base directory
283
+ * @param {string} baseDir Absolute path of base directory
284
284
  * @returns {LintResult} Result with single warning
285
285
  * @private
286
286
  */
@@ -480,6 +480,7 @@ function getCacheFile(cacheFile, cwd) {
480
480
  * @param {string[]|null} keys The keys to assign true.
481
481
  * @param {boolean} defaultValue The default value for each property.
482
482
  * @param {string} displayName The property name which is used in error message.
483
+ * @throws {Error} Requires array.
483
484
  * @returns {Record<string,boolean>} The boolean map.
484
485
  */
485
486
  function toBooleanMap(keys, defaultValue, displayName) {
@@ -543,6 +544,7 @@ function createConfigDataFromOptions(options) {
543
544
  /**
544
545
  * Checks whether a directory exists at the given location
545
546
  * @param {string} resolvedPath A path from the CWD
547
+ * @throws {Error} As thrown by `fs.statSync` or `fs.isDirectory`.
546
548
  * @returns {boolean} `true` if a directory exists
547
549
  */
548
550
  function directoryExists(resolvedPath) {
@@ -560,6 +562,9 @@ function directoryExists(resolvedPath) {
560
562
  // Public Interface
561
563
  //------------------------------------------------------------------------------
562
564
 
565
+ /**
566
+ * Core CLI.
567
+ */
563
568
  class CLIEngine {
564
569
 
565
570
  /**
@@ -742,6 +747,7 @@ class CLIEngine {
742
747
  /**
743
748
  * Executes the current configuration on an array of file and directory names.
744
749
  * @param {string[]} patterns An array of file and directory names.
750
+ * @throws {Error} As may be thrown by `fs.unlinkSync`.
745
751
  * @returns {LintReport} The results for all files that were linted.
746
752
  */
747
753
  executeOnFiles(patterns) {
@@ -948,6 +954,7 @@ class CLIEngine {
948
954
  * This is the same logic used by the ESLint CLI executable to determine
949
955
  * configuration for each file it processes.
950
956
  * @param {string} filePath The path of the file to retrieve a config object for.
957
+ * @throws {Error} If filepath a directory path.
951
958
  * @returns {ConfigData} A configuration object for the file.
952
959
  */
953
960
  getConfigForFile(filePath) {
@@ -996,6 +1003,7 @@ class CLIEngine {
996
1003
  * Returns the formatter representing the given format or null if the `format` is not a string.
997
1004
  * @param {string} [format] The name of the format to load or the path to a
998
1005
  * custom formatter.
1006
+ * @throws {any} As may be thrown by requiring of formatter
999
1007
  * @returns {(Function|null)} The formatter function or null if the `format` is not a string.
1000
1008
  */
1001
1009
  getFormatter(format) {
@@ -60,7 +60,7 @@ const IGNORED_SILENTLY = 1;
60
60
  const IGNORED = 2;
61
61
 
62
62
  // For VSCode intellisense
63
- /** @typedef {ReturnType<CascadingConfigArrayFactory["getConfigArrayForFile"]>} ConfigArray */
63
+ /** @typedef {ReturnType<CascadingConfigArrayFactory.getConfigArrayForFile>} ConfigArray */
64
64
 
65
65
  /**
66
66
  * @typedef {Object} FileEnumeratorOptions
@@ -114,6 +114,7 @@ function isGlobPattern(pattern) {
114
114
  /**
115
115
  * Get stats of a given path.
116
116
  * @param {string} filePath The path to target file.
117
+ * @throws {Error} As may be thrown by `fs.statSync`.
117
118
  * @returns {fs.Stats|null} The stats.
118
119
  * @private
119
120
  */
@@ -132,6 +133,7 @@ function statSafeSync(filePath) {
132
133
  /**
133
134
  * Get filenames in a given path to a directory.
134
135
  * @param {string} directoryPath The path to target directory.
136
+ * @throws {Error} As may be thrown by `fs.readdirSync`.
135
137
  * @returns {import("fs").Dirent[]} The filenames.
136
138
  * @private
137
139
  */
@@ -173,7 +175,6 @@ function createExtensionRegExp(extensions) {
173
175
  */
174
176
  class NoFilesFoundError extends Error {
175
177
 
176
- // eslint-disable-next-line jsdoc/require-description
177
178
  /**
178
179
  * @param {string} pattern The glob pattern which was not found.
179
180
  * @param {boolean} globDisabled If `true` then the pattern was a glob pattern, but glob was disabled.
@@ -190,7 +191,6 @@ class NoFilesFoundError extends Error {
190
191
  */
191
192
  class AllFilesIgnoredError extends Error {
192
193
 
193
- // eslint-disable-next-line jsdoc/require-description
194
194
  /**
195
195
  * @param {string} pattern The glob pattern which was not found.
196
196
  */
@@ -270,6 +270,7 @@ class FileEnumerator {
270
270
  /**
271
271
  * Iterate files which are matched by given glob patterns.
272
272
  * @param {string|string[]} patternOrPatterns The glob patterns to iterate files.
273
+ * @throws {NoFilesFoundError|AllFilesIgnoredError} On an unmatched pattern.
273
274
  * @returns {IterableIterator<FileAndConfig>} The found files.
274
275
  */
275
276
  *iterateFiles(patternOrPatterns) {
@@ -281,8 +281,8 @@ function resultTemplate(it) {
281
281
  `.trimLeft();
282
282
  }
283
283
 
284
- // eslint-disable-next-line jsdoc/require-description
285
284
  /**
285
+ * Render the results.
286
286
  * @param {Array} results Test results.
287
287
  * @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis.
288
288
  * @returns {string} HTML string describing the results.
@@ -21,8 +21,8 @@ const murmur = require("imurmurhash");
21
21
 
22
22
  /**
23
23
  * hash the given string
24
- * @param {string} str the string to hash
25
- * @returns {string} the hash
24
+ * @param {string} str the string to hash
25
+ * @returns {string} the hash
26
26
  */
27
27
  function hash(str) {
28
28
  return murmur(str).result().toString(36);
@@ -15,7 +15,7 @@
15
15
  * @private
16
16
  */
17
17
  module.exports = function(s) {
18
- return (`${s}`).replace(/[<>&"'\x00-\x1F\x7F\u0080-\uFFFF]/gu, c => { // eslint-disable-line no-control-regex
18
+ return (`${s}`).replace(/[<>&"'\x00-\x1F\x7F\u0080-\uFFFF]/gu, c => { // eslint-disable-line no-control-regex -- Converting controls to entities
19
19
  switch (c) {
20
20
  case "<":
21
21
  return "&lt;";
@@ -61,7 +61,7 @@ class FlatConfigArray extends ConfigArray {
61
61
  this.unshift(baseConfig);
62
62
  }
63
63
 
64
- /* eslint-disable class-methods-use-this */
64
+ /* eslint-disable class-methods-use-this -- Desired as instance method */
65
65
  /**
66
66
  * Replaces a config with another config to allow us to put strings
67
67
  * in the config array that will be replaced by objects before
@@ -118,7 +118,7 @@ class FlatConfigArray extends ConfigArray {
118
118
 
119
119
  return config;
120
120
  }
121
- /* eslint-enable class-methods-use-this */
121
+ /* eslint-enable class-methods-use-this -- Desired as instance method */
122
122
 
123
123
  }
124
124
 
@@ -336,7 +336,7 @@ const rulesSchema = {
336
336
  // avoid hairy edge case
337
337
  if (ruleId === "__proto__") {
338
338
 
339
- /* eslint-disable-next-line no-proto */
339
+ /* eslint-disable-next-line no-proto -- Though deprecated, may still be present */
340
340
  delete result.__proto__;
341
341
  continue;
342
342
  }
@@ -19,6 +19,7 @@ const ajv = require("../shared/ajv")();
19
19
  * Finds a rule with the given ID in the given config.
20
20
  * @param {string} ruleId The ID of the rule to find.
21
21
  * @param {Object} config The config to search in.
22
+ * @throws {TypeError} For missing plugin or rule.
22
23
  * @returns {{create: Function, schema: (Array|null)}} THe rule object.
23
24
  */
24
25
  function findRuleDefinition(ruleId, config) {
@@ -34,16 +35,33 @@ function findRuleDefinition(ruleId, config) {
34
35
  pluginName = ruleIdParts.join("/");
35
36
  }
36
37
 
37
- if (!config.plugins || !config.plugins[pluginName]) {
38
- throw new TypeError(`Key "rules": Key "${ruleId}": Could not find plugin "${pluginName}".`);
39
- }
38
+ const errorMessageHeader = `Key "rules": Key "${ruleId}"`;
39
+ let errorMessage = `${errorMessageHeader}: Could not find plugin "${pluginName}".`;
40
40
 
41
- if (!config.plugins[pluginName].rules || !config.plugins[pluginName].rules[ruleName]) {
42
- throw new TypeError(`Key "rules": Key "${ruleId}": Could not find "${ruleName}" in plugin "${pluginName}".`);
43
- }
41
+ // if the plugin exists then we need to check if the rule exists
42
+ if (config.plugins && config.plugins[pluginName]) {
43
+
44
+ const plugin = config.plugins[pluginName];
45
+
46
+ // first check for exact rule match
47
+ if (plugin.rules && plugin.rules[ruleName]) {
48
+ return config.plugins[pluginName].rules[ruleName];
49
+ }
44
50
 
45
- return config.plugins[pluginName].rules[ruleName];
51
+ errorMessage = `${errorMessageHeader}: Could not find "${ruleName}" in plugin "${pluginName}".`;
52
+
53
+ // otherwise, let's see if we can find the rule name elsewhere
54
+ for (const [otherPluginName, otherPlugin] of Object.entries(config.plugins)) {
55
+ if (otherPlugin.rules && otherPlugin.rules[ruleName]) {
56
+ errorMessage += ` Did you mean "${otherPluginName}/${ruleName}"?`;
57
+ break;
58
+ }
59
+ }
60
+
61
+ // falls through to throw error
62
+ }
46
63
 
64
+ throw new TypeError(errorMessage);
47
65
  }
48
66
 
49
67
  /**
@@ -98,7 +116,6 @@ class RuleValidator {
98
116
  * A collection of compiled validators for rules that have already
99
117
  * been validated.
100
118
  * @type {WeakMap}
101
- * @property validators
102
119
  */
103
120
  this.validators = new WeakMap();
104
121
  }
@@ -151,6 +151,7 @@ class ESLintInvalidOptionsError extends Error {
151
151
  /**
152
152
  * Validates and normalizes options for the wrapped CLIEngine instance.
153
153
  * @param {ESLintOptions} options The options to process.
154
+ * @throws {ESLintInvalidOptionsError} If of any of a variety of type errors.
154
155
  * @returns {ESLintOptions} The normalized options.
155
156
  */
156
157
  function processOptions({
@@ -421,6 +422,9 @@ function compareResultsByFilePath(a, b) {
421
422
  return 0;
422
423
  }
423
424
 
425
+ /**
426
+ * Main API.
427
+ */
424
428
  class ESLint {
425
429
 
426
430
  /**
@@ -36,9 +36,9 @@ const MAX_CONFIG_COMBINATIONS = 17, // 16 combinations + 1 for severity only
36
36
  /**
37
37
  * Information about a rule configuration, in the context of a Registry.
38
38
  * @typedef {Object} registryItem
39
- * @param {ruleConfig} config A valid configuration for the rule
40
- * @param {number} specificity The number of elements in the ruleConfig array
41
- * @param {number} errorCount The number of errors encountered when linting with the config
39
+ * @property {ruleConfig} config A valid configuration for the rule
40
+ * @property {number} specificity The number of elements in the ruleConfig array
41
+ * @property {number} errorCount The number of errors encountered when linting with the config
42
42
  */
43
43
 
44
44
  /**
@@ -49,8 +49,8 @@ const MAX_CONFIG_COMBINATIONS = 17, // 16 combinations + 1 for severity only
49
49
 
50
50
  /**
51
51
  * Create registryItems for rules
52
- * @param {rulesConfig} rulesConfig Hash of rule names and arrays of ruleConfig items
53
- * @returns {Object} registryItems for each rule in provided rulesConfig
52
+ * @param {rulesConfig} rulesConfig Hash of rule names and arrays of ruleConfig items
53
+ * @returns {Object} registryItems for each rule in provided rulesConfig
54
54
  */
55
55
  function makeRegistryItems(rulesConfig) {
56
56
  return Object.keys(rulesConfig).reduce((accumulator, ruleId) => {
@@ -73,7 +73,6 @@ function makeRegistryItems(rulesConfig) {
73
73
  */
74
74
  class Registry {
75
75
 
76
- // eslint-disable-next-line jsdoc/require-description
77
76
  /**
78
77
  * @param {rulesConfig} [rulesConfig] Hash of rule names and arrays of possible configurations
79
78
  */
@@ -104,7 +103,7 @@ class Registry {
104
103
  * configurations.
105
104
  *
106
105
  * The length of the returned array will be <= MAX_CONFIG_COMBINATIONS.
107
- * @returns {Object[]} "rules" configurations to use for linting
106
+ * @returns {Object[]} "rules" configurations to use for linting
108
107
  */
109
108
  buildRuleSets() {
110
109
  let idx = 0;
@@ -116,7 +115,7 @@ class Registry {
116
115
  *
117
116
  * This is broken out into its own function so that it doesn't need to be
118
117
  * created inside of the while loop.
119
- * @param {string} rule The ruleId to add.
118
+ * @param {string} rule The ruleId to add.
120
119
  * @returns {void}
121
120
  */
122
121
  const addRuleToRuleSet = function(rule) {
@@ -203,7 +202,7 @@ class Registry {
203
202
  * Creates a registry of rules which had no error-free configs.
204
203
  * The new registry is intended to be analyzed to determine whether its rules
205
204
  * should be disabled or set to warning.
206
- * @returns {Registry} A registry of failing rules.
205
+ * @returns {Registry} A registry of failing rules.
207
206
  */
208
207
  getFailingRulesRegistry() {
209
208
  const ruleIds = Object.keys(this.rules),
@@ -240,8 +239,8 @@ class Registry {
240
239
 
241
240
  /**
242
241
  * Return a cloned registry containing only configs with a desired specificity
243
- * @param {number} specificity Only keep configs with this specificity
244
- * @returns {Registry} A registry of rules
242
+ * @param {number} specificity Only keep configs with this specificity
243
+ * @returns {Registry} A registry of rules
245
244
  */
246
245
  filterBySpecificity(specificity) {
247
246
  const ruleIds = Object.keys(this.rules),
@@ -257,10 +256,10 @@ class Registry {
257
256
 
258
257
  /**
259
258
  * Lint SourceCodes against all configurations in the registry, and record results
260
- * @param {Object[]} sourceCodes SourceCode objects for each filename
261
- * @param {Object} config ESLint config object
262
- * @param {progressCallback} [cb] Optional callback for reporting execution status
263
- * @returns {Registry} New registry with errorCount populated
259
+ * @param {Object[]} sourceCodes SourceCode objects for each filename
260
+ * @param {Object} config ESLint config object
261
+ * @param {progressCallback} [cb] Optional callback for reporting execution status
262
+ * @returns {Registry} New registry with errorCount populated
264
263
  */
265
264
  lintSourceCode(sourceCodes, config, cb) {
266
265
  let lintedRegistry = new Registry();
@@ -305,7 +304,7 @@ class Registry {
305
304
  ruleSetIdx += 1;
306
305
 
307
306
  if (cb) {
308
- cb(totalFilesLinting); // eslint-disable-line node/callback-return
307
+ cb(totalFilesLinting); // eslint-disable-line node/callback-return -- End of function
309
308
  }
310
309
  });
311
310
 
@@ -322,8 +321,8 @@ class Registry {
322
321
  *
323
322
  * This will return a new config with `["extends": [ ..., "eslint:recommended"]` and
324
323
  * only the rules which have configurations different from the recommended config.
325
- * @param {Object} config config object
326
- * @returns {Object} config object using `"extends": ["eslint:recommended"]`
324
+ * @param {Object} config config object
325
+ * @returns {Object} config object using `"extends": ["eslint:recommended"]`
327
326
  */
328
327
  function extendFromRecommended(config) {
329
328
  const newConfig = Object.assign({}, config);
@@ -23,9 +23,9 @@ const debug = require("debug")("eslint:config-file");
23
23
  * Determines sort order for object keys for json-stable-stringify
24
24
  *
25
25
  * see: https://github.com/samn/json-stable-stringify#cmp
26
- * @param {Object} a The first comparison object ({key: akey, value: avalue})
27
- * @param {Object} b The second comparison object ({key: bkey, value: bvalue})
28
- * @returns {number} 1 or -1, used in stringify cmp method
26
+ * @param {Object} a The first comparison object ({key: akey, value: avalue})
27
+ * @param {Object} b The second comparison object ({key: bkey, value: bvalue})
28
+ * @returns {number} 1 or -1, used in stringify cmp method
29
29
  */
30
30
  function sortByKey(a, b) {
31
31
  return a.key > b.key ? 1 : -1;
@@ -102,8 +102,8 @@ getPeerDependencies.cache = new Map();
102
102
 
103
103
  /**
104
104
  * Return necessary plugins, configs, parsers, etc. based on the config
105
- * @param {Object} config config object
106
- * @param {boolean} [installESLint=true] If `false` is given, it does not install eslint.
105
+ * @param {Object} config config object
106
+ * @param {boolean} [installESLint=true] If `false` is given, it does not install eslint.
107
107
  * @returns {string[]} An array of modules to be installed.
108
108
  */
109
109
  function getModulesList(config, installESLint) {
@@ -161,9 +161,10 @@ function getModulesList(config, installESLint) {
161
161
  *
162
162
  * Note: This clones the config object and returns a new config to avoid mutating
163
163
  * the original config parameter.
164
- * @param {Object} answers answers received from enquirer
165
- * @param {Object} config config object
166
- * @returns {Object} config object with configured rules
164
+ * @param {Object} answers answers received from enquirer
165
+ * @param {Object} config config object
166
+ * @throws {Error} If source code retrieval fails or source code file count is 0.
167
+ * @returns {Object} config object with configured rules
167
168
  */
168
169
  function configureRules(answers, config) {
169
170
  const BAR_TOTAL = 20,
@@ -415,7 +416,7 @@ function hasESLintVersionConflict(answers) {
415
416
 
416
417
  /**
417
418
  * Install modules.
418
- * @param {string[]} modules Modules to be installed.
419
+ * @param {string[]} modules Modules to be installed.
419
420
  * @returns {void}
420
421
  */
421
422
  function installModules(modules) {
@@ -426,9 +427,9 @@ function installModules(modules) {
426
427
  /* istanbul ignore next: no need to test enquirer */
427
428
  /**
428
429
  * Ask user to install modules.
429
- * @param {string[]} modules Array of modules to be installed.
430
- * @param {boolean} packageJsonExists Indicates if package.json is existed.
431
- * @returns {Promise} Answer that indicates if user wants to install.
430
+ * @param {string[]} modules Array of modules to be installed.
431
+ * @param {boolean} packageJsonExists Indicates if package.json is existed.
432
+ * @returns {Promise<void>} Answer that indicates if user wants to install.
432
433
  */
433
434
  function askInstallModules(modules, packageJsonExists) {
434
435
 
@@ -464,7 +465,7 @@ function askInstallModules(modules, packageJsonExists) {
464
465
  /* istanbul ignore next: no need to test enquirer */
465
466
  /**
466
467
  * Ask use a few questions on command prompt
467
- * @returns {Promise} The promise with the result of the prompt
468
+ * @returns {Promise<void>} The promise with the result of the prompt
468
469
  */
469
470
  function promptUser() {
470
471
 
@@ -17,8 +17,8 @@ const builtInRules = require("../rules");
17
17
 
18
18
  /**
19
19
  * Wrap all of the elements of an array into arrays.
20
- * @param {*[]} xs Any array.
21
- * @returns {Array[]} An array of arrays.
20
+ * @param {*[]} xs Any array.
21
+ * @returns {Array[]} An array of arrays.
22
22
  */
23
23
  function explodeArray(xs) {
24
24
  return xs.reduce((accumulator, x) => {
@@ -33,9 +33,9 @@ function explodeArray(xs) {
33
33
  *
34
34
  * For example:
35
35
  * combineArrays([a, [b, c]], [x, y]); // -> [[a, x], [a, y], [b, c, x], [b, c, y]]
36
- * @param {Array} arr1 The first array to combine.
37
- * @param {Array} arr2 The second array to combine.
38
- * @returns {Array} A mixture of the elements of the first and second arrays.
36
+ * @param {Array} arr1 The first array to combine.
37
+ * @param {Array} arr2 The second array to combine.
38
+ * @returns {Array} A mixture of the elements of the first and second arrays.
39
39
  */
40
40
  function combineArrays(arr1, arr2) {
41
41
  const res = [];
@@ -70,8 +70,8 @@ function combineArrays(arr1, arr2) {
70
70
  * [{before: true}, {before: false}],
71
71
  * [{after: true}, {after: false}]
72
72
  * ]
73
- * @param {Object[]} objects Array of objects, each with one property/value pair
74
- * @returns {Array[]} Array of arrays of objects grouped by property
73
+ * @param {Object[]} objects Array of objects, each with one property/value pair
74
+ * @returns {Array[]} Array of arrays of objects grouped by property
75
75
  */
76
76
  function groupByProperty(objects) {
77
77
  const groupedObj = objects.reduce((accumulator, obj) => {
@@ -97,7 +97,7 @@ function groupByProperty(objects) {
97
97
  * Configs may also have one or more additional elements to specify rule
98
98
  * configuration or options.
99
99
  * @typedef {Array|number} ruleConfig
100
- * @param {number} 0 The rule's severity (0, 1, 2).
100
+ * @param {number} 0 The rule's severity (0, 1, 2).
101
101
  */
102
102
 
103
103
  /**
@@ -131,9 +131,9 @@ function groupByProperty(objects) {
131
131
  * {before: false, after: true},
132
132
  * {before: false, after: false}
133
133
  * ]
134
- * @param {Object[]} objArr1 Single key/value objects, all with the same key
135
- * @param {Object[]} objArr2 Single key/value objects, all with another key
136
- * @returns {Object[]} Combined objects for each combination of input properties and values
134
+ * @param {Object[]} objArr1 Single key/value objects, all with the same key
135
+ * @param {Object[]} objArr2 Single key/value objects, all with another key
136
+ * @returns {Object[]} Combined objects for each combination of input properties and values
137
137
  */
138
138
  function combinePropertyObjects(objArr1, objArr2) {
139
139
  const res = [];
@@ -174,7 +174,6 @@ function combinePropertyObjects(objArr1, objArr2) {
174
174
  */
175
175
  class RuleConfigSet {
176
176
 
177
- // eslint-disable-next-line jsdoc/require-description
178
177
  /**
179
178
  * @param {ruleConfig[]} configs Valid rule configurations
180
179
  */
@@ -206,7 +205,7 @@ class RuleConfigSet {
206
205
 
207
206
  /**
208
207
  * Add rule configs from an array of strings (schema enums)
209
- * @param {string[]} enums Array of valid rule options (e.g. ["always", "never"])
208
+ * @param {string[]} enums Array of valid rule options (e.g. ["always", "never"])
210
209
  * @returns {void}
211
210
  */
212
211
  addEnums(enums) {
@@ -215,7 +214,7 @@ class RuleConfigSet {
215
214
 
216
215
  /**
217
216
  * Add rule configurations from a schema object
218
- * @param {Object} obj Schema item with type === "object"
217
+ * @param {Object} obj Schema item with type === "object"
219
218
  * @returns {boolean} true if at least one schema for the object could be generated, false otherwise
220
219
  */
221
220
  addObject(obj) {
@@ -260,8 +259,8 @@ class RuleConfigSet {
260
259
 
261
260
  /**
262
261
  * Generate valid rule configurations based on a schema object
263
- * @param {Object} schema A rule's schema object
264
- * @returns {Array[]} Valid rule configurations
262
+ * @param {Object} schema A rule's schema object
263
+ * @returns {Array[]} Valid rule configurations
265
264
  */
266
265
  function generateConfigsFromSchema(schema) {
267
266
  const configSet = new RuleConfigSet();