eslint 6.5.1 → 6.7.2

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 (197) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/README.md +10 -9
  3. package/conf/config-schema.js +1 -0
  4. package/conf/default-cli-options.js +1 -1
  5. package/lib/cli-engine/cascading-config-array-factory.js +40 -14
  6. package/lib/cli-engine/cli-engine.js +49 -21
  7. package/lib/cli-engine/config-array/config-array.js +13 -4
  8. package/lib/cli-engine/config-array/config-dependency.js +2 -0
  9. package/lib/cli-engine/config-array/extracted-config.js +27 -0
  10. package/lib/cli-engine/config-array/ignore-pattern.js +231 -0
  11. package/lib/cli-engine/config-array/index.js +2 -0
  12. package/lib/cli-engine/config-array/override-tester.js +2 -0
  13. package/lib/cli-engine/config-array-factory.js +120 -2
  14. package/lib/cli-engine/file-enumerator.js +65 -34
  15. package/lib/cli-engine/formatters/html.js +1 -0
  16. package/lib/init/autoconfig.js +1 -11
  17. package/lib/init/config-file.js +0 -1
  18. package/lib/init/config-initializer.js +4 -4
  19. package/lib/init/config-rule.js +1 -5
  20. package/lib/init/npm-utils.js +0 -5
  21. package/lib/linter/code-path-analysis/code-path-analyzer.js +24 -38
  22. package/lib/linter/code-path-analysis/code-path-segment.js +17 -25
  23. package/lib/linter/code-path-analysis/code-path-state.js +40 -81
  24. package/lib/linter/code-path-analysis/code-path.js +10 -11
  25. package/lib/linter/code-path-analysis/debug-helpers.js +8 -12
  26. package/lib/linter/code-path-analysis/fork-context.js +23 -34
  27. package/lib/linter/code-path-analysis/id-generator.js +2 -2
  28. package/lib/linter/linter.js +121 -95
  29. package/lib/linter/node-event-generator.js +3 -2
  30. package/lib/linter/report-translator.js +73 -7
  31. package/lib/rule-tester/rule-tester.js +46 -14
  32. package/lib/rules/accessor-pairs.js +8 -8
  33. package/lib/rules/array-bracket-newline.js +12 -15
  34. package/lib/rules/array-bracket-spacing.js +12 -12
  35. package/lib/rules/array-callback-return.js +6 -11
  36. package/lib/rules/array-element-newline.js +5 -8
  37. package/lib/rules/arrow-parens.js +0 -1
  38. package/lib/rules/block-scoped-var.js +3 -3
  39. package/lib/rules/block-spacing.js +4 -4
  40. package/lib/rules/camelcase.js +19 -6
  41. package/lib/rules/capitalized-comments.js +0 -7
  42. package/lib/rules/class-methods-use-this.js +3 -3
  43. package/lib/rules/comma-dangle.js +20 -25
  44. package/lib/rules/comma-spacing.js +1 -1
  45. package/lib/rules/computed-property-spacing.js +14 -14
  46. package/lib/rules/consistent-return.js +4 -5
  47. package/lib/rules/consistent-this.js +5 -5
  48. package/lib/rules/constructor-super.js +14 -16
  49. package/lib/rules/curly.js +12 -9
  50. package/lib/rules/default-param-last.js +1 -0
  51. package/lib/rules/dot-location.js +11 -12
  52. package/lib/rules/func-names.js +6 -6
  53. package/lib/rules/function-call-argument-newline.js +8 -6
  54. package/lib/rules/generator-star-spacing.js +4 -9
  55. package/lib/rules/getter-return.js +4 -7
  56. package/lib/rules/grouped-accessor-pairs.js +224 -0
  57. package/lib/rules/indent.js +13 -2
  58. package/lib/rules/index.js +5 -0
  59. package/lib/rules/init-declarations.js +2 -2
  60. package/lib/rules/jsx-quotes.js +1 -1
  61. package/lib/rules/keyword-spacing.js +32 -56
  62. package/lib/rules/lines-around-directive.js +1 -1
  63. package/lib/rules/max-len.js +0 -5
  64. package/lib/rules/max-statements-per-line.js +3 -7
  65. package/lib/rules/multiline-comment-style.js +237 -106
  66. package/lib/rules/multiline-ternary.js +3 -3
  67. package/lib/rules/newline-after-var.js +6 -7
  68. package/lib/rules/newline-before-return.js +8 -9
  69. package/lib/rules/newline-per-chained-call.js +2 -4
  70. package/lib/rules/no-class-assign.js +2 -2
  71. package/lib/rules/no-compare-neg-zero.js +1 -2
  72. package/lib/rules/no-cond-assign.js +14 -4
  73. package/lib/rules/no-confusing-arrow.js +2 -2
  74. package/lib/rules/no-console.js +4 -8
  75. package/lib/rules/no-const-assign.js +1 -1
  76. package/lib/rules/no-constructor-return.js +62 -0
  77. package/lib/rules/no-dupe-args.js +1 -1
  78. package/lib/rules/no-dupe-class-members.js +3 -4
  79. package/lib/rules/no-dupe-else-if.js +122 -0
  80. package/lib/rules/no-dupe-keys.js +6 -5
  81. package/lib/rules/no-duplicate-imports.js +14 -18
  82. package/lib/rules/no-else-return.js +0 -8
  83. package/lib/rules/no-empty-function.js +2 -4
  84. package/lib/rules/no-eval.js +10 -18
  85. package/lib/rules/no-ex-assign.js +1 -1
  86. package/lib/rules/no-extra-bind.js +5 -12
  87. package/lib/rules/no-extra-boolean-cast.js +0 -2
  88. package/lib/rules/no-extra-label.js +4 -9
  89. package/lib/rules/no-extra-parens.js +17 -15
  90. package/lib/rules/no-extra-semi.js +5 -6
  91. package/lib/rules/no-fallthrough.js +6 -6
  92. package/lib/rules/no-func-assign.js +3 -3
  93. package/lib/rules/no-global-assign.js +4 -4
  94. package/lib/rules/no-implicit-coercion.js +10 -10
  95. package/lib/rules/no-implicit-globals.js +90 -8
  96. package/lib/rules/no-implied-eval.js +0 -1
  97. package/lib/rules/no-inline-comments.js +25 -11
  98. package/lib/rules/no-invalid-this.js +17 -5
  99. package/lib/rules/no-labels.js +3 -6
  100. package/lib/rules/no-lone-blocks.js +1 -1
  101. package/lib/rules/no-loop-func.js +6 -11
  102. package/lib/rules/no-magic-numbers.js +6 -6
  103. package/lib/rules/no-misleading-character-class.js +14 -7
  104. package/lib/rules/no-mixed-operators.js +13 -22
  105. package/lib/rules/no-mixed-requires.js +0 -1
  106. package/lib/rules/no-multi-spaces.js +1 -1
  107. package/lib/rules/no-native-reassign.js +4 -4
  108. package/lib/rules/no-octal-escape.js +1 -1
  109. package/lib/rules/no-param-reassign.js +28 -7
  110. package/lib/rules/no-redeclare.js +1 -1
  111. package/lib/rules/no-regex-spaces.js +0 -1
  112. package/lib/rules/no-restricted-imports.js +11 -11
  113. package/lib/rules/no-self-assign.js +12 -13
  114. package/lib/rules/no-sequences.js +3 -3
  115. package/lib/rules/no-setter-return.js +227 -0
  116. package/lib/rules/no-shadow.js +1 -4
  117. package/lib/rules/no-tabs.js +8 -2
  118. package/lib/rules/no-this-before-super.js +12 -13
  119. package/lib/rules/no-trailing-spaces.js +19 -7
  120. package/lib/rules/no-underscore-dangle.js +23 -4
  121. package/lib/rules/no-unexpected-multiline.js +8 -0
  122. package/lib/rules/no-unmodified-loop-condition.js +16 -29
  123. package/lib/rules/no-unneeded-ternary.js +3 -3
  124. package/lib/rules/no-unreachable.js +7 -7
  125. package/lib/rules/no-unsafe-finally.js +4 -7
  126. package/lib/rules/no-unsafe-negation.js +32 -9
  127. package/lib/rules/no-unused-expressions.js +11 -7
  128. package/lib/rules/no-unused-labels.js +3 -6
  129. package/lib/rules/no-unused-vars.js +22 -29
  130. package/lib/rules/no-use-before-define.js +10 -15
  131. package/lib/rules/no-useless-call.js +4 -4
  132. package/lib/rules/no-useless-computed-key.js +60 -33
  133. package/lib/rules/no-useless-concat.js +4 -4
  134. package/lib/rules/no-useless-constructor.js +14 -22
  135. package/lib/rules/no-useless-escape.js +29 -8
  136. package/lib/rules/no-useless-rename.js +7 -7
  137. package/lib/rules/no-useless-return.js +8 -15
  138. package/lib/rules/no-var.js +12 -25
  139. package/lib/rules/no-warning-comments.js +0 -1
  140. package/lib/rules/no-whitespace-before-property.js +3 -3
  141. package/lib/rules/object-curly-newline.js +7 -10
  142. package/lib/rules/object-curly-spacing.js +21 -22
  143. package/lib/rules/object-shorthand.js +1 -1
  144. package/lib/rules/one-var-declaration-per-line.js +2 -2
  145. package/lib/rules/operator-assignment.js +33 -3
  146. package/lib/rules/padded-blocks.js +1 -1
  147. package/lib/rules/padding-line-between-statements.js +0 -16
  148. package/lib/rules/prefer-arrow-callback.js +6 -6
  149. package/lib/rules/prefer-const.js +27 -28
  150. package/lib/rules/prefer-destructuring.js +1 -7
  151. package/lib/rules/prefer-exponentiation-operator.js +189 -0
  152. package/lib/rules/prefer-named-capture-group.js +0 -1
  153. package/lib/rules/prefer-numeric-literals.js +32 -4
  154. package/lib/rules/prefer-object-spread.js +7 -7
  155. package/lib/rules/prefer-rest-params.js +3 -6
  156. package/lib/rules/prefer-spread.js +4 -4
  157. package/lib/rules/prefer-template.js +5 -6
  158. package/lib/rules/quote-props.js +1 -1
  159. package/lib/rules/quotes.js +5 -6
  160. package/lib/rules/radix.js +5 -10
  161. package/lib/rules/require-await.js +10 -5
  162. package/lib/rules/require-yield.js +2 -2
  163. package/lib/rules/rest-spread-spacing.js +1 -1
  164. package/lib/rules/semi.js +6 -3
  165. package/lib/rules/sort-imports.js +3 -4
  166. package/lib/rules/sort-keys.js +1 -3
  167. package/lib/rules/space-before-blocks.js +1 -2
  168. package/lib/rules/space-in-parens.js +4 -4
  169. package/lib/rules/space-infix-ops.js +6 -6
  170. package/lib/rules/spaced-comment.js +20 -22
  171. package/lib/rules/strict.js +2 -4
  172. package/lib/rules/symbol-description.js +1 -2
  173. package/lib/rules/template-curly-spacing.js +2 -2
  174. package/lib/rules/use-isnan.js +40 -3
  175. package/lib/rules/utils/ast-utils.js +84 -85
  176. package/lib/rules/utils/fix-tracker.js +0 -6
  177. package/lib/rules/utils/lazy-loading-rule-map.js +0 -1
  178. package/lib/rules/vars-on-top.js +11 -11
  179. package/lib/shared/config-ops.js +2 -2
  180. package/lib/shared/runtime-info.js +8 -8
  181. package/lib/shared/traverser.js +2 -0
  182. package/lib/shared/types.js +9 -0
  183. package/lib/source-code/source-code.js +94 -17
  184. package/lib/source-code/token-store/backward-token-comment-cursor.js +5 -5
  185. package/lib/source-code/token-store/backward-token-cursor.js +5 -5
  186. package/lib/source-code/token-store/cursors.js +17 -19
  187. package/lib/source-code/token-store/decorative-cursor.js +1 -1
  188. package/lib/source-code/token-store/filter-cursor.js +2 -2
  189. package/lib/source-code/token-store/forward-token-comment-cursor.js +5 -5
  190. package/lib/source-code/token-store/forward-token-cursor.js +5 -5
  191. package/lib/source-code/token-store/index.js +86 -92
  192. package/lib/source-code/token-store/limit-cursor.js +2 -2
  193. package/lib/source-code/token-store/padded-token-cursor.js +7 -7
  194. package/lib/source-code/token-store/skip-cursor.js +2 -2
  195. package/lib/source-code/token-store/utils.js +9 -13
  196. package/package.json +9 -7
  197. package/lib/cli-engine/ignored-paths.js +0 -362
@@ -18,8 +18,7 @@ const TARGET_NODE_TYPE = /^(?:Arrow)?FunctionExpression$/u;
18
18
 
19
19
  /**
20
20
  * Checks a given code path segment is reachable.
21
- *
22
- * @param {CodePathSegment} segment - A segment to check.
21
+ * @param {CodePathSegment} segment A segment to check.
23
22
  * @returns {boolean} `true` if the segment is reachable.
24
23
  */
25
24
  function isReachable(segment) {
@@ -30,8 +29,7 @@ function isReachable(segment) {
30
29
  * Gets a readable location.
31
30
  *
32
31
  * - FunctionExpression -> the function name or `function` keyword.
33
- *
34
- * @param {ASTNode} node - A function node to get.
32
+ * @param {ASTNode} node A function node to get.
35
33
  * @returns {ASTNode|Token} The node or the token of a location.
36
34
  */
37
35
  function getId(node) {
@@ -92,8 +90,7 @@ module.exports = {
92
90
  *
93
91
  * If the last code path segment is reachable, there are paths which are not
94
92
  * returned or thrown.
95
- *
96
- * @param {ASTNode} node - A node to check.
93
+ * @param {ASTNode} node A node to check.
97
94
  * @returns {void}
98
95
  */
99
96
  function checkLastSegment(node) {
@@ -113,7 +110,7 @@ module.exports = {
113
110
 
114
111
  /**
115
112
  * Checks whether a node means a getter function.
116
- * @param {ASTNode} node - a node to check.
113
+ * @param {ASTNode} node a node to check.
117
114
  * @returns {boolean} if node means a getter, return true; else return false.
118
115
  */
119
116
  function isGetter(node) {
@@ -0,0 +1,224 @@
1
+ /**
2
+ * @fileoverview Rule to require grouped accessor pairs in object literals and classes
3
+ * @author Milos Djermanovic
4
+ */
5
+
6
+ "use strict";
7
+
8
+ //------------------------------------------------------------------------------
9
+ // Requirements
10
+ //------------------------------------------------------------------------------
11
+
12
+ const astUtils = require("./utils/ast-utils");
13
+
14
+ //------------------------------------------------------------------------------
15
+ // Typedefs
16
+ //------------------------------------------------------------------------------
17
+
18
+ /**
19
+ * Property name if it can be computed statically, otherwise the list of the tokens of the key node.
20
+ * @typedef {string|Token[]} Key
21
+ */
22
+
23
+ /**
24
+ * Accessor nodes with the same key.
25
+ * @typedef {Object} AccessorData
26
+ * @property {Key} key Accessor's key
27
+ * @property {ASTNode[]} getters List of getter nodes.
28
+ * @property {ASTNode[]} setters List of setter nodes.
29
+ */
30
+
31
+ //------------------------------------------------------------------------------
32
+ // Helpers
33
+ //------------------------------------------------------------------------------
34
+
35
+ /**
36
+ * Checks whether or not the given lists represent the equal tokens in the same order.
37
+ * Tokens are compared by their properties, not by instance.
38
+ * @param {Token[]} left First list of tokens.
39
+ * @param {Token[]} right Second list of tokens.
40
+ * @returns {boolean} `true` if the lists have same tokens.
41
+ */
42
+ function areEqualTokenLists(left, right) {
43
+ if (left.length !== right.length) {
44
+ return false;
45
+ }
46
+
47
+ for (let i = 0; i < left.length; i++) {
48
+ const leftToken = left[i],
49
+ rightToken = right[i];
50
+
51
+ if (leftToken.type !== rightToken.type || leftToken.value !== rightToken.value) {
52
+ return false;
53
+ }
54
+ }
55
+
56
+ return true;
57
+ }
58
+
59
+ /**
60
+ * Checks whether or not the given keys are equal.
61
+ * @param {Key} left First key.
62
+ * @param {Key} right Second key.
63
+ * @returns {boolean} `true` if the keys are equal.
64
+ */
65
+ function areEqualKeys(left, right) {
66
+ if (typeof left === "string" && typeof right === "string") {
67
+
68
+ // Statically computed names.
69
+ return left === right;
70
+ }
71
+ if (Array.isArray(left) && Array.isArray(right)) {
72
+
73
+ // Token lists.
74
+ return areEqualTokenLists(left, right);
75
+ }
76
+
77
+ return false;
78
+ }
79
+
80
+ /**
81
+ * Checks whether or not a given node is of an accessor kind ('get' or 'set').
82
+ * @param {ASTNode} node A node to check.
83
+ * @returns {boolean} `true` if the node is of an accessor kind.
84
+ */
85
+ function isAccessorKind(node) {
86
+ return node.kind === "get" || node.kind === "set";
87
+ }
88
+
89
+ //------------------------------------------------------------------------------
90
+ // Rule Definition
91
+ //------------------------------------------------------------------------------
92
+
93
+ module.exports = {
94
+ meta: {
95
+ type: "suggestion",
96
+
97
+ docs: {
98
+ description: "require grouped accessor pairs in object literals and classes",
99
+ category: "Best Practices",
100
+ recommended: false,
101
+ url: "https://eslint.org/docs/rules/grouped-accessor-pairs"
102
+ },
103
+
104
+ schema: [
105
+ {
106
+ enum: ["anyOrder", "getBeforeSet", "setBeforeGet"]
107
+ }
108
+ ],
109
+
110
+ messages: {
111
+ notGrouped: "Accessor pair {{ formerName }} and {{ latterName }} should be grouped.",
112
+ invalidOrder: "Expected {{ latterName }} to be before {{ formerName }}."
113
+ }
114
+ },
115
+
116
+ create(context) {
117
+ const order = context.options[0] || "anyOrder";
118
+ const sourceCode = context.getSourceCode();
119
+
120
+ /**
121
+ * Reports the given accessor pair.
122
+ * @param {string} messageId messageId to report.
123
+ * @param {ASTNode} formerNode getter/setter node that is defined before `latterNode`.
124
+ * @param {ASTNode} latterNode getter/setter node that is defined after `formerNode`.
125
+ * @returns {void}
126
+ * @private
127
+ */
128
+ function report(messageId, formerNode, latterNode) {
129
+ context.report({
130
+ node: latterNode,
131
+ messageId,
132
+ loc: astUtils.getFunctionHeadLoc(latterNode.value, sourceCode),
133
+ data: {
134
+ formerName: astUtils.getFunctionNameWithKind(formerNode.value),
135
+ latterName: astUtils.getFunctionNameWithKind(latterNode.value)
136
+ }
137
+ });
138
+ }
139
+
140
+ /**
141
+ * Creates a new `AccessorData` object for the given getter or setter node.
142
+ * @param {ASTNode} node A getter or setter node.
143
+ * @returns {AccessorData} New `AccessorData` object that contains the given node.
144
+ * @private
145
+ */
146
+ function createAccessorData(node) {
147
+ const name = astUtils.getStaticPropertyName(node);
148
+ const key = (name !== null) ? name : sourceCode.getTokens(node.key);
149
+
150
+ return {
151
+ key,
152
+ getters: node.kind === "get" ? [node] : [],
153
+ setters: node.kind === "set" ? [node] : []
154
+ };
155
+ }
156
+
157
+ /**
158
+ * Merges the given `AccessorData` object into the given accessors list.
159
+ * @param {AccessorData[]} accessors The list to merge into.
160
+ * @param {AccessorData} accessorData The object to merge.
161
+ * @returns {AccessorData[]} The same instance with the merged object.
162
+ * @private
163
+ */
164
+ function mergeAccessorData(accessors, accessorData) {
165
+ const equalKeyElement = accessors.find(a => areEqualKeys(a.key, accessorData.key));
166
+
167
+ if (equalKeyElement) {
168
+ equalKeyElement.getters.push(...accessorData.getters);
169
+ equalKeyElement.setters.push(...accessorData.setters);
170
+ } else {
171
+ accessors.push(accessorData);
172
+ }
173
+
174
+ return accessors;
175
+ }
176
+
177
+ /**
178
+ * Checks accessor pairs in the given list of nodes.
179
+ * @param {ASTNode[]} nodes The list to check.
180
+ * @param {Function} shouldCheck – Predicate that returns `true` if the node should be checked.
181
+ * @returns {void}
182
+ * @private
183
+ */
184
+ function checkList(nodes, shouldCheck) {
185
+ const accessors = nodes
186
+ .filter(shouldCheck)
187
+ .filter(isAccessorKind)
188
+ .map(createAccessorData)
189
+ .reduce(mergeAccessorData, []);
190
+
191
+ for (const { getters, setters } of accessors) {
192
+
193
+ // Don't report accessor properties that have duplicate getters or setters.
194
+ if (getters.length === 1 && setters.length === 1) {
195
+ const [getter] = getters,
196
+ [setter] = setters,
197
+ getterIndex = nodes.indexOf(getter),
198
+ setterIndex = nodes.indexOf(setter),
199
+ formerNode = getterIndex < setterIndex ? getter : setter,
200
+ latterNode = getterIndex < setterIndex ? setter : getter;
201
+
202
+ if (Math.abs(getterIndex - setterIndex) > 1) {
203
+ report("notGrouped", formerNode, latterNode);
204
+ } else if (
205
+ (order === "getBeforeSet" && getterIndex > setterIndex) ||
206
+ (order === "setBeforeGet" && getterIndex < setterIndex)
207
+ ) {
208
+ report("invalidOrder", formerNode, latterNode);
209
+ }
210
+ }
211
+ }
212
+ }
213
+
214
+ return {
215
+ ObjectExpression(node) {
216
+ checkList(node.properties, n => n.type === "Property");
217
+ },
218
+ ClassBody(node) {
219
+ checkList(node.body, n => n.type === "MethodDefinition" && !n.static);
220
+ checkList(node.body, n => n.type === "MethodDefinition" && n.static);
221
+ }
222
+ };
223
+ }
224
+ };
@@ -187,6 +187,7 @@ class BinarySearchTree {
187
187
  */
188
188
  class TokenInfo {
189
189
 
190
+ // eslint-disable-next-line jsdoc/require-description
190
191
  /**
191
192
  * @param {SourceCode} sourceCode A SourceCode object
192
193
  */
@@ -236,6 +237,7 @@ class TokenInfo {
236
237
  */
237
238
  class OffsetStorage {
238
239
 
240
+ // eslint-disable-next-line jsdoc/require-description
239
241
  /**
240
242
  * @param {TokenInfo} tokenInfo a TokenInfo instance
241
243
  * @param {number} indentSize The desired size of each indentation level
@@ -329,7 +331,6 @@ class OffsetStorage {
329
331
  * Instead, the correct way would be to offset `baz` by 1 level from `bar`, offset `bar` by 1 level from the `)`, and
330
332
  * offset the `)` by 0 levels from `foo`. This ensures that the offset between `bar` and the `)` are correctly collapsed
331
333
  * in the second case.
332
- *
333
334
  * @param {Token} token The token
334
335
  * @param {Token} fromToken The token that `token` should be offset from
335
336
  * @param {number} offset The desired indent level
@@ -358,7 +359,6 @@ class OffsetStorage {
358
359
  *
359
360
  * The `setDesiredOffsets` methods inserts ranges like the ones above. The third line above would be inserted by using:
360
361
  * `setDesiredOffsets([30, 43], fooToken, 1);`
361
- *
362
362
  * @param {[number, number]} range A [start, end] pair. All tokens with range[0] <= token.start < range[1] will have the offset applied.
363
363
  * @param {Token} fromToken The token that this is offset from
364
364
  * @param {number} offset The desired indent level
@@ -1492,6 +1492,17 @@ module.exports = {
1492
1492
  );
1493
1493
  },
1494
1494
 
1495
+ JSXSpreadAttribute(node) {
1496
+ const openingCurly = sourceCode.getFirstToken(node);
1497
+ const closingCurly = sourceCode.getLastToken(node);
1498
+
1499
+ offsets.setDesiredOffsets(
1500
+ [openingCurly.range[1], closingCurly.range[0]],
1501
+ openingCurly,
1502
+ 1
1503
+ );
1504
+ },
1505
+
1495
1506
  "*"(node) {
1496
1507
  const firstToken = sourceCode.getFirstToken(node);
1497
1508
 
@@ -52,6 +52,7 @@ module.exports = new LazyLoadingRuleMap(Object.entries({
52
52
  "generator-star-spacing": () => require("./generator-star-spacing"),
53
53
  "getter-return": () => require("./getter-return"),
54
54
  "global-require": () => require("./global-require"),
55
+ "grouped-accessor-pairs": () => require("./grouped-accessor-pairs"),
55
56
  "guard-for-in": () => require("./guard-for-in"),
56
57
  "handle-callback-err": () => require("./handle-callback-err"),
57
58
  "id-blacklist": () => require("./id-blacklist"),
@@ -101,6 +102,7 @@ module.exports = new LazyLoadingRuleMap(Object.entries({
101
102
  "no-console": () => require("./no-console"),
102
103
  "no-const-assign": () => require("./no-const-assign"),
103
104
  "no-constant-condition": () => require("./no-constant-condition"),
105
+ "no-constructor-return": () => require("./no-constructor-return"),
104
106
  "no-continue": () => require("./no-continue"),
105
107
  "no-control-regex": () => require("./no-control-regex"),
106
108
  "no-debugger": () => require("./no-debugger"),
@@ -108,6 +110,7 @@ module.exports = new LazyLoadingRuleMap(Object.entries({
108
110
  "no-div-regex": () => require("./no-div-regex"),
109
111
  "no-dupe-args": () => require("./no-dupe-args"),
110
112
  "no-dupe-class-members": () => require("./no-dupe-class-members"),
113
+ "no-dupe-else-if": () => require("./no-dupe-else-if"),
111
114
  "no-dupe-keys": () => require("./no-dupe-keys"),
112
115
  "no-duplicate-case": () => require("./no-duplicate-case"),
113
116
  "no-duplicate-imports": () => require("./no-duplicate-imports"),
@@ -186,6 +189,7 @@ module.exports = new LazyLoadingRuleMap(Object.entries({
186
189
  "no-self-assign": () => require("./no-self-assign"),
187
190
  "no-self-compare": () => require("./no-self-compare"),
188
191
  "no-sequences": () => require("./no-sequences"),
192
+ "no-setter-return": () => require("./no-setter-return"),
189
193
  "no-shadow": () => require("./no-shadow"),
190
194
  "no-shadow-restricted-names": () => require("./no-shadow-restricted-names"),
191
195
  "no-spaced-func": () => require("./no-spaced-func"),
@@ -238,6 +242,7 @@ module.exports = new LazyLoadingRuleMap(Object.entries({
238
242
  "prefer-arrow-callback": () => require("./prefer-arrow-callback"),
239
243
  "prefer-const": () => require("./prefer-const"),
240
244
  "prefer-destructuring": () => require("./prefer-destructuring"),
245
+ "prefer-exponentiation-operator": () => require("./prefer-exponentiation-operator"),
241
246
  "prefer-named-capture-group": () => require("./prefer-named-capture-group"),
242
247
  "prefer-numeric-literals": () => require("./prefer-numeric-literals"),
243
248
  "prefer-object-spread": () => require("./prefer-object-spread"),
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * Checks whether or not a given node is a for loop.
14
- * @param {ASTNode} block - A node to check.
14
+ * @param {ASTNode} block A node to check.
15
15
  * @returns {boolean} `true` when the node is a for loop.
16
16
  */
17
17
  function isForLoop(block) {
@@ -22,7 +22,7 @@ function isForLoop(block) {
22
22
 
23
23
  /**
24
24
  * Checks whether or not a given declarator node has its initializer.
25
- * @param {ASTNode} node - A declarator node to check.
25
+ * @param {ASTNode} node A declarator node to check.
26
26
  * @returns {boolean} `true` when the node has its initializer.
27
27
  */
28
28
  function isInitialized(node) {
@@ -65,7 +65,7 @@ module.exports = {
65
65
 
66
66
  /**
67
67
  * Checks if the given string literal node uses the expected quotes
68
- * @param {ASTNode} node - A string literal node.
68
+ * @param {ASTNode} node A string literal node.
69
69
  * @returns {boolean} Whether or not the string literal used the expected quotes.
70
70
  * @public
71
71
  */
@@ -41,8 +41,7 @@ const KEYS = keywords.concat(["as", "async", "await", "from", "get", "let", "of"
41
41
 
42
42
  /**
43
43
  * Checks whether or not a given token is a "Template" token ends with "${".
44
- *
45
- * @param {Token} token - A token to check.
44
+ * @param {Token} token A token to check.
46
45
  * @returns {boolean} `true` if the token is a "Template" token ends with "${".
47
46
  */
48
47
  function isOpenParenOfTemplate(token) {
@@ -51,8 +50,7 @@ function isOpenParenOfTemplate(token) {
51
50
 
52
51
  /**
53
52
  * Checks whether or not a given token is a "Template" token starts with "}".
54
- *
55
- * @param {Token} token - A token to check.
53
+ * @param {Token} token A token to check.
56
54
  * @returns {boolean} `true` if the token is a "Template" token starts with "}".
57
55
  */
58
56
  function isCloseParenOfTemplate(token) {
@@ -88,8 +86,8 @@ module.exports = {
88
86
  retv[key] = {
89
87
  type: "object",
90
88
  properties: {
91
- before: { type: "boolean", default: true },
92
- after: { type: "boolean", default: true }
89
+ before: { type: "boolean" },
90
+ after: { type: "boolean" }
93
91
  },
94
92
  additionalProperties: false
95
93
  };
@@ -114,9 +112,8 @@ module.exports = {
114
112
 
115
113
  /**
116
114
  * Reports a given token if there are not space(s) before the token.
117
- *
118
- * @param {Token} token - A token to report.
119
- * @param {RegExp} pattern - A pattern of the previous token to check.
115
+ * @param {Token} token A token to report.
116
+ * @param {RegExp} pattern A pattern of the previous token to check.
120
117
  * @returns {void}
121
118
  */
122
119
  function expectSpaceBefore(token, pattern) {
@@ -141,9 +138,8 @@ module.exports = {
141
138
 
142
139
  /**
143
140
  * Reports a given token if there are space(s) before the token.
144
- *
145
- * @param {Token} token - A token to report.
146
- * @param {RegExp} pattern - A pattern of the previous token to check.
141
+ * @param {Token} token A token to report.
142
+ * @param {RegExp} pattern A pattern of the previous token to check.
147
143
  * @returns {void}
148
144
  */
149
145
  function unexpectSpaceBefore(token, pattern) {
@@ -168,9 +164,8 @@ module.exports = {
168
164
 
169
165
  /**
170
166
  * Reports a given token if there are not space(s) after the token.
171
- *
172
- * @param {Token} token - A token to report.
173
- * @param {RegExp} pattern - A pattern of the next token to check.
167
+ * @param {Token} token A token to report.
168
+ * @param {RegExp} pattern A pattern of the next token to check.
174
169
  * @returns {void}
175
170
  */
176
171
  function expectSpaceAfter(token, pattern) {
@@ -195,9 +190,8 @@ module.exports = {
195
190
 
196
191
  /**
197
192
  * Reports a given token if there are space(s) after the token.
198
- *
199
- * @param {Token} token - A token to report.
200
- * @param {RegExp} pattern - A pattern of the next token to check.
193
+ * @param {Token} token A token to report.
194
+ * @param {RegExp} pattern A pattern of the next token to check.
201
195
  * @returns {void}
202
196
  */
203
197
  function unexpectSpaceAfter(token, pattern) {
@@ -222,8 +216,7 @@ module.exports = {
222
216
 
223
217
  /**
224
218
  * Parses the option object and determines check methods for each keyword.
225
- *
226
- * @param {Object|undefined} options - The option object to parse.
219
+ * @param {Object|undefined} options The option object to parse.
227
220
  * @returns {Object} - Normalized option object.
228
221
  * Keys are keywords (there are for every keyword).
229
222
  * Values are instances of `{"before": function, "after": function}`.
@@ -263,9 +256,8 @@ module.exports = {
263
256
  /**
264
257
  * Reports a given token if usage of spacing followed by the token is
265
258
  * invalid.
266
- *
267
- * @param {Token} token - A token to report.
268
- * @param {RegExp|undefined} pattern - Optional. A pattern of the previous
259
+ * @param {Token} token A token to report.
260
+ * @param {RegExp} [pattern] Optional. A pattern of the previous
269
261
  * token to check.
270
262
  * @returns {void}
271
263
  */
@@ -276,9 +268,8 @@ module.exports = {
276
268
  /**
277
269
  * Reports a given token if usage of spacing preceded by the token is
278
270
  * invalid.
279
- *
280
- * @param {Token} token - A token to report.
281
- * @param {RegExp|undefined} pattern - Optional. A pattern of the next
271
+ * @param {Token} token A token to report.
272
+ * @param {RegExp} [pattern] Optional. A pattern of the next
282
273
  * token to check.
283
274
  * @returns {void}
284
275
  */
@@ -288,8 +279,7 @@ module.exports = {
288
279
 
289
280
  /**
290
281
  * Reports a given token if usage of spacing around the token is invalid.
291
- *
292
- * @param {Token} token - A token to report.
282
+ * @param {Token} token A token to report.
293
283
  * @returns {void}
294
284
  */
295
285
  function checkSpacingAround(token) {
@@ -300,8 +290,7 @@ module.exports = {
300
290
  /**
301
291
  * Reports the first token of a given node if the first token is a keyword
302
292
  * and usage of spacing around the token is invalid.
303
- *
304
- * @param {ASTNode|null} node - A node to report.
293
+ * @param {ASTNode|null} node A node to report.
305
294
  * @returns {void}
306
295
  */
307
296
  function checkSpacingAroundFirstToken(node) {
@@ -318,8 +307,7 @@ module.exports = {
318
307
  *
319
308
  * This is used for unary operators (e.g. `typeof`), `function`, and `super`.
320
309
  * Other rules are handling usage of spacing preceded by those keywords.
321
- *
322
- * @param {ASTNode|null} node - A node to report.
310
+ * @param {ASTNode|null} node A node to report.
323
311
  * @returns {void}
324
312
  */
325
313
  function checkSpacingBeforeFirstToken(node) {
@@ -333,8 +321,7 @@ module.exports = {
333
321
  /**
334
322
  * Reports the previous token of a given node if the token is a keyword and
335
323
  * usage of spacing around the token is invalid.
336
- *
337
- * @param {ASTNode|null} node - A node to report.
324
+ * @param {ASTNode|null} node A node to report.
338
325
  * @returns {void}
339
326
  */
340
327
  function checkSpacingAroundTokenBefore(node) {
@@ -348,8 +335,7 @@ module.exports = {
348
335
  /**
349
336
  * Reports `async` or `function` keywords of a given node if usage of
350
337
  * spacing around those keywords is invalid.
351
- *
352
- * @param {ASTNode} node - A node to report.
338
+ * @param {ASTNode} node A node to report.
353
339
  * @returns {void}
354
340
  */
355
341
  function checkSpacingForFunction(node) {
@@ -366,8 +352,7 @@ module.exports = {
366
352
  /**
367
353
  * Reports `class` and `extends` keywords of a given node if usage of
368
354
  * spacing around those keywords is invalid.
369
- *
370
- * @param {ASTNode} node - A node to report.
355
+ * @param {ASTNode} node A node to report.
371
356
  * @returns {void}
372
357
  */
373
358
  function checkSpacingForClass(node) {
@@ -378,8 +363,7 @@ module.exports = {
378
363
  /**
379
364
  * Reports `if` and `else` keywords of a given node if usage of spacing
380
365
  * around those keywords is invalid.
381
- *
382
- * @param {ASTNode} node - A node to report.
366
+ * @param {ASTNode} node A node to report.
383
367
  * @returns {void}
384
368
  */
385
369
  function checkSpacingForIfStatement(node) {
@@ -390,8 +374,7 @@ module.exports = {
390
374
  /**
391
375
  * Reports `try`, `catch`, and `finally` keywords of a given node if usage
392
376
  * of spacing around those keywords is invalid.
393
- *
394
- * @param {ASTNode} node - A node to report.
377
+ * @param {ASTNode} node A node to report.
395
378
  * @returns {void}
396
379
  */
397
380
  function checkSpacingForTryStatement(node) {
@@ -403,8 +386,7 @@ module.exports = {
403
386
  /**
404
387
  * Reports `do` and `while` keywords of a given node if usage of spacing
405
388
  * around those keywords is invalid.
406
- *
407
- * @param {ASTNode} node - A node to report.
389
+ * @param {ASTNode} node A node to report.
408
390
  * @returns {void}
409
391
  */
410
392
  function checkSpacingForDoWhileStatement(node) {
@@ -415,8 +397,7 @@ module.exports = {
415
397
  /**
416
398
  * Reports `for` and `in` keywords of a given node if usage of spacing
417
399
  * around those keywords is invalid.
418
- *
419
- * @param {ASTNode} node - A node to report.
400
+ * @param {ASTNode} node A node to report.
420
401
  * @returns {void}
421
402
  */
422
403
  function checkSpacingForForInStatement(node) {
@@ -427,8 +408,7 @@ module.exports = {
427
408
  /**
428
409
  * Reports `for` and `of` keywords of a given node if usage of spacing
429
410
  * around those keywords is invalid.
430
- *
431
- * @param {ASTNode} node - A node to report.
411
+ * @param {ASTNode} node A node to report.
432
412
  * @returns {void}
433
413
  */
434
414
  function checkSpacingForForOfStatement(node) {
@@ -449,8 +429,7 @@ module.exports = {
449
429
  *
450
430
  * import*as A from "./a"; /*error Expected space(s) after "import".
451
431
  * error Expected space(s) before "as".
452
- *
453
- * @param {ASTNode} node - A node to report.
432
+ * @param {ASTNode} node A node to report.
454
433
  * @returns {void}
455
434
  */
456
435
  function checkSpacingForModuleDeclaration(node) {
@@ -474,8 +453,7 @@ module.exports = {
474
453
  /**
475
454
  * Reports `as` keyword of a given node if usage of spacing around this
476
455
  * keyword is invalid.
477
- *
478
- * @param {ASTNode} node - A node to report.
456
+ * @param {ASTNode} node A node to report.
479
457
  * @returns {void}
480
458
  */
481
459
  function checkSpacingForImportNamespaceSpecifier(node) {
@@ -487,8 +465,7 @@ module.exports = {
487
465
  /**
488
466
  * Reports `static`, `get`, and `set` keywords of a given node if usage of
489
467
  * spacing around those keywords is invalid.
490
- *
491
- * @param {ASTNode} node - A node to report.
468
+ * @param {ASTNode} node A node to report.
492
469
  * @returns {void}
493
470
  */
494
471
  function checkSpacingForProperty(node) {
@@ -528,8 +505,7 @@ module.exports = {
528
505
  /**
529
506
  * Reports `await` keyword of a given node if usage of spacing before
530
507
  * this keyword is invalid.
531
- *
532
- * @param {ASTNode} node - A node to report.
508
+ * @param {ASTNode} node A node to report.
533
509
  * @returns {void}
534
510
  */
535
511
  function checkSpacingForAwaitExpression(node) {
@@ -131,7 +131,7 @@ module.exports = {
131
131
 
132
132
  /**
133
133
  * Check lines around directives in node
134
- * @param {ASTNode} node - node to check
134
+ * @param {ASTNode} node node to check
135
135
  * @returns {void}
136
136
  */
137
137
  function checkDirectives(node) {
@@ -198,7 +198,6 @@ module.exports = {
198
198
 
199
199
  /**
200
200
  * Ensure that an array exists at [key] on `object`, and add `value` to it.
201
- *
202
201
  * @param {Object} object the object to mutate
203
202
  * @param {string} key the object's key
204
203
  * @param {*} value the value to add
@@ -214,7 +213,6 @@ module.exports = {
214
213
 
215
214
  /**
216
215
  * Retrieves an array containing all strings (" or ') in the source code.
217
- *
218
216
  * @returns {ASTNode[]} An array of string nodes.
219
217
  */
220
218
  function getAllStrings() {
@@ -224,7 +222,6 @@ module.exports = {
224
222
 
225
223
  /**
226
224
  * Retrieves an array containing all template literals in the source code.
227
- *
228
225
  * @returns {ASTNode[]} An array of template literal nodes.
229
226
  */
230
227
  function getAllTemplateLiterals() {
@@ -234,7 +231,6 @@ module.exports = {
234
231
 
235
232
  /**
236
233
  * Retrieves an array containing all RegExp literals in the source code.
237
- *
238
234
  * @returns {ASTNode[]} An array of RegExp literal nodes.
239
235
  */
240
236
  function getAllRegExpLiterals() {
@@ -244,7 +240,6 @@ module.exports = {
244
240
 
245
241
  /**
246
242
  * A reducer to group an AST node by line number, both start and end.
247
- *
248
243
  * @param {Object} acc the accumulator
249
244
  * @param {ASTNode} node the AST node in question
250
245
  * @returns {Object} the modified accumulator