eslint 5.7.0 → 5.11.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 (284) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +2 -2
  3. package/conf/eslint-recommended.js +1 -0
  4. package/lib/cli-engine.js +129 -32
  5. package/lib/cli.js +6 -1
  6. package/lib/config/autoconfig.js +0 -1
  7. package/lib/config/config-rule.js +4 -4
  8. package/lib/config/config-validator.js +2 -2
  9. package/lib/config.js +15 -2
  10. package/lib/linter.js +17 -120
  11. package/lib/options.js +5 -0
  12. package/lib/rules/accessor-pairs.js +4 -0
  13. package/lib/rules/array-bracket-newline.js +5 -0
  14. package/lib/rules/array-bracket-spacing.js +5 -0
  15. package/lib/rules/array-callback-return.js +2 -0
  16. package/lib/rules/array-element-newline.js +4 -1
  17. package/lib/rules/arrow-body-style.js +2 -0
  18. package/lib/rules/arrow-parens.js +2 -0
  19. package/lib/rules/arrow-spacing.js +2 -0
  20. package/lib/rules/block-scoped-var.js +2 -0
  21. package/lib/rules/block-spacing.js +2 -0
  22. package/lib/rules/brace-style.js +2 -0
  23. package/lib/rules/callback-return.js +2 -0
  24. package/lib/rules/camelcase.js +26 -14
  25. package/lib/rules/capitalized-comments.js +4 -0
  26. package/lib/rules/class-methods-use-this.js +3 -0
  27. package/lib/rules/comma-dangle.js +4 -0
  28. package/lib/rules/comma-spacing.js +2 -0
  29. package/lib/rules/comma-style.js +12 -2
  30. package/lib/rules/complexity.js +2 -0
  31. package/lib/rules/computed-property-spacing.js +2 -0
  32. package/lib/rules/consistent-return.js +2 -0
  33. package/lib/rules/consistent-this.js +2 -0
  34. package/lib/rules/constructor-super.js +2 -0
  35. package/lib/rules/curly.js +2 -0
  36. package/lib/rules/default-case.js +2 -0
  37. package/lib/rules/dot-location.js +2 -0
  38. package/lib/rules/dot-notation.js +2 -0
  39. package/lib/rules/eol-last.js +5 -0
  40. package/lib/rules/eqeqeq.js +2 -1
  41. package/lib/rules/for-direction.js +4 -0
  42. package/lib/rules/func-call-spacing.js +4 -0
  43. package/lib/rules/func-name-matching.js +3 -0
  44. package/lib/rules/func-names.js +3 -0
  45. package/lib/rules/func-style.js +3 -0
  46. package/lib/rules/function-paren-newline.js +5 -0
  47. package/lib/rules/generator-star-spacing.js +3 -0
  48. package/lib/rules/getter-return.js +5 -0
  49. package/lib/rules/global-require.js +2 -0
  50. package/lib/rules/guard-for-in.js +2 -0
  51. package/lib/rules/handle-callback-err.js +3 -1
  52. package/lib/rules/id-blacklist.js +2 -0
  53. package/lib/rules/id-length.js +2 -0
  54. package/lib/rules/id-match.js +101 -27
  55. package/lib/rules/implicit-arrow-linebreak.js +147 -2
  56. package/lib/rules/indent-legacy.js +4 -4
  57. package/lib/rules/indent.js +31 -23
  58. package/lib/rules/init-declarations.js +2 -0
  59. package/lib/rules/jsx-quotes.js +2 -0
  60. package/lib/rules/key-spacing.js +4 -3
  61. package/lib/rules/keyword-spacing.js +7 -1
  62. package/lib/rules/line-comment-position.js +2 -0
  63. package/lib/rules/linebreak-style.js +2 -0
  64. package/lib/rules/lines-around-comment.js +2 -0
  65. package/lib/rules/lines-around-directive.js +6 -2
  66. package/lib/rules/lines-between-class-members.js +2 -0
  67. package/lib/rules/max-classes-per-file.js +4 -0
  68. package/lib/rules/max-depth.js +2 -0
  69. package/lib/rules/max-len.js +2 -0
  70. package/lib/rules/max-lines-per-function.js +2 -0
  71. package/lib/rules/max-lines.js +2 -0
  72. package/lib/rules/max-nested-callbacks.js +2 -0
  73. package/lib/rules/max-params.js +2 -0
  74. package/lib/rules/max-statements-per-line.js +2 -0
  75. package/lib/rules/max-statements.js +2 -0
  76. package/lib/rules/multiline-comment-style.js +3 -0
  77. package/lib/rules/multiline-ternary.js +3 -0
  78. package/lib/rules/new-cap.js +2 -0
  79. package/lib/rules/new-parens.js +2 -1
  80. package/lib/rules/newline-after-var.js +5 -2
  81. package/lib/rules/newline-before-return.js +6 -3
  82. package/lib/rules/newline-per-chained-call.js +4 -0
  83. package/lib/rules/no-alert.js +2 -0
  84. package/lib/rules/no-array-constructor.js +2 -0
  85. package/lib/rules/no-async-promise-executor.js +3 -0
  86. package/lib/rules/no-await-in-loop.js +4 -0
  87. package/lib/rules/no-bitwise.js +2 -0
  88. package/lib/rules/no-buffer-constructor.js +4 -0
  89. package/lib/rules/no-caller.js +2 -0
  90. package/lib/rules/no-case-declarations.js +2 -0
  91. package/lib/rules/no-catch-shadow.js +6 -3
  92. package/lib/rules/no-class-assign.js +2 -0
  93. package/lib/rules/no-compare-neg-zero.js +4 -0
  94. package/lib/rules/no-cond-assign.js +2 -0
  95. package/lib/rules/no-confusing-arrow.js +2 -0
  96. package/lib/rules/no-console.js +2 -0
  97. package/lib/rules/no-const-assign.js +2 -0
  98. package/lib/rules/no-constant-condition.js +2 -1
  99. package/lib/rules/no-continue.js +2 -0
  100. package/lib/rules/no-control-regex.js +4 -2
  101. package/lib/rules/no-debugger.js +4 -0
  102. package/lib/rules/no-delete-var.js +2 -0
  103. package/lib/rules/no-div-regex.js +2 -0
  104. package/lib/rules/no-dupe-args.js +2 -0
  105. package/lib/rules/no-dupe-class-members.js +2 -0
  106. package/lib/rules/no-dupe-keys.js +2 -0
  107. package/lib/rules/no-duplicate-case.js +2 -0
  108. package/lib/rules/no-duplicate-imports.js +2 -0
  109. package/lib/rules/no-else-return.js +2 -1
  110. package/lib/rules/no-empty-character-class.js +2 -0
  111. package/lib/rules/no-empty-function.js +2 -0
  112. package/lib/rules/no-empty-pattern.js +2 -0
  113. package/lib/rules/no-empty.js +2 -0
  114. package/lib/rules/no-eq-null.js +2 -0
  115. package/lib/rules/no-eval.js +2 -0
  116. package/lib/rules/no-ex-assign.js +2 -0
  117. package/lib/rules/no-extend-native.js +2 -0
  118. package/lib/rules/no-extra-bind.js +2 -1
  119. package/lib/rules/no-extra-boolean-cast.js +2 -1
  120. package/lib/rules/no-extra-label.js +2 -1
  121. package/lib/rules/no-extra-parens.js +5 -6
  122. package/lib/rules/no-extra-semi.js +2 -0
  123. package/lib/rules/no-fallthrough.js +2 -0
  124. package/lib/rules/no-floating-decimal.js +2 -1
  125. package/lib/rules/no-func-assign.js +2 -0
  126. package/lib/rules/no-global-assign.js +2 -0
  127. package/lib/rules/no-implicit-coercion.js +3 -0
  128. package/lib/rules/no-implicit-globals.js +2 -0
  129. package/lib/rules/no-implied-eval.js +3 -1
  130. package/lib/rules/no-inline-comments.js +2 -0
  131. package/lib/rules/no-inner-declarations.js +2 -0
  132. package/lib/rules/no-invalid-regexp.js +2 -0
  133. package/lib/rules/no-invalid-this.js +2 -0
  134. package/lib/rules/no-irregular-whitespace.js +7 -9
  135. package/lib/rules/no-iterator.js +2 -0
  136. package/lib/rules/no-label-var.js +2 -0
  137. package/lib/rules/no-labels.js +2 -0
  138. package/lib/rules/no-lone-blocks.js +2 -0
  139. package/lib/rules/no-lonely-if.js +2 -1
  140. package/lib/rules/no-loop-func.js +2 -0
  141. package/lib/rules/no-magic-numbers.js +3 -0
  142. package/lib/rules/no-misleading-character-class.js +4 -0
  143. package/lib/rules/no-mixed-operators.js +3 -0
  144. package/lib/rules/no-mixed-requires.js +2 -0
  145. package/lib/rules/no-mixed-spaces-and-tabs.js +2 -0
  146. package/lib/rules/no-multi-assign.js +3 -0
  147. package/lib/rules/no-multi-spaces.js +2 -0
  148. package/lib/rules/no-multi-str.js +2 -0
  149. package/lib/rules/no-multiple-empty-lines.js +2 -0
  150. package/lib/rules/no-native-reassign.js +4 -1
  151. package/lib/rules/no-negated-condition.js +2 -0
  152. package/lib/rules/no-negated-in-lhs.js +5 -2
  153. package/lib/rules/no-nested-ternary.js +2 -0
  154. package/lib/rules/no-new-func.js +2 -0
  155. package/lib/rules/no-new-object.js +2 -0
  156. package/lib/rules/no-new-require.js +2 -0
  157. package/lib/rules/no-new-symbol.js +2 -0
  158. package/lib/rules/no-new-wrappers.js +2 -0
  159. package/lib/rules/no-new.js +2 -0
  160. package/lib/rules/no-obj-calls.js +2 -0
  161. package/lib/rules/no-octal-escape.js +2 -0
  162. package/lib/rules/no-octal.js +2 -0
  163. package/lib/rules/no-param-reassign.js +2 -0
  164. package/lib/rules/no-path-concat.js +2 -0
  165. package/lib/rules/no-plusplus.js +2 -0
  166. package/lib/rules/no-process-env.js +2 -0
  167. package/lib/rules/no-process-exit.js +2 -0
  168. package/lib/rules/no-proto.js +2 -0
  169. package/lib/rules/no-prototype-builtins.js +2 -0
  170. package/lib/rules/no-redeclare.js +2 -0
  171. package/lib/rules/no-regex-spaces.js +2 -1
  172. package/lib/rules/no-restricted-globals.js +2 -0
  173. package/lib/rules/no-restricted-imports.js +41 -23
  174. package/lib/rules/no-restricted-modules.js +2 -0
  175. package/lib/rules/no-restricted-properties.js +2 -0
  176. package/lib/rules/no-restricted-syntax.js +2 -0
  177. package/lib/rules/no-return-assign.js +2 -0
  178. package/lib/rules/no-return-await.js +4 -0
  179. package/lib/rules/no-script-url.js +2 -0
  180. package/lib/rules/no-self-assign.js +2 -0
  181. package/lib/rules/no-self-compare.js +2 -0
  182. package/lib/rules/no-sequences.js +2 -0
  183. package/lib/rules/no-shadow-restricted-names.js +2 -0
  184. package/lib/rules/no-shadow.js +2 -0
  185. package/lib/rules/no-spaced-func.js +4 -1
  186. package/lib/rules/no-sparse-arrays.js +2 -0
  187. package/lib/rules/no-sync.js +2 -0
  188. package/lib/rules/no-tabs.js +2 -0
  189. package/lib/rules/no-template-curly-in-string.js +2 -0
  190. package/lib/rules/no-ternary.js +2 -0
  191. package/lib/rules/no-this-before-super.js +2 -1
  192. package/lib/rules/no-throw-literal.js +2 -0
  193. package/lib/rules/no-trailing-spaces.js +2 -0
  194. package/lib/rules/no-undef-init.js +2 -1
  195. package/lib/rules/no-undef.js +2 -0
  196. package/lib/rules/no-undefined.js +2 -0
  197. package/lib/rules/no-underscore-dangle.js +2 -0
  198. package/lib/rules/no-unexpected-multiline.js +2 -0
  199. package/lib/rules/no-unmodified-loop-condition.js +2 -0
  200. package/lib/rules/no-unneeded-ternary.js +2 -0
  201. package/lib/rules/no-unreachable.js +2 -1
  202. package/lib/rules/no-unsafe-finally.js +2 -0
  203. package/lib/rules/no-unsafe-negation.js +3 -0
  204. package/lib/rules/no-unused-expressions.js +2 -0
  205. package/lib/rules/no-unused-labels.js +2 -1
  206. package/lib/rules/no-unused-vars.js +36 -12
  207. package/lib/rules/no-use-before-define.js +2 -0
  208. package/lib/rules/no-useless-call.js +2 -0
  209. package/lib/rules/no-useless-catch.js +51 -0
  210. package/lib/rules/no-useless-computed-key.js +2 -1
  211. package/lib/rules/no-useless-concat.js +2 -0
  212. package/lib/rules/no-useless-constructor.js +2 -0
  213. package/lib/rules/no-useless-escape.js +2 -0
  214. package/lib/rules/no-useless-rename.js +4 -0
  215. package/lib/rules/no-useless-return.js +3 -0
  216. package/lib/rules/no-var.js +2 -0
  217. package/lib/rules/no-void.js +2 -0
  218. package/lib/rules/no-warning-comments.js +2 -0
  219. package/lib/rules/no-whitespace-before-property.js +2 -0
  220. package/lib/rules/no-with.js +2 -0
  221. package/lib/rules/nonblock-statement-body-position.js +4 -0
  222. package/lib/rules/object-curly-newline.js +4 -1
  223. package/lib/rules/object-curly-spacing.js +2 -0
  224. package/lib/rules/object-property-newline.js +3 -2
  225. package/lib/rules/object-shorthand.js +2 -0
  226. package/lib/rules/one-var-declaration-per-line.js +2 -0
  227. package/lib/rules/one-var.js +2 -1
  228. package/lib/rules/operator-assignment.js +2 -0
  229. package/lib/rules/operator-linebreak.js +2 -0
  230. package/lib/rules/padded-blocks.js +2 -0
  231. package/lib/rules/padding-line-between-statements.js +41 -0
  232. package/lib/rules/prefer-arrow-callback.js +2 -0
  233. package/lib/rules/prefer-const.js +116 -11
  234. package/lib/rules/prefer-destructuring.js +3 -0
  235. package/lib/rules/prefer-numeric-literals.js +2 -1
  236. package/lib/rules/prefer-object-spread.js +4 -0
  237. package/lib/rules/prefer-promise-reject-errors.js +4 -0
  238. package/lib/rules/prefer-reflect.js +4 -1
  239. package/lib/rules/prefer-rest-params.js +2 -0
  240. package/lib/rules/prefer-spread.js +2 -1
  241. package/lib/rules/prefer-template.js +2 -1
  242. package/lib/rules/quote-props.js +2 -0
  243. package/lib/rules/quotes.js +50 -25
  244. package/lib/rules/radix.js +2 -0
  245. package/lib/rules/require-atomic-updates.js +4 -0
  246. package/lib/rules/require-await.js +3 -0
  247. package/lib/rules/require-jsdoc.js +6 -1
  248. package/lib/rules/require-unicode-regexp.js +4 -0
  249. package/lib/rules/require-yield.js +2 -0
  250. package/lib/rules/rest-spread-spacing.js +4 -0
  251. package/lib/rules/semi-spacing.js +2 -0
  252. package/lib/rules/semi-style.js +3 -0
  253. package/lib/rules/semi.js +2 -0
  254. package/lib/rules/sort-imports.js +2 -0
  255. package/lib/rules/sort-keys.js +3 -0
  256. package/lib/rules/sort-vars.js +2 -0
  257. package/lib/rules/space-before-blocks.js +46 -35
  258. package/lib/rules/space-before-function-paren.js +2 -0
  259. package/lib/rules/space-in-parens.js +2 -1
  260. package/lib/rules/space-infix-ops.js +6 -1
  261. package/lib/rules/space-unary-ops.js +2 -0
  262. package/lib/rules/spaced-comment.js +2 -0
  263. package/lib/rules/strict.js +2 -0
  264. package/lib/rules/switch-colon-spacing.js +4 -0
  265. package/lib/rules/symbol-description.js +2 -0
  266. package/lib/rules/template-curly-spacing.js +2 -0
  267. package/lib/rules/template-tag-spacing.js +2 -0
  268. package/lib/rules/unicode-bom.js +2 -0
  269. package/lib/rules/use-isnan.js +2 -0
  270. package/lib/rules/valid-jsdoc.js +6 -1
  271. package/lib/rules/valid-typeof.js +2 -0
  272. package/lib/rules/vars-on-top.js +2 -0
  273. package/lib/rules/wrap-iife.js +2 -0
  274. package/lib/rules/wrap-regex.js +3 -1
  275. package/lib/rules/yield-star-spacing.js +2 -0
  276. package/lib/rules/yoda.js +2 -0
  277. package/lib/testers/rule-tester.js +2 -2
  278. package/lib/util/config-comment-parser.js +144 -0
  279. package/lib/util/glob-utils.js +1 -1
  280. package/lib/{ignored-paths.js → util/ignored-paths.js} +4 -4
  281. package/lib/{report-translator.js → util/report-translator.js} +2 -2
  282. package/lib/util/source-code.js +2 -1
  283. package/messages/all-files-ignored.txt +1 -1
  284. package/package.json +10 -11
@@ -11,16 +11,19 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "layout",
15
+
14
16
  docs: {
15
17
  description: "require an empty line before `return` statements",
16
18
  category: "Stylistic Issues",
17
19
  recommended: false,
18
- replacedBy: ["padding-line-between-statements"],
19
20
  url: "https://eslint.org/docs/rules/newline-before-return"
20
21
  },
22
+
21
23
  fixable: "whitespace",
22
24
  schema: [],
23
- deprecated: true
25
+ deprecated: true,
26
+ replacedBy: ["padding-line-between-statements"]
24
27
  },
25
28
 
26
29
  create(context) {
@@ -33,7 +36,7 @@ module.exports = {
33
36
  /**
34
37
  * Tests whether node is preceded by supplied tokens
35
38
  * @param {ASTNode} node - node to check
36
- * @param {array} testTokens - array of tokens to test against
39
+ * @param {Array} testTokens - array of tokens to test against
37
40
  * @returns {boolean} Whether or not the node is preceded by one of the supplied tokens
38
41
  * @private
39
42
  */
@@ -14,13 +14,17 @@ const astUtils = require("../util/ast-utils");
14
14
 
15
15
  module.exports = {
16
16
  meta: {
17
+ type: "layout",
18
+
17
19
  docs: {
18
20
  description: "require a newline after each call in a method chain",
19
21
  category: "Stylistic Issues",
20
22
  recommended: false,
21
23
  url: "https://eslint.org/docs/rules/newline-per-chained-call"
22
24
  },
25
+
23
26
  fixable: "whitespace",
27
+
24
28
  schema: [{
25
29
  type: "object",
26
30
  properties: {
@@ -74,6 +74,8 @@ function isGlobalThisReferenceOrGlobalWindow(scope, node) {
74
74
 
75
75
  module.exports = {
76
76
  meta: {
77
+ type: "suggestion",
78
+
77
79
  docs: {
78
80
  description: "disallow the use of `alert`, `confirm`, and `prompt`",
79
81
  category: "Best Practices",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow `Array` constructors",
16
18
  category: "Stylistic Issues",
@@ -10,12 +10,15 @@
10
10
 
11
11
  module.exports = {
12
12
  meta: {
13
+ type: "problem",
14
+
13
15
  docs: {
14
16
  description: "disallow using an async function as a Promise executor",
15
17
  category: "Possible Errors",
16
18
  recommended: false,
17
19
  url: "https://eslint.org/docs/rules/no-async-promise-executor"
18
20
  },
21
+
19
22
  fixable: null,
20
23
  schema: []
21
24
  },
@@ -55,13 +55,17 @@ function isLooped(node, parent) {
55
55
 
56
56
  module.exports = {
57
57
  meta: {
58
+ type: "problem",
59
+
58
60
  docs: {
59
61
  description: "disallow `await` inside of loops",
60
62
  category: "Possible Errors",
61
63
  recommended: false,
62
64
  url: "https://eslint.org/docs/rules/no-await-in-loop"
63
65
  },
66
+
64
67
  schema: [],
68
+
65
69
  messages: {
66
70
  unexpectedAwait: "Unexpected `await` inside a loop."
67
71
  }
@@ -22,6 +22,8 @@ const BITWISE_OPERATORS = [
22
22
 
23
23
  module.exports = {
24
24
  meta: {
25
+ type: "suggestion",
26
+
25
27
  docs: {
26
28
  description: "disallow bitwise operators",
27
29
  category: "Stylistic Issues",
@@ -10,13 +10,17 @@
10
10
 
11
11
  module.exports = {
12
12
  meta: {
13
+ type: "problem",
14
+
13
15
  docs: {
14
16
  description: "disallow use of the `Buffer()` constructor",
15
17
  category: "Node.js and CommonJS",
16
18
  recommended: false,
17
19
  url: "https://eslint.org/docs/rules/no-buffer-constructor"
18
20
  },
21
+
19
22
  schema: [],
23
+
20
24
  messages: {
21
25
  deprecated: "{{expr}} is deprecated. Use Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe() instead."
22
26
  }
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow the use of `arguments.caller` or `arguments.callee`",
16
18
  category: "Best Practices",
@@ -10,6 +10,8 @@
10
10
 
11
11
  module.exports = {
12
12
  meta: {
13
+ type: "suggestion",
14
+
13
15
  docs: {
14
16
  description: "disallow lexical declarations in case clauses",
15
17
  category: "Best Practices",
@@ -18,15 +18,18 @@ const astUtils = require("../util/ast-utils");
18
18
 
19
19
  module.exports = {
20
20
  meta: {
21
+ type: "suggestion",
22
+
21
23
  docs: {
22
24
  description: "disallow `catch` clause parameters from shadowing variables in the outer scope",
23
25
  category: "Variables",
24
26
  recommended: false,
25
- url: "https://eslint.org/docs/rules/no-catch-shadow",
26
- replacedBy: ["no-shadow"]
27
+ url: "https://eslint.org/docs/rules/no-catch-shadow"
27
28
  },
28
- deprecated: true,
29
29
 
30
+ replacedBy: ["no-shadow"],
31
+
32
+ deprecated: true,
30
33
  schema: [],
31
34
 
32
35
  messages: {
@@ -13,6 +13,8 @@ const astUtils = require("../util/ast-utils");
13
13
 
14
14
  module.exports = {
15
15
  meta: {
16
+ type: "problem",
17
+
16
18
  docs: {
17
19
  description: "disallow reassigning class members",
18
20
  category: "ECMAScript 6",
@@ -10,14 +10,18 @@
10
10
 
11
11
  module.exports = {
12
12
  meta: {
13
+ type: "problem",
14
+
13
15
  docs: {
14
16
  description: "disallow comparing against -0",
15
17
  category: "Possible Errors",
16
18
  recommended: true,
17
19
  url: "https://eslint.org/docs/rules/no-compare-neg-zero"
18
20
  },
21
+
19
22
  fixable: null,
20
23
  schema: [],
24
+
21
25
  messages: {
22
26
  unexpected: "Do not use the '{{operator}}' operator to compare against -0."
23
27
  }
@@ -19,6 +19,8 @@ const NODE_DESCRIPTIONS = {
19
19
 
20
20
  module.exports = {
21
21
  meta: {
22
+ type: "problem",
23
+
22
24
  docs: {
23
25
  description: "disallow assignment operators in conditional expressions",
24
26
  category: "Possible Errors",
@@ -27,6 +27,8 @@ function isConditional(node) {
27
27
 
28
28
  module.exports = {
29
29
  meta: {
30
+ type: "suggestion",
31
+
30
32
  docs: {
31
33
  description: "disallow arrow functions where they could be confused with comparisons",
32
34
  category: "ECMAScript 6",
@@ -17,6 +17,8 @@ const astUtils = require("../util/ast-utils");
17
17
 
18
18
  module.exports = {
19
19
  meta: {
20
+ type: "suggestion",
21
+
20
22
  docs: {
21
23
  description: "disallow the use of `console`",
22
24
  category: "Possible Errors",
@@ -13,6 +13,8 @@ const astUtils = require("../util/ast-utils");
13
13
 
14
14
  module.exports = {
15
15
  meta: {
16
+ type: "problem",
17
+
16
18
  docs: {
17
19
  description: "disallow reassigning `const` variables",
18
20
  category: "ECMAScript 6",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "problem",
15
+
14
16
  docs: {
15
17
  description: "disallow constant expressions in conditions",
16
18
  category: "Possible Errors",
@@ -171,7 +173,6 @@ module.exports = {
171
173
 
172
174
  /**
173
175
  * Reports when the set still contains stored constant conditions
174
- * @param {ASTNode} node The AST node to check.
175
176
  * @returns {void}
176
177
  * @private
177
178
  */
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow `continue` statements",
16
18
  category: "Stylistic Issues",
@@ -6,7 +6,7 @@
6
6
  "use strict";
7
7
 
8
8
  const RegExpValidator = require("regexpp").RegExpValidator;
9
- const collector = new class {
9
+ const collector = new (class {
10
10
  constructor() {
11
11
  this.ecmaVersion = 2018;
12
12
  this._source = "";
@@ -41,7 +41,7 @@ const collector = new class {
41
41
  }
42
42
  return this._controlChars;
43
43
  }
44
- }();
44
+ })();
45
45
 
46
46
  //------------------------------------------------------------------------------
47
47
  // Rule Definition
@@ -49,6 +49,8 @@ const collector = new class {
49
49
 
50
50
  module.exports = {
51
51
  meta: {
52
+ type: "problem",
53
+
52
54
  docs: {
53
55
  description: "disallow control characters in regular expressions",
54
56
  category: "Possible Errors",
@@ -11,14 +11,18 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "problem",
15
+
14
16
  docs: {
15
17
  description: "disallow the use of `debugger`",
16
18
  category: "Possible Errors",
17
19
  recommended: true,
18
20
  url: "https://eslint.org/docs/rules/no-debugger"
19
21
  },
22
+
20
23
  fixable: null,
21
24
  schema: [],
25
+
22
26
  messages: {
23
27
  unexpected: "Unexpected 'debugger' statement."
24
28
  }
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow deleting variables",
16
18
  category: "Variables",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow division operators explicitly at the beginning of regular expressions",
16
18
  category: "Best Practices",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "problem",
15
+
14
16
  docs: {
15
17
  description: "disallow duplicate arguments in `function` definitions",
16
18
  category: "Possible Errors",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "problem",
15
+
14
16
  docs: {
15
17
  description: "disallow duplicate class members",
16
18
  category: "ECMAScript 6",
@@ -84,6 +84,8 @@ class ObjectInfo {
84
84
 
85
85
  module.exports = {
86
86
  meta: {
87
+ type: "problem",
88
+
87
89
  docs: {
88
90
  description: "disallow duplicate keys in object literals",
89
91
  category: "Possible Errors",
@@ -12,6 +12,8 @@
12
12
 
13
13
  module.exports = {
14
14
  meta: {
15
+ type: "problem",
16
+
15
17
  docs: {
16
18
  description: "disallow duplicate case labels",
17
19
  category: "Possible Errors",
@@ -101,6 +101,8 @@ function handleExports(context, importsInFile, exportsInFile) {
101
101
 
102
102
  module.exports = {
103
103
  meta: {
104
+ type: "problem",
105
+
104
106
  docs: {
105
107
  description: "disallow duplicate module imports",
106
108
  category: "ECMAScript 6",
@@ -18,6 +18,8 @@ const FixTracker = require("../util/fix-tracker");
18
18
 
19
19
  module.exports = {
20
20
  meta: {
21
+ type: "suggestion",
22
+
21
23
  docs: {
22
24
  description: "disallow `else` blocks after `return` statements in `if` statements",
23
25
  category: "Best Practices",
@@ -181,7 +183,6 @@ module.exports = {
181
183
  * code paths.
182
184
  *
183
185
  * @param {Node} node The consequent or body node
184
- * @param {Node} alternate The alternate node
185
186
  * @returns {boolean} `true` if it is a Return/If node that always returns.
186
187
  */
187
188
  function checkForReturnOrIf(node) {
@@ -29,6 +29,8 @@ const regex = /^\/([^\\[]|\\.|\[([^\\\]]|\\.)+])*\/[gimuys]*$/;
29
29
 
30
30
  module.exports = {
31
31
  meta: {
32
+ type: "problem",
33
+
32
34
  docs: {
33
35
  description: "disallow empty character classes in regular expressions",
34
36
  category: "Possible Errors",
@@ -90,6 +90,8 @@ function getKind(node) {
90
90
 
91
91
  module.exports = {
92
92
  meta: {
93
+ type: "suggestion",
94
+
93
95
  docs: {
94
96
  description: "disallow empty functions",
95
97
  category: "Best Practices",
@@ -10,6 +10,8 @@
10
10
 
11
11
  module.exports = {
12
12
  meta: {
13
+ type: "problem",
14
+
13
15
  docs: {
14
16
  description: "disallow empty destructuring patterns",
15
17
  category: "Best Practices",
@@ -16,6 +16,8 @@ const astUtils = require("../util/ast-utils");
16
16
 
17
17
  module.exports = {
18
18
  meta: {
19
+ type: "suggestion",
20
+
19
21
  docs: {
20
22
  description: "disallow empty block statements",
21
23
  category: "Possible Errors",
@@ -12,6 +12,8 @@
12
12
 
13
13
  module.exports = {
14
14
  meta: {
15
+ type: "suggestion",
16
+
15
17
  docs: {
16
18
  description: "disallow `null` comparisons without type-checking operators",
17
19
  category: "Best Practices",
@@ -76,6 +76,8 @@ function isMember(node, name) {
76
76
 
77
77
  module.exports = {
78
78
  meta: {
79
+ type: "suggestion",
80
+
79
81
  docs: {
80
82
  description: "disallow the use of `eval()`",
81
83
  category: "Best Practices",
@@ -13,6 +13,8 @@ const astUtils = require("../util/ast-utils");
13
13
 
14
14
  module.exports = {
15
15
  meta: {
16
+ type: "problem",
17
+
16
18
  docs: {
17
19
  description: "disallow reassigning exceptions in `catch` clauses",
18
20
  category: "Possible Errors",
@@ -24,6 +24,8 @@ const propertyDefinitionMethods = new Set(["defineProperty", "defineProperties"]
24
24
 
25
25
  module.exports = {
26
26
  meta: {
27
+ type: "suggestion",
28
+
27
29
  docs: {
28
30
  description: "disallow extending native types",
29
31
  category: "Best Practices",
@@ -22,6 +22,8 @@ const SIDE_EFFECT_FREE_NODE_TYPES = new Set(["Literal", "Identifier", "ThisExpre
22
22
 
23
23
  module.exports = {
24
24
  meta: {
25
+ type: "suggestion",
26
+
25
27
  docs: {
26
28
  description: "disallow unnecessary calls to `.bind()`",
27
29
  category: "Best Practices",
@@ -30,7 +32,6 @@ module.exports = {
30
32
  },
31
33
 
32
34
  schema: [],
33
-
34
35
  fixable: "code",
35
36
 
36
37
  messages: {
@@ -17,6 +17,8 @@ const astUtils = require("../util/ast-utils");
17
17
 
18
18
  module.exports = {
19
19
  meta: {
20
+ type: "suggestion",
21
+
20
22
  docs: {
21
23
  description: "disallow unnecessary boolean casts",
22
24
  category: "Possible Errors",
@@ -25,7 +27,6 @@ module.exports = {
25
27
  },
26
28
 
27
29
  schema: [],
28
-
29
30
  fixable: "code",
30
31
 
31
32
  messages: {
@@ -17,6 +17,8 @@ const astUtils = require("../util/ast-utils");
17
17
 
18
18
  module.exports = {
19
19
  meta: {
20
+ type: "suggestion",
21
+
20
22
  docs: {
21
23
  description: "disallow unnecessary labels",
22
24
  category: "Best Practices",
@@ -25,7 +27,6 @@ module.exports = {
25
27
  },
26
28
 
27
29
  schema: [],
28
-
29
30
  fixable: "code",
30
31
 
31
32
  messages: {
@@ -12,6 +12,8 @@ const astUtils = require("../util/ast-utils.js");
12
12
 
13
13
  module.exports = {
14
14
  meta: {
15
+ type: "layout",
16
+
15
17
  docs: {
16
18
  description: "disallow unnecessary parentheses",
17
19
  category: "Possible Errors",
@@ -382,8 +384,7 @@ module.exports = {
382
384
  * Allow extra parens around a new expression if
383
385
  * there are intervening parentheses.
384
386
  */
385
- callee.type === "MemberExpression" &&
386
- doesMemberExpressionContainCallExpression(callee)
387
+ (callee.type === "MemberExpression" && doesMemberExpressionContainCallExpression(callee))
387
388
  )
388
389
  ) {
389
390
  report(node.callee);
@@ -574,15 +575,13 @@ module.exports = {
574
575
  * If `let` is the only thing on the left side of the loop, it's the loop variable: `for ((let) of foo);`
575
576
  * Removing it will cause a syntax error, because it will be parsed as the start of a VariableDeclarator.
576
577
  */
577
- firstLeftToken.range[1] === node.left.range[1] ||
578
-
579
- /*
578
+ (firstLeftToken.range[1] === node.left.range[1] || /*
580
579
  * If `let` is followed by a `[` token, it's a property access on the `let` value: `for ((let[foo]) of bar);`
581
580
  * Removing it will cause the property access to be parsed as a destructuring declaration of `foo` instead.
582
581
  */
583
582
  astUtils.isOpeningBracketToken(
584
583
  sourceCode.getTokenAfter(firstLeftToken, astUtils.isNotClosingParenToken)
585
- )
584
+ ))
586
585
  )
587
586
  ) {
588
587
  tokensToIgnore.add(firstLeftToken);
@@ -18,6 +18,8 @@ const astUtils = require("../util/ast-utils");
18
18
 
19
19
  module.exports = {
20
20
  meta: {
21
+ type: "suggestion",
22
+
21
23
  docs: {
22
24
  description: "disallow unnecessary semicolons",
23
25
  category: "Possible Errors",
@@ -55,6 +55,8 @@ function hasBlankLinesBetween(node, token) {
55
55
 
56
56
  module.exports = {
57
57
  meta: {
58
+ type: "problem",
59
+
58
60
  docs: {
59
61
  description: "disallow fallthrough of `case` statements",
60
62
  category: "Best Practices",
@@ -17,6 +17,8 @@ const astUtils = require("../util/ast-utils");
17
17
 
18
18
  module.exports = {
19
19
  meta: {
20
+ type: "suggestion",
21
+
20
22
  docs: {
21
23
  description: "disallow leading or trailing decimal points in numeric literals",
22
24
  category: "Best Practices",
@@ -25,7 +27,6 @@ module.exports = {
25
27
  },
26
28
 
27
29
  schema: [],
28
-
29
30
  fixable: "code"
30
31
  },
31
32
 
@@ -13,6 +13,8 @@ const astUtils = require("../util/ast-utils");
13
13
 
14
14
  module.exports = {
15
15
  meta: {
16
+ type: "problem",
17
+
16
18
  docs: {
17
19
  description: "disallow reassigning `function` declarations",
18
20
  category: "Possible Errors",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow assignments to native objects or read-only global variables",
16
18
  category: "Best Practices",
@@ -152,6 +152,8 @@ function getNonEmptyOperand(node) {
152
152
 
153
153
  module.exports = {
154
154
  meta: {
155
+ type: "suggestion",
156
+
155
157
  docs: {
156
158
  description: "disallow shorthand type conversions",
157
159
  category: "Best Practices",
@@ -160,6 +162,7 @@ module.exports = {
160
162
  },
161
163
 
162
164
  fixable: "code",
165
+
163
166
  schema: [{
164
167
  type: "object",
165
168
  properties: {