eslint 8.0.0-beta.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/README.md +4 -4
  2. package/bin/eslint.js +1 -1
  3. package/conf/eslint-recommended.js +1 -1
  4. package/conf/{category-list.json → rule-type-list.json} +4 -7
  5. package/lib/cli-engine/cli-engine.js +11 -3
  6. package/lib/cli-engine/file-enumerator.js +4 -3
  7. package/lib/cli-engine/formatters/html.js +1 -1
  8. package/lib/cli-engine/hash.js +2 -2
  9. package/lib/cli-engine/xml-escape.js +1 -1
  10. package/lib/config/flat-config-array.js +2 -2
  11. package/lib/config/flat-config-schema.js +1 -1
  12. package/lib/config/rule-validator.js +25 -8
  13. package/lib/eslint/eslint.js +4 -0
  14. package/lib/init/autoconfig.js +17 -18
  15. package/lib/init/config-file.js +3 -3
  16. package/lib/init/config-initializer.js +11 -10
  17. package/lib/init/config-rule.js +15 -16
  18. package/lib/init/npm-utils.js +16 -15
  19. package/lib/init/source-code-utils.js +6 -5
  20. package/lib/linter/apply-disable-directives.js +80 -11
  21. package/lib/linter/code-path-analysis/code-path-analyzer.js +115 -36
  22. package/lib/linter/code-path-analysis/code-path-segment.js +0 -1
  23. package/lib/linter/code-path-analysis/code-path-state.js +4 -1
  24. package/lib/linter/code-path-analysis/code-path.js +14 -5
  25. package/lib/linter/code-path-analysis/debug-helpers.js +2 -2
  26. package/lib/linter/code-path-analysis/fork-context.js +0 -1
  27. package/lib/linter/code-path-analysis/id-generator.js +0 -1
  28. package/lib/linter/config-comment-parser.js +1 -1
  29. package/lib/linter/linter.js +51 -22
  30. package/lib/linter/node-event-generator.js +0 -1
  31. package/lib/linter/report-translator.js +12 -12
  32. package/lib/linter/rules.js +3 -0
  33. package/lib/linter/safe-emitter.js +2 -2
  34. package/lib/linter/source-code-fixer.js +2 -2
  35. package/lib/linter/timing.js +2 -2
  36. package/lib/rule-tester/rule-tester.js +12 -2
  37. package/lib/rules/accessor-pairs.js +0 -1
  38. package/lib/rules/array-bracket-newline.js +0 -1
  39. package/lib/rules/array-bracket-spacing.js +0 -1
  40. package/lib/rules/array-callback-return.js +0 -1
  41. package/lib/rules/array-element-newline.js +0 -1
  42. package/lib/rules/arrow-body-style.js +0 -1
  43. package/lib/rules/arrow-parens.js +0 -1
  44. package/lib/rules/arrow-spacing.js +0 -1
  45. package/lib/rules/block-scoped-var.js +0 -1
  46. package/lib/rules/block-spacing.js +0 -1
  47. package/lib/rules/brace-style.js +0 -1
  48. package/lib/rules/callback-return.js +1 -1
  49. package/lib/rules/camelcase.js +17 -19
  50. package/lib/rules/capitalized-comments.js +0 -1
  51. package/lib/rules/class-methods-use-this.js +51 -9
  52. package/lib/rules/comma-dangle.js +0 -1
  53. package/lib/rules/comma-spacing.js +0 -1
  54. package/lib/rules/comma-style.js +0 -1
  55. package/lib/rules/complexity.js +47 -56
  56. package/lib/rules/computed-property-spacing.js +0 -1
  57. package/lib/rules/consistent-return.js +0 -1
  58. package/lib/rules/consistent-this.js +1 -2
  59. package/lib/rules/constructor-super.js +0 -1
  60. package/lib/rules/curly.js +0 -1
  61. package/lib/rules/default-case-last.js +0 -1
  62. package/lib/rules/default-case.js +2 -3
  63. package/lib/rules/default-param-last.js +1 -2
  64. package/lib/rules/dot-location.js +0 -1
  65. package/lib/rules/dot-notation.js +0 -1
  66. package/lib/rules/eol-last.js +6 -2
  67. package/lib/rules/eqeqeq.js +1 -2
  68. package/lib/rules/for-direction.js +0 -1
  69. package/lib/rules/func-call-spacing.js +0 -1
  70. package/lib/rules/func-name-matching.js +9 -6
  71. package/lib/rules/func-names.js +0 -1
  72. package/lib/rules/func-style.js +0 -1
  73. package/lib/rules/function-call-argument-newline.js +0 -1
  74. package/lib/rules/function-paren-newline.js +1 -1
  75. package/lib/rules/generator-star-spacing.js +0 -1
  76. package/lib/rules/getter-return.js +0 -1
  77. package/lib/rules/global-require.js +1 -1
  78. package/lib/rules/grouped-accessor-pairs.js +0 -1
  79. package/lib/rules/guard-for-in.js +0 -1
  80. package/lib/rules/handle-callback-err.js +1 -1
  81. package/lib/rules/id-blacklist.js +1 -1
  82. package/lib/rules/id-denylist.js +0 -1
  83. package/lib/rules/id-length.js +0 -1
  84. package/lib/rules/id-match.js +0 -1
  85. package/lib/rules/implicit-arrow-linebreak.js +0 -1
  86. package/lib/rules/indent-legacy.js +1 -1
  87. package/lib/rules/indent.js +7 -10
  88. package/lib/rules/index.js +1 -1
  89. package/lib/rules/init-declarations.js +0 -1
  90. package/lib/rules/jsx-quotes.js +0 -1
  91. package/lib/rules/key-spacing.js +4 -5
  92. package/lib/rules/keyword-spacing.js +19 -3
  93. package/lib/rules/line-comment-position.js +0 -1
  94. package/lib/rules/linebreak-style.js +0 -1
  95. package/lib/rules/lines-around-comment.js +0 -1
  96. package/lib/rules/lines-around-directive.js +1 -2
  97. package/lib/rules/lines-between-class-members.js +50 -3
  98. package/lib/rules/max-classes-per-file.js +31 -8
  99. package/lib/rules/max-depth.js +0 -1
  100. package/lib/rules/max-len.js +1 -2
  101. package/lib/rules/max-lines-per-function.js +1 -2
  102. package/lib/rules/max-lines.js +0 -1
  103. package/lib/rules/max-nested-callbacks.js +0 -1
  104. package/lib/rules/max-params.js +0 -1
  105. package/lib/rules/max-statements-per-line.js +0 -1
  106. package/lib/rules/max-statements.js +0 -1
  107. package/lib/rules/multiline-comment-style.js +0 -1
  108. package/lib/rules/multiline-ternary.js +0 -1
  109. package/lib/rules/new-cap.js +2 -2
  110. package/lib/rules/new-parens.js +0 -1
  111. package/lib/rules/newline-after-var.js +4 -5
  112. package/lib/rules/newline-before-return.js +2 -3
  113. package/lib/rules/newline-per-chained-call.js +1 -2
  114. package/lib/rules/no-alert.js +0 -1
  115. package/lib/rules/no-array-constructor.js +0 -1
  116. package/lib/rules/no-async-promise-executor.js +0 -1
  117. package/lib/rules/no-await-in-loop.js +0 -1
  118. package/lib/rules/no-bitwise.js +5 -6
  119. package/lib/rules/no-buffer-constructor.js +1 -1
  120. package/lib/rules/no-caller.js +0 -1
  121. package/lib/rules/no-case-declarations.js +0 -1
  122. package/lib/rules/no-catch-shadow.js +0 -1
  123. package/lib/rules/no-class-assign.js +0 -1
  124. package/lib/rules/no-compare-neg-zero.js +0 -1
  125. package/lib/rules/no-cond-assign.js +0 -1
  126. package/lib/rules/no-confusing-arrow.js +0 -1
  127. package/lib/rules/no-console.js +0 -1
  128. package/lib/rules/no-const-assign.js +0 -1
  129. package/lib/rules/no-constant-condition.js +0 -1
  130. package/lib/rules/no-constructor-return.js +0 -1
  131. package/lib/rules/no-continue.js +0 -1
  132. package/lib/rules/no-control-regex.js +0 -1
  133. package/lib/rules/no-debugger.js +0 -1
  134. package/lib/rules/no-delete-var.js +0 -1
  135. package/lib/rules/no-div-regex.js +0 -1
  136. package/lib/rules/no-dupe-args.js +0 -1
  137. package/lib/rules/no-dupe-class-members.js +0 -1
  138. package/lib/rules/no-dupe-else-if.js +0 -1
  139. package/lib/rules/no-dupe-keys.js +0 -2
  140. package/lib/rules/no-duplicate-case.js +0 -1
  141. package/lib/rules/no-duplicate-imports.js +0 -1
  142. package/lib/rules/no-else-return.js +0 -1
  143. package/lib/rules/no-empty-character-class.js +0 -1
  144. package/lib/rules/no-empty-function.js +0 -1
  145. package/lib/rules/no-empty-pattern.js +0 -1
  146. package/lib/rules/no-empty.js +0 -1
  147. package/lib/rules/no-eq-null.js +0 -1
  148. package/lib/rules/no-eval.js +0 -1
  149. package/lib/rules/no-ex-assign.js +0 -1
  150. package/lib/rules/no-extend-native.js +0 -1
  151. package/lib/rules/no-extra-bind.js +0 -1
  152. package/lib/rules/no-extra-boolean-cast.js +1 -1
  153. package/lib/rules/no-extra-label.js +0 -1
  154. package/lib/rules/no-extra-parens.js +0 -1
  155. package/lib/rules/no-extra-semi.js +0 -1
  156. package/lib/rules/no-fallthrough.js +0 -1
  157. package/lib/rules/no-floating-decimal.js +0 -1
  158. package/lib/rules/no-func-assign.js +0 -1
  159. package/lib/rules/no-global-assign.js +0 -1
  160. package/lib/rules/no-implicit-coercion.js +0 -1
  161. package/lib/rules/no-implicit-globals.js +0 -1
  162. package/lib/rules/no-implied-eval.js +0 -1
  163. package/lib/rules/no-import-assign.js +0 -1
  164. package/lib/rules/no-inline-comments.js +0 -1
  165. package/lib/rules/no-inner-declarations.js +0 -1
  166. package/lib/rules/no-invalid-regexp.js +0 -1
  167. package/lib/rules/no-invalid-this.js +0 -1
  168. package/lib/rules/no-irregular-whitespace.js +0 -1
  169. package/lib/rules/no-iterator.js +0 -1
  170. package/lib/rules/no-label-var.js +0 -1
  171. package/lib/rules/no-labels.js +0 -1
  172. package/lib/rules/no-lone-blocks.js +0 -1
  173. package/lib/rules/no-lonely-if.js +0 -1
  174. package/lib/rules/no-loop-func.js +1 -2
  175. package/lib/rules/no-loss-of-precision.js +0 -1
  176. package/lib/rules/no-magic-numbers.js +0 -1
  177. package/lib/rules/no-misleading-character-class.js +0 -1
  178. package/lib/rules/no-mixed-operators.js +1 -2
  179. package/lib/rules/no-mixed-requires.js +1 -1
  180. package/lib/rules/no-mixed-spaces-and-tabs.js +0 -1
  181. package/lib/rules/no-multi-assign.js +0 -1
  182. package/lib/rules/no-multi-spaces.js +0 -1
  183. package/lib/rules/no-multi-str.js +0 -1
  184. package/lib/rules/no-multiple-empty-lines.js +0 -1
  185. package/lib/rules/no-native-reassign.js +0 -1
  186. package/lib/rules/no-negated-condition.js +0 -1
  187. package/lib/rules/no-negated-in-lhs.js +0 -1
  188. package/lib/rules/no-nested-ternary.js +0 -1
  189. package/lib/rules/no-new-func.js +34 -7
  190. package/lib/rules/no-new-object.js +0 -1
  191. package/lib/rules/no-new-require.js +1 -1
  192. package/lib/rules/no-new-symbol.js +0 -1
  193. package/lib/rules/no-new-wrappers.js +0 -1
  194. package/lib/rules/no-new.js +0 -1
  195. package/lib/rules/no-nonoctal-decimal-escape.js +0 -1
  196. package/lib/rules/no-obj-calls.js +0 -1
  197. package/lib/rules/no-octal-escape.js +0 -1
  198. package/lib/rules/no-octal.js +0 -1
  199. package/lib/rules/no-param-reassign.js +0 -1
  200. package/lib/rules/no-path-concat.js +1 -1
  201. package/lib/rules/no-plusplus.js +0 -1
  202. package/lib/rules/no-process-env.js +1 -1
  203. package/lib/rules/no-process-exit.js +1 -1
  204. package/lib/rules/no-promise-executor-return.js +0 -1
  205. package/lib/rules/no-proto.js +0 -1
  206. package/lib/rules/no-prototype-builtins.js +0 -1
  207. package/lib/rules/no-redeclare.js +0 -1
  208. package/lib/rules/no-regex-spaces.js +0 -1
  209. package/lib/rules/no-restricted-exports.js +0 -1
  210. package/lib/rules/no-restricted-globals.js +1 -2
  211. package/lib/rules/no-restricted-imports.js +5 -6
  212. package/lib/rules/no-restricted-modules.js +3 -3
  213. package/lib/rules/no-restricted-properties.js +2 -3
  214. package/lib/rules/no-restricted-syntax.js +1 -2
  215. package/lib/rules/no-return-assign.js +0 -1
  216. package/lib/rules/no-return-await.js +0 -1
  217. package/lib/rules/no-script-url.js +1 -3
  218. package/lib/rules/no-self-assign.js +0 -1
  219. package/lib/rules/no-self-compare.js +0 -1
  220. package/lib/rules/no-sequences.js +0 -1
  221. package/lib/rules/no-setter-return.js +0 -1
  222. package/lib/rules/no-shadow-restricted-names.js +0 -1
  223. package/lib/rules/no-shadow.js +1 -2
  224. package/lib/rules/no-spaced-func.js +0 -1
  225. package/lib/rules/no-sparse-arrays.js +0 -1
  226. package/lib/rules/no-sync.js +1 -3
  227. package/lib/rules/no-tabs.js +0 -1
  228. package/lib/rules/no-template-curly-in-string.js +0 -1
  229. package/lib/rules/no-ternary.js +0 -1
  230. package/lib/rules/no-this-before-super.js +0 -1
  231. package/lib/rules/no-throw-literal.js +0 -1
  232. package/lib/rules/no-trailing-spaces.js +0 -1
  233. package/lib/rules/no-undef-init.js +9 -61
  234. package/lib/rules/no-undef.js +0 -1
  235. package/lib/rules/no-undefined.js +0 -1
  236. package/lib/rules/no-underscore-dangle.js +0 -1
  237. package/lib/rules/no-unexpected-multiline.js +0 -1
  238. package/lib/rules/no-unmodified-loop-condition.js +0 -1
  239. package/lib/rules/no-unneeded-ternary.js +0 -1
  240. package/lib/rules/no-unreachable-loop.js +0 -1
  241. package/lib/rules/no-unreachable.js +26 -25
  242. package/lib/rules/no-unsafe-finally.js +0 -1
  243. package/lib/rules/no-unsafe-negation.js +0 -1
  244. package/lib/rules/no-unsafe-optional-chaining.js +0 -1
  245. package/lib/rules/no-unused-expressions.js +4 -5
  246. package/lib/rules/no-unused-labels.js +0 -1
  247. package/lib/rules/no-unused-vars.js +26 -28
  248. package/lib/rules/no-use-before-define.js +0 -1
  249. package/lib/rules/no-useless-backreference.js +0 -1
  250. package/lib/rules/no-useless-call.js +0 -1
  251. package/lib/rules/no-useless-catch.js +0 -1
  252. package/lib/rules/no-useless-computed-key.js +1 -1
  253. package/lib/rules/no-useless-concat.js +0 -1
  254. package/lib/rules/no-useless-constructor.js +0 -1
  255. package/lib/rules/no-useless-escape.js +9 -9
  256. package/lib/rules/no-useless-rename.js +0 -1
  257. package/lib/rules/no-useless-return.js +0 -1
  258. package/lib/rules/no-var.js +0 -1
  259. package/lib/rules/no-void.js +0 -1
  260. package/lib/rules/no-warning-comments.js +0 -1
  261. package/lib/rules/no-whitespace-before-property.js +0 -1
  262. package/lib/rules/no-with.js +0 -1
  263. package/lib/rules/nonblock-statement-body-position.js +0 -1
  264. package/lib/rules/object-curly-newline.js +0 -1
  265. package/lib/rules/object-curly-spacing.js +0 -1
  266. package/lib/rules/object-property-newline.js +0 -1
  267. package/lib/rules/object-shorthand.js +3 -8
  268. package/lib/rules/one-var-declaration-per-line.js +0 -1
  269. package/lib/rules/one-var.js +1 -2
  270. package/lib/rules/operator-assignment.js +6 -7
  271. package/lib/rules/operator-linebreak.js +0 -1
  272. package/lib/rules/padded-blocks.js +1 -1
  273. package/lib/rules/padding-line-between-statements.js +0 -1
  274. package/lib/rules/prefer-arrow-callback.js +1 -1
  275. package/lib/rules/prefer-const.js +0 -1
  276. package/lib/rules/prefer-destructuring.js +1 -2
  277. package/lib/rules/prefer-exponentiation-operator.js +0 -1
  278. package/lib/rules/prefer-named-capture-group.js +0 -1
  279. package/lib/rules/prefer-numeric-literals.js +0 -1
  280. package/lib/rules/prefer-object-spread.js +0 -1
  281. package/lib/rules/prefer-promise-reject-errors.js +0 -1
  282. package/lib/rules/prefer-reflect.js +0 -1
  283. package/lib/rules/prefer-regex-literals.js +0 -1
  284. package/lib/rules/prefer-rest-params.js +0 -1
  285. package/lib/rules/prefer-spread.js +0 -1
  286. package/lib/rules/prefer-template.js +0 -1
  287. package/lib/rules/quote-props.js +8 -9
  288. package/lib/rules/quotes.js +0 -1
  289. package/lib/rules/radix.js +0 -1
  290. package/lib/rules/require-atomic-updates.js +24 -9
  291. package/lib/rules/require-await.js +0 -1
  292. package/lib/rules/require-jsdoc.js +1 -1
  293. package/lib/rules/require-unicode-regexp.js +0 -1
  294. package/lib/rules/require-yield.js +0 -1
  295. package/lib/rules/rest-spread-spacing.js +0 -1
  296. package/lib/rules/semi-spacing.js +0 -1
  297. package/lib/rules/semi-style.js +0 -1
  298. package/lib/rules/semi.js +66 -6
  299. package/lib/rules/sort-imports.js +0 -1
  300. package/lib/rules/sort-keys.js +0 -1
  301. package/lib/rules/sort-vars.js +0 -1
  302. package/lib/rules/space-before-blocks.js +14 -3
  303. package/lib/rules/space-before-function-paren.js +0 -1
  304. package/lib/rules/space-in-parens.js +0 -1
  305. package/lib/rules/space-infix-ops.js +0 -1
  306. package/lib/rules/space-unary-ops.js +0 -1
  307. package/lib/rules/spaced-comment.js +0 -1
  308. package/lib/rules/strict.js +0 -1
  309. package/lib/rules/switch-colon-spacing.js +1 -14
  310. package/lib/rules/symbol-description.js +0 -1
  311. package/lib/rules/template-curly-spacing.js +0 -1
  312. package/lib/rules/template-tag-spacing.js +0 -1
  313. package/lib/rules/unicode-bom.js +0 -1
  314. package/lib/rules/use-isnan.js +0 -1
  315. package/lib/rules/utils/ast-utils.js +29 -7
  316. package/lib/rules/utils/lazy-loading-rule-map.js +3 -3
  317. package/lib/rules/valid-jsdoc.js +1 -1
  318. package/lib/rules/valid-typeof.js +0 -1
  319. package/lib/rules/vars-on-top.js +1 -2
  320. package/lib/rules/wrap-iife.js +0 -1
  321. package/lib/rules/wrap-regex.js +0 -1
  322. package/lib/rules/yield-star-spacing.js +0 -1
  323. package/lib/rules/yoda.js +0 -1
  324. package/lib/shared/ajv.js +1 -1
  325. package/lib/shared/config-validator.js +10 -5
  326. package/lib/shared/logging.js +1 -1
  327. package/lib/shared/relative-module-resolver.js +1 -0
  328. package/lib/shared/runtime-info.js +3 -0
  329. package/lib/shared/traverser.js +2 -2
  330. package/lib/shared/types.js +2 -2
  331. package/lib/source-code/source-code.js +11 -5
  332. package/lib/source-code/token-store/cursor.js +1 -1
  333. package/package.json +5 -5
@@ -5,6 +5,18 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ //------------------------------------------------------------------------------
9
+ // Requirements
10
+ //------------------------------------------------------------------------------
11
+
12
+ const astUtils = require("./utils/ast-utils");
13
+
14
+ //------------------------------------------------------------------------------
15
+ // Helpers
16
+ //------------------------------------------------------------------------------
17
+
18
+ const callMethods = new Set(["apply", "bind", "call"]);
19
+
8
20
  //------------------------------------------------------------------------------
9
21
  // Rule Definition
10
22
  //------------------------------------------------------------------------------
@@ -15,7 +27,6 @@ module.exports = {
15
27
 
16
28
  docs: {
17
29
  description: "disallow `new` operators with the `Function` object",
18
- category: "Best Practices",
19
30
  recommended: false,
20
31
  url: "https://eslint.org/docs/rules/no-new-func"
21
32
  },
@@ -38,14 +49,30 @@ module.exports = {
38
49
  variable.references.forEach(ref => {
39
50
  const node = ref.identifier;
40
51
  const { parent } = node;
52
+ let evalNode;
53
+
54
+ if (parent) {
55
+ if (node === parent.callee && (
56
+ parent.type === "NewExpression" ||
57
+ parent.type === "CallExpression"
58
+ )) {
59
+ evalNode = parent;
60
+ } else if (
61
+ parent.type === "MemberExpression" &&
62
+ node === parent.object &&
63
+ callMethods.has(astUtils.getStaticPropertyName(parent))
64
+ ) {
65
+ const maybeCallee = parent.parent.type === "ChainExpression" ? parent.parent : parent;
66
+
67
+ if (maybeCallee.parent.type === "CallExpression" && maybeCallee.parent.callee === maybeCallee) {
68
+ evalNode = maybeCallee.parent;
69
+ }
70
+ }
71
+ }
41
72
 
42
- if (
43
- parent &&
44
- (parent.type === "NewExpression" || parent.type === "CallExpression") &&
45
- node === parent.callee
46
- ) {
73
+ if (evalNode) {
47
74
  context.report({
48
- node: parent,
75
+ node: evalNode,
49
76
  messageId: "noFunctionConstructor"
50
77
  });
51
78
  }
@@ -21,7 +21,6 @@ module.exports = {
21
21
 
22
22
  docs: {
23
23
  description: "disallow `Object` constructors",
24
- category: "Stylistic Issues",
25
24
  recommended: false,
26
25
  url: "https://eslint.org/docs/rules/no-new-object"
27
26
  },
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @fileoverview Rule to disallow use of new operator with the `require` function
3
3
  * @author Wil Moore III
4
+ * @deprecated in ESLint v7.0.0
4
5
  */
5
6
 
6
7
  "use strict";
@@ -19,7 +20,6 @@ module.exports = {
19
20
 
20
21
  docs: {
21
22
  description: "disallow `new` operators with calls to `require`",
22
- category: "Node.js and CommonJS",
23
23
  recommended: false,
24
24
  url: "https://eslint.org/docs/rules/no-new-require"
25
25
  },
@@ -15,7 +15,6 @@ module.exports = {
15
15
 
16
16
  docs: {
17
17
  description: "disallow `new` operators with the `Symbol` object",
18
- category: "ECMAScript 6",
19
18
  recommended: true,
20
19
  url: "https://eslint.org/docs/rules/no-new-symbol"
21
20
  },
@@ -15,7 +15,6 @@ module.exports = {
15
15
 
16
16
  docs: {
17
17
  description: "disallow `new` operators with the `String`, `Number`, and `Boolean` objects",
18
- category: "Best Practices",
19
18
  recommended: false,
20
19
  url: "https://eslint.org/docs/rules/no-new-wrappers"
21
20
  },
@@ -16,7 +16,6 @@ module.exports = {
16
16
 
17
17
  docs: {
18
18
  description: "disallow `new` operators outside of assignments or comparisons",
19
- category: "Best Practices",
20
19
  recommended: false,
21
20
  url: "https://eslint.org/docs/rules/no-new"
22
21
  },
@@ -30,7 +30,6 @@ module.exports = {
30
30
 
31
31
  docs: {
32
32
  description: "disallow `\\8` and `\\9` escape sequences in string literals",
33
- category: "Best Practices",
34
33
  recommended: true,
35
34
  url: "https://eslint.org/docs/rules/no-nonoctal-decimal-escape"
36
35
  },
@@ -43,7 +43,6 @@ module.exports = {
43
43
 
44
44
  docs: {
45
45
  description: "disallow calling global object properties as functions",
46
- category: "Possible Errors",
47
46
  recommended: true,
48
47
  url: "https://eslint.org/docs/rules/no-obj-calls"
49
48
  },
@@ -15,7 +15,6 @@ module.exports = {
15
15
 
16
16
  docs: {
17
17
  description: "disallow octal escape sequences in string literals",
18
- category: "Best Practices",
19
18
  recommended: false,
20
19
  url: "https://eslint.org/docs/rules/no-octal-escape"
21
20
  },
@@ -15,7 +15,6 @@ module.exports = {
15
15
 
16
16
  docs: {
17
17
  description: "disallow octal literals",
18
- category: "Best Practices",
19
18
  recommended: true,
20
19
  url: "https://eslint.org/docs/rules/no-octal"
21
20
  },
@@ -16,7 +16,6 @@ module.exports = {
16
16
 
17
17
  docs: {
18
18
  description: "disallow reassigning `function` parameters",
19
- category: "Best Practices",
20
19
  recommended: false,
21
20
  url: "https://eslint.org/docs/rules/no-param-reassign"
22
21
  },
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @fileoverview Disallow string concatenation when using __dirname and __filename
3
3
  * @author Nicholas C. Zakas
4
+ * @deprecated in ESLint v7.0.0
4
5
  */
5
6
  "use strict";
6
7
 
@@ -18,7 +19,6 @@ module.exports = {
18
19
 
19
20
  docs: {
20
21
  description: "disallow string concatenation with `__dirname` and `__filename`",
21
- category: "Node.js and CommonJS",
22
22
  recommended: false,
23
23
  url: "https://eslint.org/docs/rules/no-path-concat"
24
24
  },
@@ -51,7 +51,6 @@ module.exports = {
51
51
 
52
52
  docs: {
53
53
  description: "disallow the unary operators `++` and `--`",
54
- category: "Stylistic Issues",
55
54
  recommended: false,
56
55
  url: "https://eslint.org/docs/rules/no-plusplus"
57
56
  },
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @fileoverview Disallow the use of process.env()
3
3
  * @author Vignesh Anand
4
+ * @deprecated in ESLint v7.0.0
4
5
  */
5
6
  "use strict";
6
7
 
@@ -18,7 +19,6 @@ module.exports = {
18
19
 
19
20
  docs: {
20
21
  description: "disallow the use of `process.env`",
21
- category: "Node.js and CommonJS",
22
22
  recommended: false,
23
23
  url: "https://eslint.org/docs/rules/no-process-env"
24
24
  },
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @fileoverview Disallow the use of process.exit()
3
3
  * @author Nicholas C. Zakas
4
+ * @deprecated in ESLint v7.0.0
4
5
  */
5
6
  "use strict";
6
7
 
@@ -18,7 +19,6 @@ module.exports = {
18
19
 
19
20
  docs: {
20
21
  description: "disallow the use of `process.exit()`",
21
- category: "Node.js and CommonJS",
22
22
  recommended: false,
23
23
  url: "https://eslint.org/docs/rules/no-process-exit"
24
24
  },
@@ -69,7 +69,6 @@ module.exports = {
69
69
 
70
70
  docs: {
71
71
  description: "disallow returning values from Promise executor functions",
72
- category: "Possible Errors",
73
72
  recommended: false,
74
73
  url: "https://eslint.org/docs/rules/no-promise-executor-return"
75
74
  },
@@ -21,7 +21,6 @@ module.exports = {
21
21
 
22
22
  docs: {
23
23
  description: "disallow the use of the `__proto__` property",
24
- category: "Best Practices",
25
24
  recommended: false,
26
25
  url: "https://eslint.org/docs/rules/no-proto"
27
26
  },
@@ -20,7 +20,6 @@ module.exports = {
20
20
 
21
21
  docs: {
22
22
  description: "disallow calling some `Object.prototype` methods directly on objects",
23
- category: "Possible Errors",
24
23
  recommended: true,
25
24
  url: "https://eslint.org/docs/rules/no-prototype-builtins"
26
25
  },
@@ -21,7 +21,6 @@ module.exports = {
21
21
 
22
22
  docs: {
23
23
  description: "disallow variable redeclaration",
24
- category: "Best Practices",
25
24
  recommended: true,
26
25
  url: "https://eslint.org/docs/rules/no-redeclare"
27
26
  },
@@ -39,7 +39,6 @@ module.exports = {
39
39
 
40
40
  docs: {
41
41
  description: "disallow multiple spaces in regular expressions",
42
- category: "Possible Errors",
43
42
  recommended: true,
44
43
  url: "https://eslint.org/docs/rules/no-regex-spaces"
45
44
  },
@@ -15,7 +15,6 @@ module.exports = {
15
15
 
16
16
  docs: {
17
17
  description: "disallow specified names in exports",
18
- category: "ECMAScript 6",
19
18
  recommended: false,
20
19
  url: "https://eslint.org/docs/rules/no-restricted-exports"
21
20
  },
@@ -14,7 +14,6 @@ module.exports = {
14
14
 
15
15
  docs: {
16
16
  description: "disallow specified global variables",
17
- category: "Variables",
18
17
  recommended: false,
19
18
  url: "https://eslint.org/docs/rules/no-restricted-globals"
20
19
  },
@@ -43,7 +42,7 @@ module.exports = {
43
42
 
44
43
  messages: {
45
44
  defaultMessage: "Unexpected use of '{{name}}'.",
46
- // eslint-disable-next-line eslint-plugin/report-message-format
45
+ // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
47
46
  customMessage: "Unexpected use of '{{name}}'. {{customMessage}}"
48
47
  }
49
48
  },
@@ -79,26 +79,25 @@ module.exports = {
79
79
 
80
80
  docs: {
81
81
  description: "disallow specified modules when loaded by `import`",
82
- category: "ECMAScript 6",
83
82
  recommended: false,
84
83
  url: "https://eslint.org/docs/rules/no-restricted-imports"
85
84
  },
86
85
 
87
86
  messages: {
88
87
  path: "'{{importSource}}' import is restricted from being used.",
89
- // eslint-disable-next-line eslint-plugin/report-message-format
88
+ // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
90
89
  pathWithCustomMessage: "'{{importSource}}' import is restricted from being used. {{customMessage}}",
91
90
 
92
91
  patterns: "'{{importSource}}' import is restricted from being used by a pattern.",
93
- // eslint-disable-next-line eslint-plugin/report-message-format
92
+ // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
94
93
  patternWithCustomMessage: "'{{importSource}}' import is restricted from being used by a pattern. {{customMessage}}",
95
94
 
96
95
  everything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.",
97
- // eslint-disable-next-line eslint-plugin/report-message-format
96
+ // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
98
97
  everythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted. {{customMessage}}",
99
98
 
100
99
  importName: "'{{importName}}' import from '{{importSource}}' is restricted.",
101
- // eslint-disable-next-line eslint-plugin/report-message-format
100
+ // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
102
101
  importNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted. {{customMessage}}"
103
102
  },
104
103
 
@@ -147,7 +146,7 @@ module.exports = {
147
146
  ? [{ matcher: ignore().add(restrictedPatterns) }]
148
147
  : restrictedPatterns.map(({ group, message }) => ({ matcher: ignore().add(group), customMessage: message }));
149
148
 
150
- // if no imports are restricted we don"t need to check
149
+ // if no imports are restricted we don't need to check
151
150
  if (Object.keys(restrictedPaths).length === 0 && restrictedPatternGroups.length === 0) {
152
151
  return {};
153
152
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @fileoverview Restrict usage of specified node modules.
3
3
  * @author Christian Schulz
4
+ * @deprecated in ESLint v7.0.0
4
5
  */
5
6
  "use strict";
6
7
 
@@ -48,7 +49,6 @@ module.exports = {
48
49
 
49
50
  docs: {
50
51
  description: "disallow specified modules when loaded by `require`",
51
- category: "Node.js and CommonJS",
52
52
  recommended: false,
53
53
  url: "https://eslint.org/docs/rules/no-restricted-modules"
54
54
  },
@@ -73,7 +73,7 @@ module.exports = {
73
73
 
74
74
  messages: {
75
75
  defaultMessage: "'{{name}}' module is restricted from being used.",
76
- // eslint-disable-next-line eslint-plugin/report-message-format
76
+ // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
77
77
  customMessage: "'{{name}}' module is restricted from being used. {{customMessage}}",
78
78
  patternMessage: "'{{name}}' module is restricted from being used by a pattern."
79
79
  }
@@ -97,7 +97,7 @@ module.exports = {
97
97
  return memo;
98
98
  }, {});
99
99
 
100
- // if no imports are restricted we don"t need to check
100
+ // if no imports are restricted we don't need to check
101
101
  if (Object.keys(restrictedPaths).length === 0 && restrictedPatterns.length === 0) {
102
102
  return {};
103
103
  }
@@ -17,7 +17,6 @@ module.exports = {
17
17
 
18
18
  docs: {
19
19
  description: "disallow certain properties on certain objects",
20
- category: "Best Practices",
21
20
  recommended: false,
22
21
  url: "https://eslint.org/docs/rules/no-restricted-properties"
23
22
  },
@@ -64,9 +63,9 @@ module.exports = {
64
63
  },
65
64
 
66
65
  messages: {
67
- // eslint-disable-next-line eslint-plugin/report-message-format
66
+ // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
68
67
  restrictedObjectProperty: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}",
69
- // eslint-disable-next-line eslint-plugin/report-message-format
68
+ // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
70
69
  restrictedProperty: "'{{propertyName}}' is restricted from being used.{{message}}"
71
70
  }
72
71
  },
@@ -14,7 +14,6 @@ module.exports = {
14
14
 
15
15
  docs: {
16
16
  description: "disallow specified syntax",
17
- category: "Stylistic Issues",
18
17
  recommended: false,
19
18
  url: "https://eslint.org/docs/rules/no-restricted-syntax"
20
19
  },
@@ -42,7 +41,7 @@ module.exports = {
42
41
  },
43
42
 
44
43
  messages: {
45
- // eslint-disable-next-line eslint-plugin/report-message-format
44
+ // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
46
45
  restrictedSyntax: "{{message}}"
47
46
  }
48
47
  },
@@ -26,7 +26,6 @@ module.exports = {
26
26
 
27
27
  docs: {
28
28
  description: "disallow assignment operators in `return` statements",
29
- category: "Best Practices",
30
29
  recommended: false,
31
30
  url: "https://eslint.org/docs/rules/no-return-assign"
32
31
  },
@@ -16,7 +16,6 @@ module.exports = {
16
16
 
17
17
  docs: {
18
18
  description: "disallow unnecessary `return await`",
19
- category: "Best Practices",
20
19
 
21
20
  recommended: false,
22
21
 
@@ -2,8 +2,7 @@
2
2
  * @fileoverview Rule to flag when using javascript: urls
3
3
  * @author Ilya Volodin
4
4
  */
5
- /* jshint scripturl: true */
6
- /* eslint no-script-url: 0 */
5
+ /* eslint no-script-url: 0 -- Code is checking to report such URLs */
7
6
 
8
7
  "use strict";
9
8
 
@@ -19,7 +18,6 @@ module.exports = {
19
18
 
20
19
  docs: {
21
20
  description: "disallow `javascript:` urls",
22
- category: "Best Practices",
23
21
  recommended: false,
24
22
  url: "https://eslint.org/docs/rules/no-script-url"
25
23
  },
@@ -130,7 +130,6 @@ module.exports = {
130
130
 
131
131
  docs: {
132
132
  description: "disallow assignments where both sides are exactly the same",
133
- category: "Best Practices",
134
133
  recommended: true,
135
134
  url: "https://eslint.org/docs/rules/no-self-assign"
136
135
  },
@@ -16,7 +16,6 @@ module.exports = {
16
16
 
17
17
  docs: {
18
18
  description: "disallow comparisons where both sides are exactly the same",
19
- category: "Best Practices",
20
19
  recommended: false,
21
20
  url: "https://eslint.org/docs/rules/no-self-compare"
22
21
  },
@@ -29,7 +29,6 @@ module.exports = {
29
29
 
30
30
  docs: {
31
31
  description: "disallow comma operators",
32
- category: "Best Practices",
33
32
  recommended: false,
34
33
  url: "https://eslint.org/docs/rules/no-sequences"
35
34
  },
@@ -142,7 +142,6 @@ module.exports = {
142
142
 
143
143
  docs: {
144
144
  description: "disallow returning values from setters",
145
- category: "Possible Errors",
146
145
  recommended: true,
147
146
  url: "https://eslint.org/docs/rules/no-setter-return"
148
147
  },
@@ -27,7 +27,6 @@ module.exports = {
27
27
 
28
28
  docs: {
29
29
  description: "disallow identifiers from shadowing restricted names",
30
- category: "Variables",
31
30
  recommended: true,
32
31
  url: "https://eslint.org/docs/rules/no-shadow-restricted-names"
33
32
  },
@@ -21,7 +21,6 @@ module.exports = {
21
21
 
22
22
  docs: {
23
23
  description: "disallow variable declarations from shadowing variables declared in the outer scope",
24
- category: "Variables",
25
24
  recommended: false,
26
25
  url: "https://eslint.org/docs/rules/no-shadow"
27
26
  },
@@ -59,7 +58,7 @@ module.exports = {
59
58
 
60
59
  /**
61
60
  * Check if variable name is allowed.
62
- * @param {ASTNode} variable The variable to check.
61
+ * @param {ASTNode} variable The variable to check.
63
62
  * @returns {boolean} Whether or not the variable name is allowed.
64
63
  */
65
64
  function isAllowed(variable) {
@@ -16,7 +16,6 @@ module.exports = {
16
16
 
17
17
  docs: {
18
18
  description: "disallow spacing between function identifiers and their applications (deprecated)",
19
- category: "Stylistic Issues",
20
19
  recommended: false,
21
20
  url: "https://eslint.org/docs/rules/no-spaced-func"
22
21
  },
@@ -14,7 +14,6 @@ module.exports = {
14
14
 
15
15
  docs: {
16
16
  description: "disallow sparse arrays",
17
- category: "Possible Errors",
18
17
  recommended: true,
19
18
  url: "https://eslint.org/docs/rules/no-sparse-arrays"
20
19
  },
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * @fileoverview Rule to check for properties whose identifier ends with the string Sync
3
3
  * @author Matt DuVall<http://mattduvall.com/>
4
+ * @deprecated in ESLint v7.0.0
4
5
  */
5
6
 
6
- /* jshint node:true */
7
-
8
7
  "use strict";
9
8
 
10
9
  //------------------------------------------------------------------------------
@@ -21,7 +20,6 @@ module.exports = {
21
20
 
22
21
  docs: {
23
22
  description: "disallow synchronous methods",
24
- category: "Node.js and CommonJS",
25
23
  recommended: false,
26
24
  url: "https://eslint.org/docs/rules/no-sync"
27
25
  },
@@ -22,7 +22,6 @@ module.exports = {
22
22
 
23
23
  docs: {
24
24
  description: "disallow all tabs",
25
- category: "Stylistic Issues",
26
25
  recommended: false,
27
26
  url: "https://eslint.org/docs/rules/no-tabs"
28
27
  },
@@ -14,7 +14,6 @@ module.exports = {
14
14
 
15
15
  docs: {
16
16
  description: "disallow template literal placeholder syntax in regular strings",
17
- category: "Possible Errors",
18
17
  recommended: false,
19
18
  url: "https://eslint.org/docs/rules/no-template-curly-in-string"
20
19
  },
@@ -15,7 +15,6 @@ module.exports = {
15
15
 
16
16
  docs: {
17
17
  description: "disallow ternary operators",
18
- category: "Stylistic Issues",
19
18
  recommended: false,
20
19
  url: "https://eslint.org/docs/rules/no-ternary"
21
20
  },
@@ -40,7 +40,6 @@ module.exports = {
40
40
 
41
41
  docs: {
42
42
  description: "disallow `this`/`super` before calling `super()` in constructors",
43
- category: "ECMAScript 6",
44
43
  recommended: true,
45
44
  url: "https://eslint.org/docs/rules/no-this-before-super"
46
45
  },
@@ -17,7 +17,6 @@ module.exports = {
17
17
 
18
18
  docs: {
19
19
  description: "disallow throwing literals as exceptions",
20
- category: "Best Practices",
21
20
  recommended: false,
22
21
  url: "https://eslint.org/docs/rules/no-throw-literal"
23
22
  },
@@ -20,7 +20,6 @@ module.exports = {
20
20
 
21
21
  docs: {
22
22
  description: "disallow trailing whitespace at the end of lines",
23
- category: "Stylistic Issues",
24
23
  recommended: false,
25
24
  url: "https://eslint.org/docs/rules/no-trailing-spaces"
26
25
  },