eslint 5.6.0 → 5.9.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 (273) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/bin/eslint.js +0 -1
  3. package/lib/cli-engine.js +128 -31
  4. package/lib/cli.js +6 -1
  5. package/lib/linter.js +9 -0
  6. package/lib/options.js +5 -0
  7. package/lib/rules/accessor-pairs.js +4 -0
  8. package/lib/rules/array-bracket-newline.js +5 -0
  9. package/lib/rules/array-bracket-spacing.js +5 -0
  10. package/lib/rules/array-callback-return.js +2 -0
  11. package/lib/rules/array-element-newline.js +4 -0
  12. package/lib/rules/arrow-body-style.js +2 -0
  13. package/lib/rules/arrow-parens.js +2 -0
  14. package/lib/rules/arrow-spacing.js +2 -0
  15. package/lib/rules/block-scoped-var.js +2 -0
  16. package/lib/rules/block-spacing.js +2 -0
  17. package/lib/rules/brace-style.js +2 -0
  18. package/lib/rules/callback-return.js +2 -0
  19. package/lib/rules/camelcase.js +38 -8
  20. package/lib/rules/capitalized-comments.js +4 -0
  21. package/lib/rules/class-methods-use-this.js +3 -0
  22. package/lib/rules/comma-dangle.js +4 -0
  23. package/lib/rules/comma-spacing.js +2 -0
  24. package/lib/rules/comma-style.js +5 -0
  25. package/lib/rules/complexity.js +2 -0
  26. package/lib/rules/computed-property-spacing.js +2 -0
  27. package/lib/rules/consistent-return.js +2 -0
  28. package/lib/rules/consistent-this.js +2 -0
  29. package/lib/rules/constructor-super.js +2 -0
  30. package/lib/rules/curly.js +2 -0
  31. package/lib/rules/default-case.js +2 -0
  32. package/lib/rules/dot-location.js +2 -0
  33. package/lib/rules/dot-notation.js +2 -0
  34. package/lib/rules/eol-last.js +5 -0
  35. package/lib/rules/eqeqeq.js +2 -0
  36. package/lib/rules/for-direction.js +4 -0
  37. package/lib/rules/func-call-spacing.js +4 -0
  38. package/lib/rules/func-name-matching.js +3 -0
  39. package/lib/rules/func-names.js +3 -0
  40. package/lib/rules/func-style.js +3 -0
  41. package/lib/rules/function-paren-newline.js +5 -0
  42. package/lib/rules/generator-star-spacing.js +3 -0
  43. package/lib/rules/getter-return.js +5 -0
  44. package/lib/rules/global-require.js +2 -0
  45. package/lib/rules/guard-for-in.js +2 -0
  46. package/lib/rules/handle-callback-err.js +2 -0
  47. package/lib/rules/id-blacklist.js +2 -0
  48. package/lib/rules/id-length.js +2 -0
  49. package/lib/rules/id-match.js +101 -27
  50. package/lib/rules/implicit-arrow-linebreak.js +4 -0
  51. package/lib/rules/indent-legacy.js +4 -1
  52. package/lib/rules/indent.js +2 -0
  53. package/lib/rules/init-declarations.js +2 -0
  54. package/lib/rules/jsx-quotes.js +2 -0
  55. package/lib/rules/key-spacing.js +4 -3
  56. package/lib/rules/keyword-spacing.js +2 -0
  57. package/lib/rules/line-comment-position.js +2 -0
  58. package/lib/rules/linebreak-style.js +2 -0
  59. package/lib/rules/lines-around-comment.js +2 -0
  60. package/lib/rules/lines-around-directive.js +6 -2
  61. package/lib/rules/lines-between-class-members.js +2 -0
  62. package/lib/rules/max-classes-per-file.js +4 -0
  63. package/lib/rules/max-depth.js +2 -0
  64. package/lib/rules/max-len.js +2 -0
  65. package/lib/rules/max-lines-per-function.js +2 -0
  66. package/lib/rules/max-lines.js +2 -0
  67. package/lib/rules/max-nested-callbacks.js +2 -0
  68. package/lib/rules/max-params.js +2 -0
  69. package/lib/rules/max-statements-per-line.js +2 -0
  70. package/lib/rules/max-statements.js +2 -0
  71. package/lib/rules/multiline-comment-style.js +3 -0
  72. package/lib/rules/multiline-ternary.js +3 -0
  73. package/lib/rules/new-cap.js +2 -0
  74. package/lib/rules/new-parens.js +2 -1
  75. package/lib/rules/newline-after-var.js +5 -2
  76. package/lib/rules/newline-before-return.js +5 -2
  77. package/lib/rules/newline-per-chained-call.js +4 -0
  78. package/lib/rules/no-alert.js +2 -0
  79. package/lib/rules/no-array-constructor.js +2 -0
  80. package/lib/rules/no-async-promise-executor.js +3 -0
  81. package/lib/rules/no-await-in-loop.js +4 -0
  82. package/lib/rules/no-bitwise.js +2 -0
  83. package/lib/rules/no-buffer-constructor.js +4 -0
  84. package/lib/rules/no-caller.js +2 -0
  85. package/lib/rules/no-case-declarations.js +2 -0
  86. package/lib/rules/no-catch-shadow.js +6 -3
  87. package/lib/rules/no-class-assign.js +2 -0
  88. package/lib/rules/no-compare-neg-zero.js +4 -0
  89. package/lib/rules/no-cond-assign.js +2 -0
  90. package/lib/rules/no-confusing-arrow.js +2 -0
  91. package/lib/rules/no-console.js +2 -0
  92. package/lib/rules/no-const-assign.js +2 -0
  93. package/lib/rules/no-constant-condition.js +2 -0
  94. package/lib/rules/no-continue.js +2 -0
  95. package/lib/rules/no-control-regex.js +4 -2
  96. package/lib/rules/no-debugger.js +4 -0
  97. package/lib/rules/no-delete-var.js +2 -0
  98. package/lib/rules/no-div-regex.js +2 -0
  99. package/lib/rules/no-dupe-args.js +2 -0
  100. package/lib/rules/no-dupe-class-members.js +2 -0
  101. package/lib/rules/no-dupe-keys.js +2 -0
  102. package/lib/rules/no-duplicate-case.js +2 -0
  103. package/lib/rules/no-duplicate-imports.js +2 -0
  104. package/lib/rules/no-else-return.js +2 -0
  105. package/lib/rules/no-empty-character-class.js +2 -0
  106. package/lib/rules/no-empty-function.js +2 -0
  107. package/lib/rules/no-empty-pattern.js +2 -0
  108. package/lib/rules/no-empty.js +2 -0
  109. package/lib/rules/no-eq-null.js +2 -0
  110. package/lib/rules/no-eval.js +2 -0
  111. package/lib/rules/no-ex-assign.js +2 -0
  112. package/lib/rules/no-extend-native.js +2 -0
  113. package/lib/rules/no-extra-bind.js +24 -1
  114. package/lib/rules/no-extra-boolean-cast.js +2 -1
  115. package/lib/rules/no-extra-label.js +2 -1
  116. package/lib/rules/no-extra-parens.js +5 -6
  117. package/lib/rules/no-extra-semi.js +2 -0
  118. package/lib/rules/no-fallthrough.js +2 -0
  119. package/lib/rules/no-floating-decimal.js +2 -1
  120. package/lib/rules/no-func-assign.js +2 -0
  121. package/lib/rules/no-global-assign.js +2 -0
  122. package/lib/rules/no-implicit-coercion.js +3 -0
  123. package/lib/rules/no-implicit-globals.js +2 -0
  124. package/lib/rules/no-implied-eval.js +2 -0
  125. package/lib/rules/no-inline-comments.js +2 -0
  126. package/lib/rules/no-inner-declarations.js +2 -0
  127. package/lib/rules/no-invalid-regexp.js +2 -0
  128. package/lib/rules/no-invalid-this.js +2 -0
  129. package/lib/rules/no-irregular-whitespace.js +6 -8
  130. package/lib/rules/no-iterator.js +2 -0
  131. package/lib/rules/no-label-var.js +2 -0
  132. package/lib/rules/no-labels.js +2 -0
  133. package/lib/rules/no-lone-blocks.js +2 -0
  134. package/lib/rules/no-lonely-if.js +2 -1
  135. package/lib/rules/no-loop-func.js +2 -0
  136. package/lib/rules/no-magic-numbers.js +3 -0
  137. package/lib/rules/no-misleading-character-class.js +4 -0
  138. package/lib/rules/no-mixed-operators.js +3 -0
  139. package/lib/rules/no-mixed-requires.js +2 -0
  140. package/lib/rules/no-mixed-spaces-and-tabs.js +2 -0
  141. package/lib/rules/no-multi-assign.js +3 -0
  142. package/lib/rules/no-multi-spaces.js +2 -0
  143. package/lib/rules/no-multi-str.js +2 -0
  144. package/lib/rules/no-multiple-empty-lines.js +2 -0
  145. package/lib/rules/no-native-reassign.js +4 -1
  146. package/lib/rules/no-negated-condition.js +2 -0
  147. package/lib/rules/no-negated-in-lhs.js +5 -2
  148. package/lib/rules/no-nested-ternary.js +2 -0
  149. package/lib/rules/no-new-func.js +2 -0
  150. package/lib/rules/no-new-object.js +2 -0
  151. package/lib/rules/no-new-require.js +2 -0
  152. package/lib/rules/no-new-symbol.js +2 -0
  153. package/lib/rules/no-new-wrappers.js +2 -0
  154. package/lib/rules/no-new.js +2 -0
  155. package/lib/rules/no-obj-calls.js +2 -0
  156. package/lib/rules/no-octal-escape.js +2 -0
  157. package/lib/rules/no-octal.js +2 -0
  158. package/lib/rules/no-param-reassign.js +2 -0
  159. package/lib/rules/no-path-concat.js +2 -0
  160. package/lib/rules/no-plusplus.js +2 -0
  161. package/lib/rules/no-process-env.js +2 -0
  162. package/lib/rules/no-process-exit.js +2 -0
  163. package/lib/rules/no-proto.js +2 -0
  164. package/lib/rules/no-prototype-builtins.js +2 -0
  165. package/lib/rules/no-redeclare.js +2 -0
  166. package/lib/rules/no-regex-spaces.js +2 -1
  167. package/lib/rules/no-restricted-globals.js +2 -0
  168. package/lib/rules/no-restricted-imports.js +40 -22
  169. package/lib/rules/no-restricted-modules.js +2 -0
  170. package/lib/rules/no-restricted-properties.js +2 -0
  171. package/lib/rules/no-restricted-syntax.js +2 -0
  172. package/lib/rules/no-return-assign.js +2 -0
  173. package/lib/rules/no-return-await.js +4 -0
  174. package/lib/rules/no-script-url.js +2 -0
  175. package/lib/rules/no-self-assign.js +2 -0
  176. package/lib/rules/no-self-compare.js +2 -0
  177. package/lib/rules/no-sequences.js +2 -0
  178. package/lib/rules/no-shadow-restricted-names.js +2 -0
  179. package/lib/rules/no-shadow.js +2 -0
  180. package/lib/rules/no-spaced-func.js +4 -1
  181. package/lib/rules/no-sparse-arrays.js +2 -0
  182. package/lib/rules/no-sync.js +2 -0
  183. package/lib/rules/no-tabs.js +25 -6
  184. package/lib/rules/no-template-curly-in-string.js +2 -0
  185. package/lib/rules/no-ternary.js +2 -0
  186. package/lib/rules/no-this-before-super.js +2 -0
  187. package/lib/rules/no-throw-literal.js +2 -0
  188. package/lib/rules/no-trailing-spaces.js +2 -0
  189. package/lib/rules/no-undef-init.js +2 -1
  190. package/lib/rules/no-undef.js +2 -0
  191. package/lib/rules/no-undefined.js +2 -0
  192. package/lib/rules/no-underscore-dangle.js +2 -0
  193. package/lib/rules/no-unexpected-multiline.js +2 -0
  194. package/lib/rules/no-unmodified-loop-condition.js +2 -0
  195. package/lib/rules/no-unneeded-ternary.js +2 -0
  196. package/lib/rules/no-unreachable.js +2 -1
  197. package/lib/rules/no-unsafe-finally.js +2 -0
  198. package/lib/rules/no-unsafe-negation.js +3 -0
  199. package/lib/rules/no-unused-expressions.js +2 -0
  200. package/lib/rules/no-unused-labels.js +2 -1
  201. package/lib/rules/no-unused-vars.js +37 -13
  202. package/lib/rules/no-use-before-define.js +2 -0
  203. package/lib/rules/no-useless-call.js +2 -0
  204. package/lib/rules/no-useless-computed-key.js +2 -1
  205. package/lib/rules/no-useless-concat.js +2 -0
  206. package/lib/rules/no-useless-constructor.js +2 -0
  207. package/lib/rules/no-useless-escape.js +2 -0
  208. package/lib/rules/no-useless-rename.js +4 -0
  209. package/lib/rules/no-useless-return.js +3 -0
  210. package/lib/rules/no-var.js +2 -0
  211. package/lib/rules/no-void.js +2 -0
  212. package/lib/rules/no-warning-comments.js +2 -0
  213. package/lib/rules/no-whitespace-before-property.js +2 -0
  214. package/lib/rules/no-with.js +2 -0
  215. package/lib/rules/nonblock-statement-body-position.js +4 -0
  216. package/lib/rules/object-curly-newline.js +4 -0
  217. package/lib/rules/object-curly-spacing.js +2 -0
  218. package/lib/rules/object-property-newline.js +3 -2
  219. package/lib/rules/object-shorthand.js +2 -0
  220. package/lib/rules/one-var-declaration-per-line.js +2 -0
  221. package/lib/rules/one-var.js +13 -1
  222. package/lib/rules/operator-assignment.js +2 -0
  223. package/lib/rules/operator-linebreak.js +2 -0
  224. package/lib/rules/padded-blocks.js +2 -0
  225. package/lib/rules/padding-line-between-statements.js +7 -0
  226. package/lib/rules/prefer-arrow-callback.js +2 -0
  227. package/lib/rules/prefer-const.js +116 -11
  228. package/lib/rules/prefer-destructuring.js +3 -0
  229. package/lib/rules/prefer-numeric-literals.js +2 -1
  230. package/lib/rules/prefer-object-spread.js +4 -0
  231. package/lib/rules/prefer-promise-reject-errors.js +4 -0
  232. package/lib/rules/prefer-reflect.js +4 -1
  233. package/lib/rules/prefer-rest-params.js +2 -0
  234. package/lib/rules/prefer-spread.js +2 -1
  235. package/lib/rules/prefer-template.js +2 -1
  236. package/lib/rules/quote-props.js +2 -0
  237. package/lib/rules/quotes.js +2 -0
  238. package/lib/rules/radix.js +2 -0
  239. package/lib/rules/require-atomic-updates.js +91 -30
  240. package/lib/rules/require-await.js +3 -0
  241. package/lib/rules/require-jsdoc.js +2 -0
  242. package/lib/rules/require-unicode-regexp.js +4 -0
  243. package/lib/rules/require-yield.js +2 -0
  244. package/lib/rules/rest-spread-spacing.js +4 -0
  245. package/lib/rules/semi-spacing.js +2 -0
  246. package/lib/rules/semi-style.js +3 -0
  247. package/lib/rules/semi.js +2 -0
  248. package/lib/rules/sort-imports.js +2 -0
  249. package/lib/rules/sort-keys.js +3 -0
  250. package/lib/rules/sort-vars.js +2 -0
  251. package/lib/rules/space-before-blocks.js +46 -35
  252. package/lib/rules/space-before-function-paren.js +2 -0
  253. package/lib/rules/space-in-parens.js +2 -0
  254. package/lib/rules/space-infix-ops.js +18 -25
  255. package/lib/rules/space-unary-ops.js +2 -0
  256. package/lib/rules/spaced-comment.js +2 -0
  257. package/lib/rules/strict.js +2 -0
  258. package/lib/rules/switch-colon-spacing.js +4 -0
  259. package/lib/rules/symbol-description.js +2 -0
  260. package/lib/rules/template-curly-spacing.js +2 -0
  261. package/lib/rules/template-tag-spacing.js +2 -0
  262. package/lib/rules/unicode-bom.js +2 -0
  263. package/lib/rules/use-isnan.js +2 -0
  264. package/lib/rules/valid-jsdoc.js +2 -0
  265. package/lib/rules/valid-typeof.js +2 -0
  266. package/lib/rules/vars-on-top.js +2 -0
  267. package/lib/rules/wrap-iife.js +2 -0
  268. package/lib/rules/wrap-regex.js +3 -1
  269. package/lib/rules/yield-star-spacing.js +2 -0
  270. package/lib/rules/yoda.js +2 -0
  271. package/lib/testers/rule-tester.js +2 -2
  272. package/lib/util/source-code-fixer.js +1 -1
  273. package/package.json +12 -12
@@ -27,6 +27,8 @@ const LINE_BREAK = astUtils.createGlobalLinebreakMatcher();
27
27
 
28
28
  module.exports = {
29
29
  meta: {
30
+ type: "problem",
31
+
30
32
  docs: {
31
33
  description: "disallow irregular whitespace outside of strings and comments",
32
34
  category: "Possible Errors",
@@ -81,9 +83,7 @@ module.exports = {
81
83
  const locStart = node.loc.start;
82
84
  const locEnd = node.loc.end;
83
85
 
84
- errors = errors.filter(error => {
85
- const errorLoc = error[1];
86
-
86
+ errors = errors.filter(({ loc: errorLoc }) => {
87
87
  if (errorLoc.line >= locStart.line && errorLoc.line <= locEnd.line) {
88
88
  if (errorLoc.column >= locStart.column && (errorLoc.column <= locEnd.column || errorLoc.line < locEnd.line)) {
89
89
  return false;
@@ -157,7 +157,7 @@ module.exports = {
157
157
  column: match.index
158
158
  };
159
159
 
160
- errors.push([node, location, "Irregular whitespace not allowed."]);
160
+ errors.push({ node, message: "Irregular whitespace not allowed.", loc: location });
161
161
  }
162
162
  });
163
163
  }
@@ -182,7 +182,7 @@ module.exports = {
182
182
  column: sourceLines[lineIndex].length
183
183
  };
184
184
 
185
- errors.push([node, location, "Irregular whitespace not allowed."]);
185
+ errors.push({ node, message: "Irregular whitespace not allowed.", loc: location });
186
186
  lastLineIndex = lineIndex;
187
187
  }
188
188
  }
@@ -224,9 +224,7 @@ module.exports = {
224
224
  }
225
225
 
226
226
  // If we have any errors remaining report on them
227
- errors.forEach(error => {
228
- context.report(...error);
229
- });
227
+ errors.forEach(error => context.report(error));
230
228
  };
231
229
  } else {
232
230
  nodes.Program = noop;
@@ -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 the `__iterator__` property",
16
18
  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 labels that share a name with a variable",
22
24
  category: "Variables",
@@ -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 labeled statements",
21
23
  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 unnecessary nested blocks",
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 `if` statements as the only statement in `else` blocks",
15
17
  category: "Stylistic Issues",
@@ -18,7 +20,6 @@ module.exports = {
18
20
  },
19
21
 
20
22
  schema: [],
21
-
22
23
  fixable: "code"
23
24
  },
24
25
 
@@ -154,6 +154,8 @@ function isSafe(loopNode, reference) {
154
154
 
155
155
  module.exports = {
156
156
  meta: {
157
+ type: "suggestion",
158
+
157
159
  docs: {
158
160
  description: "disallow `function` declarations and expressions inside loop statements",
159
161
  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 magic numbers",
16
18
  category: "Best Practices",
@@ -40,6 +42,7 @@ module.exports = {
40
42
  },
41
43
  additionalProperties: false
42
44
  }],
45
+
43
46
  messages: {
44
47
  useConst: "Number constants declarations must use 'const'.",
45
48
  noMagic: "No magic number: {{raw}}."
@@ -101,13 +101,17 @@ const kinds = Object.keys(hasCharacterSequence);
101
101
 
102
102
  module.exports = {
103
103
  meta: {
104
+ type: "problem",
105
+
104
106
  docs: {
105
107
  description: "disallow characters which are made with multiple code points in character class syntax",
106
108
  category: "Possible Errors",
107
109
  recommended: false,
108
110
  url: "https://eslint.org/docs/rules/no-misleading-character-class"
109
111
  },
112
+
110
113
  schema: [],
114
+
111
115
  messages: {
112
116
  surrogatePairWithoutUFlag: "Unexpected surrogate pair in character class. Use 'u' flag.",
113
117
  combiningClass: "Unexpected combined character in character class.",
@@ -71,12 +71,15 @@ function includesBothInAGroup(groups, left, right) {
71
71
 
72
72
  module.exports = {
73
73
  meta: {
74
+ type: "suggestion",
75
+
74
76
  docs: {
75
77
  description: "disallow mixed binary operators",
76
78
  category: "Stylistic Issues",
77
79
  recommended: false,
78
80
  url: "https://eslint.org/docs/rules/no-mixed-operators"
79
81
  },
82
+
80
83
  schema: [
81
84
  {
82
85
  type: "object",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow `require` calls to be mixed with regular variable declarations",
16
18
  category: "Node.js and CommonJS",
@@ -10,6 +10,8 @@
10
10
 
11
11
  module.exports = {
12
12
  meta: {
13
+ type: "layout",
14
+
13
15
  docs: {
14
16
  description: "disallow mixed spaces and tabs for indentation",
15
17
  category: "Stylistic Issues",
@@ -12,12 +12,15 @@
12
12
 
13
13
  module.exports = {
14
14
  meta: {
15
+ type: "suggestion",
16
+
15
17
  docs: {
16
18
  description: "disallow use of chained assignment expressions",
17
19
  category: "Stylistic Issues",
18
20
  recommended: false,
19
21
  url: "https://eslint.org/docs/rules/no-multi-assign"
20
22
  },
23
+
21
24
  schema: []
22
25
  },
23
26
 
@@ -13,6 +13,8 @@ const astUtils = require("../util/ast-utils");
13
13
 
14
14
  module.exports = {
15
15
  meta: {
16
+ type: "layout",
17
+
16
18
  docs: {
17
19
  description: "disallow multiple spaces",
18
20
  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 multiline strings",
22
24
  category: "Best Practices",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "layout",
15
+
14
16
  docs: {
15
17
  description: "disallow multiple empty lines",
16
18
  category: "Stylistic Issues",
@@ -12,16 +12,19 @@
12
12
 
13
13
  module.exports = {
14
14
  meta: {
15
+ type: "suggestion",
16
+
15
17
  docs: {
16
18
  description: "disallow assignments to native objects or read-only global variables",
17
19
  category: "Best Practices",
18
20
  recommended: false,
19
- replacedBy: ["no-global-assign"],
20
21
  url: "https://eslint.org/docs/rules/no-native-reassign"
21
22
  },
22
23
 
23
24
  deprecated: true,
24
25
 
26
+ replacedBy: ["no-global-assign"],
27
+
25
28
  schema: [
26
29
  {
27
30
  type: "object",
@@ -10,6 +10,8 @@
10
10
 
11
11
  module.exports = {
12
12
  meta: {
13
+ type: "suggestion",
14
+
13
15
  docs: {
14
16
  description: "disallow negated conditions",
15
17
  category: "Stylistic Issues",
@@ -12,15 +12,18 @@
12
12
 
13
13
  module.exports = {
14
14
  meta: {
15
+ type: "problem",
16
+
15
17
  docs: {
16
18
  description: "disallow negating the left operand in `in` expressions",
17
19
  category: "Possible Errors",
18
20
  recommended: false,
19
- replacedBy: ["no-unsafe-negation"],
20
21
  url: "https://eslint.org/docs/rules/no-negated-in-lhs"
21
22
  },
22
- deprecated: true,
23
23
 
24
+ replacedBy: ["no-unsafe-negation"],
25
+
26
+ deprecated: true,
24
27
  schema: []
25
28
  },
26
29
 
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow nested ternary expressions",
16
18
  category: "Stylistic Issues",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow `new` operators with the `Function` object",
16
18
  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 `Object` constructors",
16
18
  category: "Stylistic Issues",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow `new` operators with calls to `require`",
16
18
  category: "Node.js and CommonJS",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "problem",
15
+
14
16
  docs: {
15
17
  description: "disallow `new` operators with the `Symbol` object",
16
18
  category: "ECMAScript 6",
@@ -11,6 +11,8 @@
11
11
 
12
12
  module.exports = {
13
13
  meta: {
14
+ type: "suggestion",
15
+
14
16
  docs: {
15
17
  description: "disallow `new` operators with the `String`, `Number`, and `Boolean` objects",
16
18
  category: "Best Practices",
@@ -12,6 +12,8 @@
12
12
 
13
13
  module.exports = {
14
14
  meta: {
15
+ type: "suggestion",
16
+
15
17
  docs: {
16
18
  description: "disallow `new` operators outside of assignments or comparisons",
17
19
  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 calling global object properties as functions",
16
18
  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 octal escape sequences in string literals",
16
18
  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 octal literals",
16
18
  category: "Best Practices",
@@ -12,6 +12,8 @@ const stopNodePattern = /(?:Statement|Declaration|Function(?:Expression)?|Progra
12
12
 
13
13
  module.exports = {
14
14
  meta: {
15
+ type: "suggestion",
16
+
15
17
  docs: {
16
18
  description: "disallow reassigning `function` parameters",
17
19
  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 string concatenation with `__dirname` and `__filename`",
15
17
  category: "Node.js and CommonJS",
@@ -12,6 +12,8 @@
12
12
 
13
13
  module.exports = {
14
14
  meta: {
15
+ type: "suggestion",
16
+
15
17
  docs: {
16
18
  description: "disallow the unary operators `++` and `--`",
17
19
  category: "Stylistic Issues",
@@ -10,6 +10,8 @@
10
10
 
11
11
  module.exports = {
12
12
  meta: {
13
+ type: "suggestion",
14
+
13
15
  docs: {
14
16
  description: "disallow the use of `process.env`",
15
17
  category: "Node.js and CommonJS",
@@ -10,6 +10,8 @@
10
10
 
11
11
  module.exports = {
12
12
  meta: {
13
+ type: "suggestion",
14
+
13
15
  docs: {
14
16
  description: "disallow the use of `process.exit()`",
15
17
  category: "Node.js and CommonJS",
@@ -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 the `__proto__` property",
16
18
  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 calling some `Object.prototype` methods directly on objects",
15
17
  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 variable redeclaration",
16
18
  category: "Best Practices",
@@ -13,6 +13,8 @@ const astUtils = require("../util/ast-utils");
13
13
 
14
14
  module.exports = {
15
15
  meta: {
16
+ type: "suggestion",
17
+
16
18
  docs: {
17
19
  description: "disallow multiple spaces in regular expressions",
18
20
  category: "Possible Errors",
@@ -21,7 +23,6 @@ module.exports = {
21
23
  },
22
24
 
23
25
  schema: [],
24
-
25
26
  fixable: "code"
26
27
  },
27
28
 
@@ -17,6 +17,8 @@ const DEFAULT_MESSAGE_TEMPLATE = "Unexpected use of '{{name}}'.",
17
17
 
18
18
  module.exports = {
19
19
  meta: {
20
+ type: "suggestion",
21
+
20
22
  docs: {
21
23
  description: "disallow specified global variables",
22
24
  category: "Variables",
@@ -53,6 +53,8 @@ const arrayOfStringsOrObjects = {
53
53
 
54
54
  module.exports = {
55
55
  meta: {
56
+ type: "suggestion",
57
+
56
58
  docs: {
57
59
  description: "disallow specified modules when loaded by `import`",
58
60
  category: "ECMAScript 6",
@@ -234,31 +236,47 @@ module.exports = {
234
236
  return restrictedPatterns.length > 0 && restrictedPatternsMatcher.ignores(importSource);
235
237
  }
236
238
 
237
- return {
238
- ImportDeclaration(node) {
239
- const importSource = node.source.value.trim();
240
- const importNames = node.specifiers.reduce((set, specifier) => {
241
- if (specifier.type === "ImportDefaultSpecifier") {
242
- set.add("default");
243
- } else if (specifier.type === "ImportNamespaceSpecifier") {
244
- set.add("*");
245
- } else {
246
- set.add(specifier.imported.name);
247
- }
248
- return set;
249
- }, new Set());
250
-
251
- if (isRestrictedForEverythingImported(importSource, importNames)) {
252
- reportPathForEverythingImported(importSource, node);
239
+ /**
240
+ * Checks a node to see if any problems should be reported.
241
+ * @param {ASTNode} node The node to check.
242
+ * @returns {void}
243
+ * @private
244
+ */
245
+ function checkNode(node) {
246
+ const importSource = node.source.value.trim();
247
+ const importNames = node.specifiers ? node.specifiers.reduce((set, specifier) => {
248
+ if (specifier.type === "ImportDefaultSpecifier") {
249
+ set.add("default");
250
+ } else if (specifier.type === "ImportNamespaceSpecifier") {
251
+ set.add("*");
252
+ } else if (specifier.imported) {
253
+ set.add(specifier.imported.name);
254
+ } else if (specifier.local) {
255
+ set.add(specifier.local.name);
253
256
  }
257
+ return set;
258
+ }, new Set()) : new Set();
254
259
 
255
- if (isRestrictedPath(importSource, importNames)) {
256
- reportPath(node);
257
- }
258
- if (isRestrictedPattern(importSource)) {
259
- reportPathForPatterns(node);
260
- }
260
+ if (isRestrictedForEverythingImported(importSource, importNames)) {
261
+ reportPathForEverythingImported(importSource, node);
262
+ }
263
+
264
+ if (isRestrictedPath(importSource, importNames)) {
265
+ reportPath(node);
266
+ }
267
+ if (isRestrictedPattern(importSource)) {
268
+ reportPathForPatterns(node);
261
269
  }
270
+ }
271
+
272
+ return {
273
+ ImportDeclaration: checkNode,
274
+ ExportNamedDeclaration(node) {
275
+ if (node.source) {
276
+ checkNode(node);
277
+ }
278
+ },
279
+ ExportAllDeclaration: checkNode
262
280
  };
263
281
  }
264
282
  };
@@ -47,6 +47,8 @@ const arrayOfStringsOrObjects = {
47
47
 
48
48
  module.exports = {
49
49
  meta: {
50
+ type: "suggestion",
51
+
50
52
  docs: {
51
53
  description: "disallow specified modules when loaded by `require`",
52
54
  category: "Node.js and CommonJS",
@@ -13,6 +13,8 @@ const astUtils = require("../util/ast-utils");
13
13
 
14
14
  module.exports = {
15
15
  meta: {
16
+ type: "suggestion",
17
+
16
18
  docs: {
17
19
  description: "disallow certain properties on certain objects",
18
20
  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 specified syntax",
15
17
  category: "Stylistic Issues",
@@ -22,6 +22,8 @@ const SENTINEL_TYPE = /^(?:[a-zA-Z]+?Statement|ArrowFunctionExpression|FunctionE
22
22
 
23
23
  module.exports = {
24
24
  meta: {
25
+ type: "suggestion",
26
+
25
27
  docs: {
26
28
  description: "disallow assignment operators in `return` statements",
27
29
  category: "Best Practices",
@@ -14,6 +14,8 @@ const message = "Redundant use of `await` on a return value.";
14
14
 
15
15
  module.exports = {
16
16
  meta: {
17
+ type: "suggestion",
18
+
17
19
  docs: {
18
20
  description: "disallow unnecessary `return await`",
19
21
  category: "Best Practices",
@@ -22,7 +24,9 @@ module.exports = {
22
24
 
23
25
  url: "https://eslint.org/docs/rules/no-return-await"
24
26
  },
27
+
25
28
  fixable: null,
29
+
26
30
  schema: [
27
31
  ]
28
32
  },
@@ -13,6 +13,8 @@
13
13
 
14
14
  module.exports = {
15
15
  meta: {
16
+ type: "suggestion",
17
+
16
18
  docs: {
17
19
  description: "disallow `javascript:` urls",
18
20
  category: "Best Practices",