From 8cce06cb39886902ce0d2e6882f46c3bf52fb955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=96=9B=E5=AE=9A=E8=B0=94=E7=9A=84=E7=8C=AB?= Date: Fri, 6 Aug 2021 03:42:30 +0800 Subject: [PATCH] Breaking: add some rules to eslint:recommended (refs #14673) (#14691) * no-loss-of-precision * no-unsafe-optional-chaining * no-useless-backreference * no-nonoctal-decimal-escape --- conf/eslint-recommended.js | 4 ++++ lib/rules/no-loss-of-precision.js | 2 +- lib/rules/no-nonoctal-decimal-escape.js | 2 +- lib/rules/no-unsafe-optional-chaining.js | 2 +- lib/rules/no-useless-backreference.js | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/conf/eslint-recommended.js b/conf/eslint-recommended.js index 2137685fb7c..7d2161a50a7 100644 --- a/conf/eslint-recommended.js +++ b/conf/eslint-recommended.js @@ -42,9 +42,11 @@ module.exports = { "no-inner-declarations": "error", "no-invalid-regexp": "error", "no-irregular-whitespace": "error", + "no-loss-of-precision": "error", "no-misleading-character-class": "error", "no-mixed-spaces-and-tabs": "error", "no-new-symbol": "error", + "no-nonoctal-decimal-escape": "error", "no-obj-calls": "error", "no-octal": "error", "no-prototype-builtins": "error", @@ -60,8 +62,10 @@ module.exports = { "no-unreachable": "error", "no-unsafe-finally": "error", "no-unsafe-negation": "error", + "no-unsafe-optional-chaining": "error", "no-unused-labels": "error", "no-unused-vars": "error", + "no-useless-backreference": "error", "no-useless-catch": "error", "no-useless-escape": "error", "no-with": "error", diff --git a/lib/rules/no-loss-of-precision.js b/lib/rules/no-loss-of-precision.js index 2d0c6184220..022bba2525a 100644 --- a/lib/rules/no-loss-of-precision.js +++ b/lib/rules/no-loss-of-precision.js @@ -16,7 +16,7 @@ module.exports = { docs: { description: "disallow literal numbers that lose precision", category: "Possible Errors", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-loss-of-precision" }, schema: [], diff --git a/lib/rules/no-nonoctal-decimal-escape.js b/lib/rules/no-nonoctal-decimal-escape.js index a4b46d9591f..78cc39815c6 100644 --- a/lib/rules/no-nonoctal-decimal-escape.js +++ b/lib/rules/no-nonoctal-decimal-escape.js @@ -31,7 +31,7 @@ module.exports = { docs: { description: "disallow `\\8` and `\\9` escape sequences in string literals", category: "Best Practices", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-nonoctal-decimal-escape", suggestion: true }, diff --git a/lib/rules/no-unsafe-optional-chaining.js b/lib/rules/no-unsafe-optional-chaining.js index 2eafc1ad8f1..e430a3bdea0 100644 --- a/lib/rules/no-unsafe-optional-chaining.js +++ b/lib/rules/no-unsafe-optional-chaining.js @@ -25,7 +25,7 @@ module.exports = { docs: { description: "disallow use of optional chaining in contexts where the `undefined` value is not allowed", category: "Possible Errors", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-unsafe-optional-chaining" }, schema: [{ diff --git a/lib/rules/no-useless-backreference.js b/lib/rules/no-useless-backreference.js index 529c16439e3..cb588d91b35 100644 --- a/lib/rules/no-useless-backreference.js +++ b/lib/rules/no-useless-backreference.js @@ -65,7 +65,7 @@ module.exports = { docs: { description: "disallow useless backreferences in regular expressions", category: "Possible Errors", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-useless-backreference" },