eslint 6.3.0 → 6.6.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 (189) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/README.md +11 -10
  3. package/bin/eslint.js +38 -12
  4. package/lib/cli-engine/cascading-config-array-factory.js +2 -1
  5. package/lib/cli-engine/cli-engine.js +11 -11
  6. package/lib/cli-engine/config-array/config-array.js +0 -4
  7. package/lib/cli-engine/config-array/config-dependency.js +2 -0
  8. package/lib/cli-engine/config-array/override-tester.js +4 -2
  9. package/lib/cli-engine/config-array-factory.js +7 -1
  10. package/lib/cli-engine/file-enumerator.js +5 -3
  11. package/lib/cli-engine/formatters/html.js +1 -0
  12. package/lib/cli-engine/ignored-paths.js +4 -3
  13. package/lib/cli-engine/lint-result-cache.js +0 -1
  14. package/lib/cli.js +13 -12
  15. package/lib/init/autoconfig.js +1 -11
  16. package/lib/init/config-file.js +0 -1
  17. package/lib/init/config-initializer.js +0 -1
  18. package/lib/init/config-rule.js +3 -7
  19. package/lib/init/npm-utils.js +1 -6
  20. package/lib/linter/code-path-analysis/code-path-analyzer.js +24 -38
  21. package/lib/linter/code-path-analysis/code-path-segment.js +17 -25
  22. package/lib/linter/code-path-analysis/code-path-state.js +40 -81
  23. package/lib/linter/code-path-analysis/code-path.js +10 -11
  24. package/lib/linter/code-path-analysis/debug-helpers.js +9 -13
  25. package/lib/linter/code-path-analysis/fork-context.js +23 -34
  26. package/lib/linter/code-path-analysis/id-generator.js +2 -2
  27. package/lib/linter/linter.js +121 -96
  28. package/lib/linter/node-event-generator.js +3 -2
  29. package/lib/options.js +6 -0
  30. package/lib/rule-tester/rule-tester.js +7 -10
  31. package/lib/rules/accessor-pairs.js +59 -19
  32. package/lib/rules/array-bracket-newline.js +12 -15
  33. package/lib/rules/array-bracket-spacing.js +12 -12
  34. package/lib/rules/array-callback-return.js +6 -11
  35. package/lib/rules/array-element-newline.js +5 -8
  36. package/lib/rules/arrow-parens.js +0 -1
  37. package/lib/rules/block-scoped-var.js +3 -3
  38. package/lib/rules/block-spacing.js +4 -4
  39. package/lib/rules/capitalized-comments.js +2 -9
  40. package/lib/rules/class-methods-use-this.js +3 -3
  41. package/lib/rules/comma-dangle.js +15 -23
  42. package/lib/rules/comma-spacing.js +1 -1
  43. package/lib/rules/computed-property-spacing.js +28 -11
  44. package/lib/rules/consistent-return.js +4 -5
  45. package/lib/rules/consistent-this.js +5 -5
  46. package/lib/rules/constructor-super.js +14 -16
  47. package/lib/rules/curly.js +3 -5
  48. package/lib/rules/default-param-last.js +62 -0
  49. package/lib/rules/dot-location.js +11 -12
  50. package/lib/rules/eqeqeq.js +7 -19
  51. package/lib/rules/func-names.js +6 -6
  52. package/lib/rules/function-call-argument-newline.js +5 -5
  53. package/lib/rules/generator-star-spacing.js +4 -9
  54. package/lib/rules/getter-return.js +4 -7
  55. package/lib/rules/indent-legacy.js +1 -1
  56. package/lib/rules/indent.js +46 -8
  57. package/lib/rules/index.js +3 -0
  58. package/lib/rules/init-declarations.js +2 -2
  59. package/lib/rules/jsx-quotes.js +1 -1
  60. package/lib/rules/keyword-spacing.js +32 -56
  61. package/lib/rules/lines-around-directive.js +1 -1
  62. package/lib/rules/max-len.js +0 -5
  63. package/lib/rules/max-statements-per-line.js +3 -7
  64. package/lib/rules/multiline-ternary.js +3 -3
  65. package/lib/rules/new-parens.js +5 -1
  66. package/lib/rules/newline-after-var.js +6 -7
  67. package/lib/rules/newline-before-return.js +8 -9
  68. package/lib/rules/newline-per-chained-call.js +2 -4
  69. package/lib/rules/no-class-assign.js +2 -2
  70. package/lib/rules/no-compare-neg-zero.js +1 -2
  71. package/lib/rules/no-confusing-arrow.js +2 -2
  72. package/lib/rules/no-console.js +4 -8
  73. package/lib/rules/no-const-assign.js +1 -1
  74. package/lib/rules/no-dupe-args.js +1 -1
  75. package/lib/rules/no-dupe-class-members.js +3 -4
  76. package/lib/rules/no-dupe-keys.js +6 -5
  77. package/lib/rules/no-duplicate-imports.js +14 -18
  78. package/lib/rules/no-else-return.js +0 -8
  79. package/lib/rules/no-empty-function.js +2 -4
  80. package/lib/rules/no-eval.js +10 -18
  81. package/lib/rules/no-ex-assign.js +1 -1
  82. package/lib/rules/no-extra-bind.js +12 -13
  83. package/lib/rules/no-extra-boolean-cast.js +1 -3
  84. package/lib/rules/no-extra-label.js +13 -10
  85. package/lib/rules/no-extra-parens.js +32 -17
  86. package/lib/rules/no-extra-semi.js +5 -6
  87. package/lib/rules/no-fallthrough.js +6 -6
  88. package/lib/rules/no-func-assign.js +3 -3
  89. package/lib/rules/no-global-assign.js +4 -4
  90. package/lib/rules/no-implicit-coercion.js +10 -10
  91. package/lib/rules/no-implied-eval.js +0 -1
  92. package/lib/rules/no-import-assign.js +238 -0
  93. package/lib/rules/no-invalid-this.js +1 -3
  94. package/lib/rules/no-labels.js +3 -6
  95. package/lib/rules/no-lone-blocks.js +7 -2
  96. package/lib/rules/no-loop-func.js +6 -11
  97. package/lib/rules/no-magic-numbers.js +6 -6
  98. package/lib/rules/no-misleading-character-class.js +14 -7
  99. package/lib/rules/no-mixed-operators.js +13 -22
  100. package/lib/rules/no-mixed-requires.js +0 -1
  101. package/lib/rules/no-multi-spaces.js +1 -1
  102. package/lib/rules/no-native-reassign.js +4 -4
  103. package/lib/rules/no-obj-calls.js +29 -9
  104. package/lib/rules/no-octal-escape.js +14 -8
  105. package/lib/rules/no-param-reassign.js +28 -7
  106. package/lib/rules/no-redeclare.js +1 -1
  107. package/lib/rules/no-regex-spaces.js +105 -45
  108. package/lib/rules/no-restricted-imports.js +11 -11
  109. package/lib/rules/no-self-assign.js +18 -18
  110. package/lib/rules/no-sequences.js +5 -5
  111. package/lib/rules/no-shadow.js +1 -4
  112. package/lib/rules/no-tabs.js +8 -2
  113. package/lib/rules/no-this-before-super.js +12 -13
  114. package/lib/rules/no-trailing-spaces.js +19 -7
  115. package/lib/rules/no-undef-init.js +7 -1
  116. package/lib/rules/no-unmodified-loop-condition.js +16 -29
  117. package/lib/rules/no-unneeded-ternary.js +3 -3
  118. package/lib/rules/no-unreachable.js +7 -7
  119. package/lib/rules/no-unsafe-finally.js +4 -7
  120. package/lib/rules/no-unsafe-negation.js +34 -19
  121. package/lib/rules/no-unused-expressions.js +11 -7
  122. package/lib/rules/no-unused-labels.js +3 -6
  123. package/lib/rules/no-unused-vars.js +22 -29
  124. package/lib/rules/no-use-before-define.js +10 -15
  125. package/lib/rules/no-useless-call.js +4 -4
  126. package/lib/rules/no-useless-concat.js +4 -4
  127. package/lib/rules/no-useless-constructor.js +14 -22
  128. package/lib/rules/no-useless-escape.js +3 -5
  129. package/lib/rules/no-useless-rename.js +32 -20
  130. package/lib/rules/no-useless-return.js +11 -17
  131. package/lib/rules/no-var.js +12 -25
  132. package/lib/rules/no-warning-comments.js +0 -1
  133. package/lib/rules/no-whitespace-before-property.js +3 -3
  134. package/lib/rules/object-curly-newline.js +7 -10
  135. package/lib/rules/object-curly-spacing.js +14 -15
  136. package/lib/rules/object-shorthand.js +36 -10
  137. package/lib/rules/one-var-declaration-per-line.js +2 -2
  138. package/lib/rules/operator-assignment.js +22 -1
  139. package/lib/rules/padded-blocks.js +1 -1
  140. package/lib/rules/padding-line-between-statements.js +0 -16
  141. package/lib/rules/prefer-arrow-callback.js +6 -6
  142. package/lib/rules/prefer-const.js +13 -21
  143. package/lib/rules/prefer-destructuring.js +1 -7
  144. package/lib/rules/prefer-named-capture-group.js +3 -16
  145. package/lib/rules/prefer-numeric-literals.js +35 -3
  146. package/lib/rules/prefer-object-spread.js +7 -7
  147. package/lib/rules/prefer-regex-literals.js +125 -0
  148. package/lib/rules/prefer-rest-params.js +3 -6
  149. package/lib/rules/prefer-spread.js +4 -4
  150. package/lib/rules/prefer-template.js +5 -6
  151. package/lib/rules/quote-props.js +1 -1
  152. package/lib/rules/quotes.js +11 -6
  153. package/lib/rules/radix.js +5 -10
  154. package/lib/rules/require-await.js +2 -5
  155. package/lib/rules/require-yield.js +2 -2
  156. package/lib/rules/rest-spread-spacing.js +1 -1
  157. package/lib/rules/sort-imports.js +3 -4
  158. package/lib/rules/sort-keys.js +1 -3
  159. package/lib/rules/space-before-blocks.js +1 -2
  160. package/lib/rules/space-before-function-paren.js +12 -1
  161. package/lib/rules/space-in-parens.js +81 -75
  162. package/lib/rules/space-infix-ops.js +5 -5
  163. package/lib/rules/spaced-comment.js +15 -18
  164. package/lib/rules/strict.js +2 -4
  165. package/lib/rules/symbol-description.js +1 -2
  166. package/lib/rules/template-curly-spacing.js +2 -2
  167. package/lib/rules/use-isnan.js +104 -6
  168. package/lib/rules/utils/ast-utils.js +53 -81
  169. package/lib/rules/utils/fix-tracker.js +0 -6
  170. package/lib/rules/utils/lazy-loading-rule-map.js +0 -1
  171. package/lib/rules/vars-on-top.js +11 -11
  172. package/lib/shared/config-ops.js +2 -2
  173. package/lib/shared/logging.js +2 -0
  174. package/lib/shared/runtime-info.js +163 -0
  175. package/lib/shared/traverser.js +2 -0
  176. package/lib/source-code/source-code.js +11 -12
  177. package/lib/source-code/token-store/backward-token-comment-cursor.js +5 -5
  178. package/lib/source-code/token-store/backward-token-cursor.js +5 -5
  179. package/lib/source-code/token-store/cursors.js +17 -19
  180. package/lib/source-code/token-store/decorative-cursor.js +1 -1
  181. package/lib/source-code/token-store/filter-cursor.js +2 -2
  182. package/lib/source-code/token-store/forward-token-comment-cursor.js +5 -5
  183. package/lib/source-code/token-store/forward-token-cursor.js +5 -5
  184. package/lib/source-code/token-store/index.js +86 -92
  185. package/lib/source-code/token-store/limit-cursor.js +2 -2
  186. package/lib/source-code/token-store/padded-token-cursor.js +7 -7
  187. package/lib/source-code/token-store/skip-cursor.js +2 -2
  188. package/lib/source-code/token-store/utils.js +9 -13
  189. package/package.json +8 -5
@@ -16,19 +16,26 @@ const astUtils = require("./utils/ast-utils");
16
16
  //------------------------------------------------------------------------------
17
17
 
18
18
  /**
19
- * Checks whether the given operator is a relational operator or not.
20
- *
21
- * @param {string} op - The operator type to check.
22
- * @returns {boolean} `true` if the operator is a relational operator.
19
+ * Checks whether the given operator is `in` or `instanceof`
20
+ * @param {string} op The operator type to check.
21
+ * @returns {boolean} `true` if the operator is `in` or `instanceof`
23
22
  */
24
- function isRelationalOperator(op) {
23
+ function isInOrInstanceOfOperator(op) {
25
24
  return op === "in" || op === "instanceof";
26
25
  }
27
26
 
27
+ /**
28
+ * Checks whether the given operator is an ordering relational operator or not.
29
+ * @param {string} op The operator type to check.
30
+ * @returns {boolean} `true` if the operator is an ordering relational operator.
31
+ */
32
+ function isOrderingRelationalOperator(op) {
33
+ return op === "<" || op === ">" || op === ">=" || op === "<=";
34
+ }
35
+
28
36
  /**
29
37
  * Checks whether the given node is a logical negation expression or not.
30
- *
31
- * @param {ASTNode} node - The node to check.
38
+ * @param {ASTNode} node The node to check.
32
39
  * @returns {boolean} `true` if the node is a logical negation expression.
33
40
  */
34
41
  function isNegation(node) {
@@ -50,8 +57,19 @@ module.exports = {
50
57
  url: "https://eslint.org/docs/rules/no-unsafe-negation"
51
58
  },
52
59
 
53
- schema: [],
54
- fixable: "code",
60
+ schema: [
61
+ {
62
+ type: "object",
63
+ properties: {
64
+ enforceForOrderingRelations: {
65
+ type: "boolean",
66
+ default: false
67
+ }
68
+ },
69
+ additionalProperties: false
70
+ }
71
+ ],
72
+ fixable: null,
55
73
  messages: {
56
74
  unexpected: "Unexpected negating the left operand of '{{operator}}' operator."
57
75
  }
@@ -59,10 +77,15 @@ module.exports = {
59
77
 
60
78
  create(context) {
61
79
  const sourceCode = context.getSourceCode();
80
+ const options = context.options[0] || {};
81
+ const enforceForOrderingRelations = options.enforceForOrderingRelations === true;
62
82
 
63
83
  return {
64
84
  BinaryExpression(node) {
65
- if (isRelationalOperator(node.operator) &&
85
+ const orderingRelationRuleApplies = enforceForOrderingRelations && isOrderingRelationalOperator(node.operator);
86
+
87
+ if (
88
+ (isInOrInstanceOfOperator(node.operator) || orderingRelationRuleApplies) &&
66
89
  isNegation(node.left) &&
67
90
  !astUtils.isParenthesised(sourceCode, node.left)
68
91
  ) {
@@ -70,15 +93,7 @@ module.exports = {
70
93
  node,
71
94
  loc: node.left.loc,
72
95
  messageId: "unexpected",
73
- data: { operator: node.operator },
74
-
75
- fix(fixer) {
76
- const negationToken = sourceCode.getFirstToken(node.left);
77
- const fixRange = [negationToken.range[1], node.range[1]];
78
- const text = sourceCode.text.slice(fixRange[0], fixRange[1]);
79
-
80
- return fixer.replaceTextRange(fixRange, `(${text})`);
81
- }
96
+ data: { operator: node.operator }
82
97
  });
83
98
  }
84
99
  }
@@ -47,8 +47,9 @@ module.exports = {
47
47
  allowTernary = config.allowTernary || false,
48
48
  allowTaggedTemplates = config.allowTaggedTemplates || false;
49
49
 
50
+ // eslint-disable-next-line jsdoc/require-description
50
51
  /**
51
- * @param {ASTNode} node - any node
52
+ * @param {ASTNode} node any node
52
53
  * @returns {boolean} whether the given node structurally represents a directive
53
54
  */
54
55
  function looksLikeDirective(node) {
@@ -56,9 +57,10 @@ module.exports = {
56
57
  node.expression.type === "Literal" && typeof node.expression.value === "string";
57
58
  }
58
59
 
60
+ // eslint-disable-next-line jsdoc/require-description
59
61
  /**
60
- * @param {Function} predicate - ([a] -> Boolean) the function used to make the determination
61
- * @param {a[]} list - the input list
62
+ * @param {Function} predicate ([a] -> Boolean) the function used to make the determination
63
+ * @param {a[]} list the input list
62
64
  * @returns {a[]} the leading sequence of members in the given list that pass the given predicate
63
65
  */
64
66
  function takeWhile(predicate, list) {
@@ -70,17 +72,19 @@ module.exports = {
70
72
  return list.slice();
71
73
  }
72
74
 
75
+ // eslint-disable-next-line jsdoc/require-description
73
76
  /**
74
- * @param {ASTNode} node - a Program or BlockStatement node
77
+ * @param {ASTNode} node a Program or BlockStatement node
75
78
  * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body
76
79
  */
77
80
  function directives(node) {
78
81
  return takeWhile(looksLikeDirective, node.body);
79
82
  }
80
83
 
84
+ // eslint-disable-next-line jsdoc/require-description
81
85
  /**
82
- * @param {ASTNode} node - any node
83
- * @param {ASTNode[]} ancestors - the given node's ancestors
86
+ * @param {ASTNode} node any node
87
+ * @param {ASTNode[]} ancestors the given node's ancestors
84
88
  * @returns {boolean} whether the given node is considered a directive in its current position
85
89
  */
86
90
  function isDirective(node, ancestors) {
@@ -94,7 +98,7 @@ module.exports = {
94
98
 
95
99
  /**
96
100
  * Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags.
97
- * @param {ASTNode} node - any node
101
+ * @param {ASTNode} node any node
98
102
  * @returns {boolean} whether the given node is a valid expression
99
103
  */
100
104
  function isValidExpression(node) {
@@ -35,8 +35,7 @@ module.exports = {
35
35
 
36
36
  /**
37
37
  * Adds a scope info to the stack.
38
- *
39
- * @param {ASTNode} node - A node to add. This is a LabeledStatement.
38
+ * @param {ASTNode} node A node to add. This is a LabeledStatement.
40
39
  * @returns {void}
41
40
  */
42
41
  function enterLabeledScope(node) {
@@ -50,8 +49,7 @@ module.exports = {
50
49
  /**
51
50
  * Removes the top of the stack.
52
51
  * At the same time, this reports the label if it's never used.
53
- *
54
- * @param {ASTNode} node - A node to report. This is a LabeledStatement.
52
+ * @param {ASTNode} node A node to report. This is a LabeledStatement.
55
53
  * @returns {void}
56
54
  */
57
55
  function exitLabeledScope(node) {
@@ -81,8 +79,7 @@ module.exports = {
81
79
 
82
80
  /**
83
81
  * Marks the label of a given node as used.
84
- *
85
- * @param {ASTNode} node - A node to mark. This is a BreakStatement or
82
+ * @param {ASTNode} node A node to mark. This is a BreakStatement or
86
83
  * ContinueStatement.
87
84
  * @returns {void}
88
85
  */
@@ -103,7 +103,7 @@ module.exports = {
103
103
  /**
104
104
  * Generate the warning message about the variable being
105
105
  * defined and unused, including the ignore pattern if configured.
106
- * @param {Variable} unusedVar - eslint-scope variable object.
106
+ * @param {Variable} unusedVar eslint-scope variable object.
107
107
  * @returns {string} The warning message to be used with this unused variable.
108
108
  */
109
109
  function getDefinedMessage(unusedVar) {
@@ -146,7 +146,7 @@ module.exports = {
146
146
 
147
147
  /**
148
148
  * Determines if a given variable is being exported from a module.
149
- * @param {Variable} variable - eslint-scope variable object.
149
+ * @param {Variable} variable eslint-scope variable object.
150
150
  * @returns {boolean} True if the variable is exported, false if not.
151
151
  * @private
152
152
  */
@@ -172,7 +172,7 @@ module.exports = {
172
172
 
173
173
  /**
174
174
  * Determines if a variable has a sibling rest property
175
- * @param {Variable} variable - eslint-scope variable object.
175
+ * @param {Variable} variable eslint-scope variable object.
176
176
  * @returns {boolean} True if the variable is exported, false if not.
177
177
  * @private
178
178
  */
@@ -195,7 +195,7 @@ module.exports = {
195
195
 
196
196
  /**
197
197
  * Determines if a reference is a read operation.
198
- * @param {Reference} ref - An eslint-scope Reference
198
+ * @param {Reference} ref An eslint-scope Reference
199
199
  * @returns {boolean} whether the given reference represents a read operation
200
200
  * @private
201
201
  */
@@ -205,8 +205,8 @@ module.exports = {
205
205
 
206
206
  /**
207
207
  * Determine if an identifier is referencing an enclosing function name.
208
- * @param {Reference} ref - The reference to check.
209
- * @param {ASTNode[]} nodes - The candidate function nodes.
208
+ * @param {Reference} ref The reference to check.
209
+ * @param {ASTNode[]} nodes The candidate function nodes.
210
210
  * @returns {boolean} True if it's a self-reference, false if not.
211
211
  * @private
212
212
  */
@@ -226,7 +226,7 @@ module.exports = {
226
226
 
227
227
  /**
228
228
  * Gets a list of function definitions for a specified variable.
229
- * @param {Variable} variable - eslint-scope variable object.
229
+ * @param {Variable} variable eslint-scope variable object.
230
230
  * @returns {ASTNode[]} Function nodes.
231
231
  * @private
232
232
  */
@@ -252,9 +252,8 @@ module.exports = {
252
252
 
253
253
  /**
254
254
  * Checks the position of given nodes.
255
- *
256
- * @param {ASTNode} inner - A node which is expected as inside.
257
- * @param {ASTNode} outer - A node which is expected as outside.
255
+ * @param {ASTNode} inner A node which is expected as inside.
256
+ * @param {ASTNode} outer A node which is expected as outside.
258
257
  * @returns {boolean} `true` if the `inner` node exists in the `outer` node.
259
258
  * @private
260
259
  */
@@ -275,9 +274,8 @@ module.exports = {
275
274
  * - The reference is inside of a loop.
276
275
  * - The reference is inside of a function scope which is different from
277
276
  * the declaration.
278
- *
279
- * @param {eslint-scope.Reference} ref - A reference to check.
280
- * @param {ASTNode} prevRhsNode - The previous RHS node.
277
+ * @param {eslint-scope.Reference} ref A reference to check.
278
+ * @param {ASTNode} prevRhsNode The previous RHS node.
281
279
  * @returns {ASTNode|null} The RHS node or null.
282
280
  * @private
283
281
  */
@@ -310,9 +308,8 @@ module.exports = {
310
308
  /**
311
309
  * Checks whether a given function node is stored to somewhere or not.
312
310
  * If the function node is stored, the function can be used later.
313
- *
314
- * @param {ASTNode} funcNode - A function node to check.
315
- * @param {ASTNode} rhsNode - The RHS node of the previous assignment.
311
+ * @param {ASTNode} funcNode A function node to check.
312
+ * @param {ASTNode} rhsNode The RHS node of the previous assignment.
316
313
  * @returns {boolean} `true` if under the following conditions:
317
314
  * - the funcNode is assigned to a variable.
318
315
  * - the funcNode is bound as an argument of a function call.
@@ -367,9 +364,8 @@ module.exports = {
367
364
  * - the function is bound as an argument of a function call.
368
365
  *
369
366
  * If a reference exists in a function which can be used later, the reference is read when the function is called.
370
- *
371
- * @param {ASTNode} id - An Identifier node to check.
372
- * @param {ASTNode} rhsNode - The RHS node of the previous assignment.
367
+ * @param {ASTNode} id An Identifier node to check.
368
+ * @param {ASTNode} rhsNode The RHS node of the previous assignment.
373
369
  * @returns {boolean} `true` if the `id` node exists inside of a function node which can be used later.
374
370
  * @private
375
371
  */
@@ -385,9 +381,8 @@ module.exports = {
385
381
 
386
382
  /**
387
383
  * Checks whether a given reference is a read to update itself or not.
388
- *
389
- * @param {eslint-scope.Reference} ref - A reference to check.
390
- * @param {ASTNode} rhsNode - The RHS node of the previous assignment.
384
+ * @param {eslint-scope.Reference} ref A reference to check.
385
+ * @param {ASTNode} rhsNode The RHS node of the previous assignment.
391
386
  * @returns {boolean} The reference is a read to update itself.
392
387
  * @private
393
388
  */
@@ -416,8 +411,7 @@ module.exports = {
416
411
 
417
412
  /**
418
413
  * Determine if an identifier is used either in for-in loops.
419
- *
420
- * @param {Reference} ref - The reference to check.
414
+ * @param {Reference} ref The reference to check.
421
415
  * @returns {boolean} whether reference is used in the for-in loops
422
416
  * @private
423
417
  */
@@ -453,7 +447,7 @@ module.exports = {
453
447
 
454
448
  /**
455
449
  * Determines if the variable is used.
456
- * @param {Variable} variable - The variable to check.
450
+ * @param {Variable} variable The variable to check.
457
451
  * @returns {boolean} True if the variable is used
458
452
  * @private
459
453
  */
@@ -481,8 +475,7 @@ module.exports = {
481
475
 
482
476
  /**
483
477
  * Checks whether the given variable is after the last used parameter.
484
- *
485
- * @param {eslint-scope.Variable} variable - The variable to check.
478
+ * @param {eslint-scope.Variable} variable The variable to check.
486
479
  * @returns {boolean} `true` if the variable is defined after the last
487
480
  * used parameter.
488
481
  */
@@ -497,8 +490,8 @@ module.exports = {
497
490
 
498
491
  /**
499
492
  * Gets an array of variables without read references.
500
- * @param {Scope} scope - an eslint-scope Scope object.
501
- * @param {Variable[]} unusedVars - an array that saving result.
493
+ * @param {Scope} scope an eslint-scope Scope object.
494
+ * @param {Variable[]} unusedVars an array that saving result.
502
495
  * @returns {Variable[]} unused variables of the scope and descendant scopes.
503
496
  * @private
504
497
  */
@@ -14,8 +14,7 @@ const FOR_IN_OF_TYPE = /^For(?:In|Of)Statement$/u;
14
14
 
15
15
  /**
16
16
  * Parses a given value as options.
17
- *
18
- * @param {any} options - A value to parse.
17
+ * @param {any} options A value to parse.
19
18
  * @returns {Object} The parsed options.
20
19
  */
21
20
  function parseOptions(options) {
@@ -36,8 +35,7 @@ function parseOptions(options) {
36
35
 
37
36
  /**
38
37
  * Checks whether or not a given variable is a function declaration.
39
- *
40
- * @param {eslint-scope.Variable} variable - A variable to check.
38
+ * @param {eslint-scope.Variable} variable A variable to check.
41
39
  * @returns {boolean} `true` if the variable is a function declaration.
42
40
  */
43
41
  function isFunction(variable) {
@@ -46,9 +44,8 @@ function isFunction(variable) {
46
44
 
47
45
  /**
48
46
  * Checks whether or not a given variable is a class declaration in an upper function scope.
49
- *
50
- * @param {eslint-scope.Variable} variable - A variable to check.
51
- * @param {eslint-scope.Reference} reference - A reference to check.
47
+ * @param {eslint-scope.Variable} variable A variable to check.
48
+ * @param {eslint-scope.Reference} reference A reference to check.
52
49
  * @returns {boolean} `true` if the variable is a class declaration.
53
50
  */
54
51
  function isOuterClass(variable, reference) {
@@ -60,8 +57,8 @@ function isOuterClass(variable, reference) {
60
57
 
61
58
  /**
62
59
  * Checks whether or not a given variable is a variable declaration in an upper function scope.
63
- * @param {eslint-scope.Variable} variable - A variable to check.
64
- * @param {eslint-scope.Reference} reference - A reference to check.
60
+ * @param {eslint-scope.Variable} variable A variable to check.
61
+ * @param {eslint-scope.Reference} reference A reference to check.
65
62
  * @returns {boolean} `true` if the variable is a variable declaration.
66
63
  */
67
64
  function isOuterVariable(variable, reference) {
@@ -73,9 +70,8 @@ function isOuterVariable(variable, reference) {
73
70
 
74
71
  /**
75
72
  * Checks whether or not a given location is inside of the range of a given node.
76
- *
77
- * @param {ASTNode} node - An node to check.
78
- * @param {number} location - A location to check.
73
+ * @param {ASTNode} node An node to check.
74
+ * @param {number} location A location to check.
79
75
  * @returns {boolean} `true` if the location is inside of the range of the node.
80
76
  */
81
77
  function isInRange(node, location) {
@@ -92,9 +88,8 @@ function isInRange(node, location) {
92
88
  * var {a = a} = obj
93
89
  * for (var a in a) {}
94
90
  * for (var a of a) {}
95
- *
96
- * @param {Variable} variable - A variable to check.
97
- * @param {Reference} reference - A reference to check.
91
+ * @param {Variable} variable A variable to check.
92
+ * @param {Reference} reference A reference to check.
98
93
  * @returns {boolean} `true` if the reference is inside of the initializers.
99
94
  */
100
95
  function isInInitializer(variable, reference) {
@@ -13,7 +13,7 @@ const astUtils = require("./utils/ast-utils");
13
13
 
14
14
  /**
15
15
  * Checks whether or not a node is a `.call()`/`.apply()`.
16
- * @param {ASTNode} node - A CallExpression node to check.
16
+ * @param {ASTNode} node A CallExpression node to check.
17
17
  * @returns {boolean} Whether or not the node is a `.call()`/`.apply()`.
18
18
  */
19
19
  function isCallOrNonVariadicApply(node) {
@@ -31,9 +31,9 @@ function isCallOrNonVariadicApply(node) {
31
31
 
32
32
  /**
33
33
  * Checks whether or not `thisArg` is not changed by `.call()`/`.apply()`.
34
- * @param {ASTNode|null} expectedThis - The node that is the owner of the applied function.
35
- * @param {ASTNode} thisArg - The node that is given to the first argument of the `.call()`/`.apply()`.
36
- * @param {SourceCode} sourceCode - The ESLint source code object.
34
+ * @param {ASTNode|null} expectedThis The node that is the owner of the applied function.
35
+ * @param {ASTNode} thisArg The node that is given to the first argument of the `.call()`/`.apply()`.
36
+ * @param {SourceCode} sourceCode The ESLint source code object.
37
37
  * @returns {boolean} Whether or not `thisArg` is not changed by `.call()`/`.apply()`.
38
38
  */
39
39
  function isValidThisArg(expectedThis, thisArg, sourceCode) {
@@ -16,7 +16,7 @@ const astUtils = require("./utils/ast-utils");
16
16
 
17
17
  /**
18
18
  * Checks whether or not a given node is a concatenation.
19
- * @param {ASTNode} node - A node to check.
19
+ * @param {ASTNode} node A node to check.
20
20
  * @returns {boolean} `true` if the node is a concatenation.
21
21
  */
22
22
  function isConcatenation(node) {
@@ -25,7 +25,7 @@ function isConcatenation(node) {
25
25
 
26
26
  /**
27
27
  * Checks if the given token is a `+` token or not.
28
- * @param {Token} token - The token to check.
28
+ * @param {Token} token The token to check.
29
29
  * @returns {boolean} `true` if the token is a `+` token.
30
30
  */
31
31
  function isConcatOperatorToken(token) {
@@ -34,7 +34,7 @@ function isConcatOperatorToken(token) {
34
34
 
35
35
  /**
36
36
  * Get's the right most node on the left side of a BinaryExpression with + operator.
37
- * @param {ASTNode} node - A BinaryExpression node to check.
37
+ * @param {ASTNode} node A BinaryExpression node to check.
38
38
  * @returns {ASTNode} node
39
39
  */
40
40
  function getLeft(node) {
@@ -48,7 +48,7 @@ function getLeft(node) {
48
48
 
49
49
  /**
50
50
  * Get's the left most node on the right side of a BinaryExpression with + operator.
51
- * @param {ASTNode} node - A BinaryExpression node to check.
51
+ * @param {ASTNode} node A BinaryExpression node to check.
52
52
  * @returns {ASTNode} node
53
53
  */
54
54
  function getRight(node) {
@@ -10,8 +10,7 @@
10
10
 
11
11
  /**
12
12
  * Checks whether a given array of statements is a single call of `super`.
13
- *
14
- * @param {ASTNode[]} body - An array of statements to check.
13
+ * @param {ASTNode[]} body An array of statements to check.
15
14
  * @returns {boolean} `true` if the body is a single call of `super`.
16
15
  */
17
16
  function isSingleSuperCall(body) {
@@ -26,8 +25,7 @@ function isSingleSuperCall(body) {
26
25
  /**
27
26
  * Checks whether a given node is a pattern which doesn't have any side effects.
28
27
  * Default parameters and Destructuring parameters can have side effects.
29
- *
30
- * @param {ASTNode} node - A pattern node.
28
+ * @param {ASTNode} node A pattern node.
31
29
  * @returns {boolean} `true` if the node doesn't have any side effects.
32
30
  */
33
31
  function isSimple(node) {
@@ -37,8 +35,7 @@ function isSimple(node) {
37
35
  /**
38
36
  * Checks whether a given array of expressions is `...arguments` or not.
39
37
  * `super(...arguments)` passes all arguments through.
40
- *
41
- * @param {ASTNode[]} superArgs - An array of expressions to check.
38
+ * @param {ASTNode[]} superArgs An array of expressions to check.
42
39
  * @returns {boolean} `true` if the superArgs is `...arguments`.
43
40
  */
44
41
  function isSpreadArguments(superArgs) {
@@ -52,9 +49,8 @@ function isSpreadArguments(superArgs) {
52
49
 
53
50
  /**
54
51
  * Checks whether given 2 nodes are identifiers which have the same name or not.
55
- *
56
- * @param {ASTNode} ctorParam - A node to check.
57
- * @param {ASTNode} superArg - A node to check.
52
+ * @param {ASTNode} ctorParam A node to check.
53
+ * @param {ASTNode} superArg A node to check.
58
54
  * @returns {boolean} `true` if the nodes are identifiers which have the same
59
55
  * name.
60
56
  */
@@ -68,9 +64,8 @@ function isValidIdentifierPair(ctorParam, superArg) {
68
64
 
69
65
  /**
70
66
  * Checks whether given 2 nodes are a rest/spread pair which has the same values.
71
- *
72
- * @param {ASTNode} ctorParam - A node to check.
73
- * @param {ASTNode} superArg - A node to check.
67
+ * @param {ASTNode} ctorParam A node to check.
68
+ * @param {ASTNode} superArg A node to check.
74
69
  * @returns {boolean} `true` if the nodes are a rest/spread pair which has the
75
70
  * same values.
76
71
  */
@@ -84,9 +79,8 @@ function isValidRestSpreadPair(ctorParam, superArg) {
84
79
 
85
80
  /**
86
81
  * Checks whether given 2 nodes have the same value or not.
87
- *
88
- * @param {ASTNode} ctorParam - A node to check.
89
- * @param {ASTNode} superArg - A node to check.
82
+ * @param {ASTNode} ctorParam A node to check.
83
+ * @param {ASTNode} superArg A node to check.
90
84
  * @returns {boolean} `true` if the nodes have the same value or not.
91
85
  */
92
86
  function isValidPair(ctorParam, superArg) {
@@ -99,9 +93,8 @@ function isValidPair(ctorParam, superArg) {
99
93
  /**
100
94
  * Checks whether the parameters of a constructor and the arguments of `super()`
101
95
  * have the same values or not.
102
- *
103
- * @param {ASTNode} ctorParams - The parameters of a constructor to check.
104
- * @param {ASTNode} superArgs - The arguments of `super()` to check.
96
+ * @param {ASTNode} ctorParams The parameters of a constructor to check.
97
+ * @param {ASTNode} superArgs The arguments of `super()` to check.
105
98
  * @returns {boolean} `true` if those have the same values.
106
99
  */
107
100
  function isPassingThrough(ctorParams, superArgs) {
@@ -120,9 +113,8 @@ function isPassingThrough(ctorParams, superArgs) {
120
113
 
121
114
  /**
122
115
  * Checks whether the constructor body is a redundant super call.
123
- *
124
- * @param {Array} body - constructor body content.
125
- * @param {Array} ctorParams - The params to check against super call.
116
+ * @param {Array} body constructor body content.
117
+ * @param {Array} ctorParams The params to check against super call.
126
118
  * @returns {boolean} true if the construtor body is redundant
127
119
  */
128
120
  function isRedundantSuperCall(body, ctorParams) {
@@ -158,7 +150,7 @@ module.exports = {
158
150
 
159
151
  /**
160
152
  * Checks whether a node is a redundant constructor
161
- * @param {ASTNode} node - node to check
153
+ * @param {ASTNode} node node to check
162
154
  * @returns {void}
163
155
  */
164
156
  function checkForConstructor(node) {
@@ -117,10 +117,9 @@ module.exports = {
117
117
 
118
118
  /**
119
119
  * Checks if the escape character in given string slice is unnecessary.
120
- *
121
120
  * @private
122
- * @param {ASTNode} node - node to validate.
123
- * @param {string} match - string slice to validate.
121
+ * @param {ASTNode} node node to validate.
122
+ * @param {string} match string slice to validate.
124
123
  * @returns {void}
125
124
  */
126
125
  function validateString(node, match) {
@@ -156,8 +155,7 @@ module.exports = {
156
155
 
157
156
  /**
158
157
  * Checks if a node has an escape.
159
- *
160
- * @param {ASTNode} node - node to check.
158
+ * @param {ASTNode} node node to check.
161
159
  * @returns {void}
162
160
  */
163
161
  function check(node) {