Bug 1395890 - Change all ESLint rules that are warnings to errors. r=standard8 draft
authorDan Banner <dbugs@thebanners.uk>
Mon, 18 Sep 2017 19:07:17 +0100
changeset 676162 cf5171d9bf8f0e9b2e6fdbad061a3793a794955e
parent 675689 19b32a138d08f73961df878a29de6f0aad441683
child 734860 03dcae86f07e19f9cdbafcabc17d426ae9b29fc8
push id83404
push userbmo:dbugs@thebanners.uk
push dateFri, 06 Oct 2017 18:16:37 +0000
reviewersstandard8
bugs1395890
milestone58.0a1
Bug 1395890 - Change all ESLint rules that are warnings to errors. r=standard8 MozReview-Commit-ID: LJS6m1GppiS
browser/components/extensions/test/browser/browser_ext_find.js
browser/extensions/formautofill/.eslintrc.js
devtools/.eslintrc.js
toolkit/components/extensions/.eslintrc.js
toolkit/components/narrate/.eslintrc.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js
--- a/browser/components/extensions/test/browser/browser_ext_find.js
+++ b/browser/components/extensions/test/browser/browser_ext_find.js
@@ -1,11 +1,12 @@
 /* global browser */
 "use strict";
 
+/* eslint-disable mozilla/no-cpows-in-tests */
 function frameScript() {
   function getSelectedText() {
     let frame = this.content.frames[0].frames[1];
     let Ci = Components.interfaces;
     let docShell = frame.QueryInterface(Ci.nsIInterfaceRequestor)
                         .getInterface(Ci.nsIWebNavigation)
                         .QueryInterface(Ci.nsIDocShell);
     let controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
@@ -16,16 +17,17 @@ function frameScript() {
     let r1 = frame.parent.frameElement.getBoundingClientRect();
     let r2 = frame.frameElement.getBoundingClientRect();
     let r3 = range.getBoundingClientRect();
     let rect = {top: (r1.top + r2.top + r3.top), left: (r1.left + r2.left + r3.left)};
     this.sendAsyncMessage("test:find:selectionTest", {text: selection.toString(), rect});
   }
   getSelectedText();
 }
+/* eslint-enable mozilla/no-cpows-in-tests */
 
 function waitForMessage(messageManager, topic) {
   return new Promise(resolve => {
     messageManager.addMessageListener(topic, function messageListener(message) {
       messageManager.removeMessageListener(topic, messageListener);
       resolve(message);
     });
   });
@@ -130,9 +132,8 @@ add_task(async function testDuplicatePin
 
   info("Test that text was highlighted properly.");
   is(message.data.text, "bananA", `The text that was highlighted: - Expected: bananA, Actual: ${message.data.text}`);
 
   info("Test that rectangle data returned from the search matches the highlighted result.");
   is(message.data.rect.top, top, `rect.top: - Expected: ${message.data.rect.top}, Actual: ${top}`);
   is(message.data.rect.left, left, `rect.left: - Expected: ${message.data.rect.left}, Actual: ${left}`);
 });
-
--- a/browser/extensions/formautofill/.eslintrc.js
+++ b/browser/extensions/formautofill/.eslintrc.js
@@ -77,34 +77,34 @@ module.exports = {
 
     // Disallow using the console API.
     "no-console": "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",
+    "no-multi-str": "error",
 
     // Disallow multiple empty lines.
-    "no-multiple-empty-lines": ["warn", {"max": 2}],
+    "no-multiple-empty-lines": ["error", {"max": 2}],
 
     // Disallow usage of __proto__ property.
     "no-proto": "error",
 
     // Disallow use of assignment in return statement. It is preferable for a
     // single line of code to have only one easily predictable effect.
     "no-return-assign": "error",
 
     // Disallow throwing literals (eg. throw "error" instead of
     // throw new Error("error")).
     "no-throw-literal": "error",
 
     // Disallow padding within blocks.
-    "padded-blocks": ["warn", "never"],
+    "padded-blocks": ["error", "never"],
 
     // Require use of the second argument for parseInt().
     "radix": "error",
 
     // Enforce spacing after semicolons.
     "semi-spacing": ["error", {"before": false, "after": true}],
 
     // Require "use strict" to be defined globally in the script.
--- a/devtools/.eslintrc.js
+++ b/devtools/.eslintrc.js
@@ -34,35 +34,35 @@ module.exports = {
     "WebSocket": true,
     "XMLHttpRequest": true
   },
   "rules": {
     // These are the rules that have been configured so far to match the
     // devtools coding style.
 
     // Rules from the mozilla plugin
-    "mozilla/no-aArgs": "warn",
+    "mozilla/no-aArgs": "error",
     "mozilla/no-cpows-in-tests": "error",
     "mozilla/no-single-arg-cu-import": "error",
     // See bug 1224289.
     "mozilla/reject-importGlobalProperties": "error",
     // devtools/shared/platform is special; see the README.md in that
     // directory for details.  We reject requires using explicit
     // subdirectories of this directory.
     "mozilla/reject-some-requires": ["error", "^devtools/shared/platform/(chome|content)/"],
-    "mozilla/var-only-at-top-level": "warn",
+    "mozilla/var-only-at-top-level": "error",
 
     // Rules from the React plugin
     "react/display-name": "error",
     "react/no-danger": "error",
     "react/no-did-mount-set-state": "error",
     "react/no-did-update-set-state": "error",
     "react/no-direct-mutation-state": "error",
     "react/no-unknown-property": "error",
-    "react/prefer-es6-class": ["warn", "never"],
+    "react/prefer-es6-class": ["error", "never"],
     "react/prop-types": "error",
     "react/sort-comp": ["error", {
       order: [
         "lifecycle",
         "everything-else",
         "render"
       ],
       groups: {
--- a/toolkit/components/extensions/.eslintrc.js
+++ b/toolkit/components/extensions/.eslintrc.js
@@ -18,18 +18,18 @@ module.exports = {
     "Services": true,
     "XPCOMUtils": true,
   },
 
   "rules": {
     // Rules from the mozilla plugin
     "mozilla/balanced-listeners": "error",
     "mozilla/no-aArgs": "error",
-    "mozilla/no-cpows-in-tests": "warn",
-    "mozilla/var-only-at-top-level": "warn",
+    "mozilla/no-cpows-in-tests": "error",
+    "mozilla/var-only-at-top-level": "error",
 
     "valid-jsdoc": ["error", {
       "prefer": {
         "return": "returns",
       },
       "preferType": {
         "Boolean": "boolean",
         "Number": "number",
@@ -70,17 +70,17 @@ module.exports = {
     "no-empty": "error",
 
     // No mixing different operators without parens
     "no-mixed-operators": ["error", {"groups": [["&&", "||"], ["==", "!=", "===", "!==", ">", ">=", "<", "<="], ["in", "instanceof"]]}],
 
     // Disallow use of multiple spaces (sometimes used to align const values,
     // array or object items, etc.). It's hard to maintain and doesn't add that
     // much benefit.
-    "no-multi-spaces": "warn",
+    "no-multi-spaces": "error",
 
     // No expressions where a statement is expected
     "no-unused-expressions": "error",
 
     // No declaring variables that are never used
     "no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
 
     // No using variables before defined
@@ -88,17 +88,17 @@ module.exports = {
 
     // Always require semicolon at end of statement
     "semi": ["error", "always"],
 
     // Never use spaces before function parentheses
     "space-before-function-paren": ["error", {"anonymous": "never", "named": "never"}],
 
     // ++ and -- should not need spacing
-    "space-unary-ops": ["warn", {"nonwords": false, "words": true, "overrides": {"typeof": false}}],
+    "space-unary-ops": ["error", {"nonwords": false, "words": true, "overrides": {"typeof": false}}],
 
     // Disallow using variables outside the blocks they are defined (especially
     // since only let and const are used, see "no-var").
     "block-scoped-var": "error",
 
     // Allow trailing commas for easy list extension.  Having them does not
     // impair readability, but also not required either.
     "comma-dangle": ["error", "always-multiline"],
@@ -183,17 +183,17 @@ module.exports = {
 
     // Allow comments inline after code.
     "no-inline-comments": "off",
 
     // Disallow use of labels for anything other then loops and switches.
     "no-labels": ["error", {"allowLoop": true}],
 
     // Disallow use of multiline strings (use template strings instead).
-    "no-multi-str": "warn",
+    "no-multi-str": "error",
 
     // Disallow multiple empty lines.
     "no-multiple-empty-lines": [1, {"max": 2}],
 
     // Allow reassignment of function parameters.
     "no-param-reassign": "off",
 
     // Allow string concatenation with __dirname and __filename (not a node env).
@@ -251,17 +251,17 @@ module.exports = {
     // We use this in the code a lot, but not consistently, and this seems more
     // like something to check at code review time.
     "object-shorthand": "off",
 
     // Allow more than one variable declaration per function.
     "one-var": "off",
 
     // Disallow padding within blocks.
-    "padded-blocks": ["warn", "never"],
+    "padded-blocks": ["error", "never"],
 
     // Don't require quotes around object literal property names.
     "quote-props": "off",
 
     // Require use of the second argument for parseInt().
     "radix": "error",
 
     // Enforce spacing after semicolons.
--- a/toolkit/components/narrate/.eslintrc.js
+++ b/toolkit/components/narrate/.eslintrc.js
@@ -1,39 +1,39 @@
 "use strict";
 
 module.exports = {
   "rules": {
-    "mozilla/no-aArgs": "warn",
-    "mozilla/reject-importGlobalProperties": "warn",
-    "mozilla/var-only-at-top-level": "warn",
+    "mozilla/no-aArgs": "error",
+    "mozilla/reject-importGlobalProperties": "error",
+    "mozilla/var-only-at-top-level": "error",
     "block-scoped-var": "error",
-    "camelcase": "warn",
+    "camelcase": "error",
     "comma-dangle": "off",
     "complexity": ["error", {"max": 20}],
     "curly": "error",
-    "dot-location": ["warn", "property"],
-    "indent": ["warn", 2, {"SwitchCase": 1}],
-    "max-len": ["warn", 80, 2, {"ignoreUrls": true}],
+    "dot-location": ["error", "property"],
+    "indent": ["error", 2, {"SwitchCase": 1}],
+    "max-len": ["error", 80, 2, {"ignoreUrls": true}],
     "max-nested-callbacks": ["error", 3],
     "new-cap": ["error", {"capIsNew": false}],
     "new-parens": "error",
     "no-extend-native": "error",
     "no-fallthrough": "error",
-    "no-inline-comments": "warn",
+    "no-inline-comments": "error",
     "no-mixed-spaces-and-tabs": "error",
-    "no-multi-spaces": "warn",
-    "no-multi-str": "warn",
-    "no-multiple-empty-lines": ["warn", {"max": 1}],
+    "no-multi-spaces": "error",
+    "no-multi-str": "error",
+    "no-multiple-empty-lines": ["error", {"max": 1}],
     "no-return-assign": "error",
     "no-sequences": "error",
-    "no-shadow": "warn",
+    "no-shadow": "error",
     "no-throw-literal": "error",
     "no-unused-vars": "error",
-    "padded-blocks": ["warn", "never"],
-    "quotes": ["warn", "double", "avoid-escape"],
-    "semi": ["warn", "always"],
-    "semi-spacing": ["warn", {"before": false, "after": true}],
-    "space-in-parens": ["warn", "never"],
+    "padded-blocks": ["error", "never"],
+    "quotes": ["error", "double", "avoid-escape"],
+    "semi": ["error", "always"],
+    "semi-spacing": ["error", {"before": false, "after": true}],
+    "space-in-parens": ["error", "never"],
     "strict": ["error", "global"],
     "yoda": "error"
   }
 };
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
@@ -54,13 +54,13 @@ module.exports = {
   },
 
   "plugins": [
     "mozilla"
   ],
 
   "rules": {
     "mozilla/import-content-task-globals": "error",
-    "mozilla/import-headjs-globals": "warn",
-    "mozilla/mark-test-function-used": "warn",
+    "mozilla/import-headjs-globals": "error",
+    "mozilla/mark-test-function-used": "error",
     "mozilla/no-arbitrary-setTimeout": "error"
   }
 };
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
@@ -44,12 +44,12 @@ module.exports = {
   },
 
   "plugins": [
     "mozilla"
   ],
 
   rules: {
     "mozilla/import-content-task-globals": "error",
-    "mozilla/import-headjs-globals": "warn",
-    "mozilla/mark-test-function-used": "warn"
+    "mozilla/import-headjs-globals": "error",
+    "mozilla/mark-test-function-used": "error"
   }
 };
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js
@@ -40,13 +40,13 @@ module.exports = {
   },
 
   "plugins": [
     "mozilla"
   ],
 
   "rules": {
     "mozilla/import-content-task-globals": "error",
-    "mozilla/import-headjs-globals": "warn",
-    "mozilla/mark-test-function-used": "warn",
+    "mozilla/import-headjs-globals": "error",
+    "mozilla/mark-test-function-used": "error",
     "no-shadow": "error"
   }
 };
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js
@@ -62,15 +62,15 @@ module.exports = {
     "todo_check_true": false,
     // Firefox specific function.
     // eslint-disable-next-line max-len
     // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval
     "uneval": false
   },
 
   rules: {
-    "mozilla/import-headjs-globals": "warn",
-    "mozilla/mark-test-function-used": "warn",
+    "mozilla/import-headjs-globals": "error",
+    "mozilla/mark-test-function-used": "error",
     "mozilla/no-arbitrary-setTimeout": "error",
     "mozilla/no-useless-run-test": "error",
     "no-shadow": "error"
   }
 };