Bug 1370240 - Enable the ESLint no-control-regex rule across mozilla-central. r=mossop
authorMark Banner <standard8@mozilla.com>
Mon, 05 Jun 2017 15:43:09 +0100
changeset 412846 f9eddc0d3345f353f4155521ae1234b2df6aa6e8
parent 412845 5450b06e79e588e2589df76aba35235aa35dbfa8
child 412847 a7ea563ab337e8f8b889df2a135007c896fea022
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1370240
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1370240 - Enable the ESLint no-control-regex rule across mozilla-central. r=mossop MozReview-Commit-ID: IN7YMk7yhAO
accessible/tests/browser/.eslintrc.js
browser/base/content/browser.js
browser/components/migration/.eslintrc.js
browser/extensions/formautofill/.eslintrc.js
security/.eslintrc.js
toolkit/components/extensions/.eslintrc.js
toolkit/components/narrate/.eslintrc.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
--- a/accessible/tests/browser/.eslintrc.js
+++ b/accessible/tests/browser/.eslintrc.js
@@ -33,17 +33,16 @@ module.exports = {
     "new-parens": "error",
     "no-bitwise": "off",
     "no-caller": "error",
     "no-catch-shadow": "error",
     "no-comma-dangle": "off",
     "no-console": "off",
     "no-constant-condition": "off",
     "no-continue": "off",
-    "no-control-regex": "error",
     "no-div-regex": "off",
     "no-extend-native": "error",
     "no-extra-parens": "off",
     "no-extra-strict": "off",
     "no-fallthrough": "error",
     "no-floating-decimal": "off",
     "no-inline-comments": "off",
     "no-mixed-requires": "off",
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4080,17 +4080,17 @@ function FillHistoryMenu(aParent) {
   updateSessionHistory(sessionHistory, true);
   return true;
 }
 
 function addToUrlbarHistory(aUrlToAdd) {
   if (!PrivateBrowsingUtils.isWindowPrivate(window) &&
       aUrlToAdd &&
       !aUrlToAdd.includes(" ") &&
-      !/[\x00-\x1F]/.test(aUrlToAdd))
+      !/[\x00-\x1F]/.test(aUrlToAdd)) // eslint-disable-line no-control-regex
     PlacesUIUtils.markPageAsTyped(aUrlToAdd);
 }
 
 function BrowserDownloadsUI() {
   if (PrivateBrowsingUtils.isWindowPrivate(window)) {
     openUILinkIn("about:downloads", "tab");
   } else {
     PlacesCommandHook.showPlacesOrganizer("Downloads");
--- a/browser/components/migration/.eslintrc.js
+++ b/browser/components/migration/.eslintrc.js
@@ -9,17 +9,16 @@ module.exports = {
     "block-scoped-var": "error",
     "comma-dangle": "off",
     "comma-style": ["error", "last"],
     "complexity": ["error", {"max": 21}],
     "dot-notation": "error",
     "indent": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
     "max-nested-callbacks": ["error", 3],
     "new-parens": "error",
-    "no-control-regex": "error",
     "no-extend-native": "error",
     "no-fallthrough": ["error", { "commentPattern": ".*[Ii]ntentional(?:ly)?\\s+fall(?:ing)?[\\s-]*through.*" }],
     "no-multi-str": "error",
     "no-return-assign": "error",
     "no-sequences": "error",
     "no-shadow": "error",
     "no-throw-literal": "error",
     "no-unneeded-ternary": "error",
--- a/browser/extensions/formautofill/.eslintrc.js
+++ b/browser/extensions/formautofill/.eslintrc.js
@@ -93,19 +93,16 @@ module.exports = {
     "max-nested-callbacks": ["error", 4],
 
     // Disallow use of arguments.caller or arguments.callee.
     "no-caller": "error",
 
     // Disallow using the console API.
     "no-console": "error",
 
-    // Disallow control characters in regular expressions.
-    "no-control-regex": "error",
-
     // Disallow fallthrough of case statements, except if there is a comment.
     "no-fallthrough": "error",
 
     // Disallow use of multiline strings (use template strings instead).
     "no-multi-str": "warn",
 
     // Disallow multiple empty lines.
     "no-multiple-empty-lines": ["warn", {"max": 2}],
--- a/security/.eslintrc.js
+++ b/security/.eslintrc.js
@@ -46,19 +46,16 @@ module.exports = {
     "no-console": "error",
 
     // Disallow modifying variables that are declared using const.
     "no-const-assign": "error",
 
     // Disallow constant expressions in conditions (except for loops).
     "no-constant-condition": ["error", { "checkLoops": false }],
 
-    // Disallow control characters in regular expressions.
-    "no-control-regex": "error",
-
     // Disallow duplicate class members.
     "no-dupe-class-members": "error",
 
     // Disallow extending of native objects.
     "no-extend-native": "error",
 
     // Disallow case statement fallthrough without explicit `// falls through`
     // annotation.
--- a/toolkit/components/extensions/.eslintrc.js
+++ b/toolkit/components/extensions/.eslintrc.js
@@ -198,19 +198,16 @@ module.exports = {
     "no-console": "error",
 
     // Allow using constant expressions in conditions like while (true)
     "no-constant-condition": "off",
 
     // Allow use of the continue statement.
     "no-continue": "off",
 
-    // Disallow control characters in regular expressions.
-    "no-control-regex": "error",
-
     // Allow division operators explicitly at beginning of regular expression.
     "no-div-regex": "off",
 
     // Disallow adding to native types
     "no-extend-native": "error",
 
     // Allow unnecessary parentheses, as they may make the code more readable.
     "no-extra-parens": "off",
--- a/toolkit/components/narrate/.eslintrc.js
+++ b/toolkit/components/narrate/.eslintrc.js
@@ -18,17 +18,16 @@ module.exports = {
     "dot-location": ["warn", "property"],
     "dot-notation": "error",
     "generator-star-spacing": ["warn", "after"],
     "indent": ["warn", 2, {"SwitchCase": 1}],
     "max-len": ["warn", 80, 2, {"ignoreUrls": true}],
     "max-nested-callbacks": ["error", 3],
     "new-cap": ["error", {"capIsNew": false}],
     "new-parens": "error",
-    "no-control-regex": "error",
     "no-extend-native": "error",
     "no-fallthrough": "error",
     "no-inline-comments": "warn",
     "no-mixed-spaces-and-tabs": "error",
     "no-multi-spaces": "warn",
     "no-multi-str": "warn",
     "no-multiple-empty-lines": ["warn", {"max": 1}],
     "no-return-assign": "error",
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -141,16 +141,19 @@ module.exports = {
     // "new-parens": "error",
 
     // Use [] instead of Array()
     "no-array-constructor": "error",
 
     // Disallow assignment operators in conditional statements
     "no-cond-assign": "error",
 
+    // Disallow control characters in regular expressions.
+    "no-control-regex": "error",
+
     // Disallow the use of debugger
     "no-debugger": "error",
 
     // Disallow deleting variables
     "no-delete-var": "error",
 
     // No duplicate arguments in function declarations
     "no-dupe-args": "error",