Bug 1363353 - Apply mozilla/recommended ESLint rules to mobile/android. r?sebastian draft
authorMark Banner <standard8@mozilla.com>
Tue, 09 May 2017 13:55:49 +0100
changeset 574817 43c73c3fffe0c6bc5eab3b59c69977525459275c
parent 574816 4dbaf47e677a3b200ae620b2dde62d06a1542900
child 627708 20c3c538fbc34913c30f3de67b5b47bb9f3dd56b
push id57826
push usermbanner@mozilla.com
push dateTue, 09 May 2017 12:56:38 +0000
reviewerssebastian
bugs1363353
milestone55.0a1
Bug 1363353 - Apply mozilla/recommended ESLint rules to mobile/android. r?sebastian MozReview-Commit-ID: D0oCUcq3KNB
mobile/android/.eslintrc.js
--- a/mobile/android/.eslintrc.js
+++ b/mobile/android/.eslintrc.js
@@ -1,17 +1,16 @@
 "use strict";
 
 module.exports = {
-  env: {
-    "browser": true
-  },
+  extends: [
+    "plugin:mozilla/recommended"
+  ],
+
   globals: {
-    "Components": false,
-
     // TODO: Create custom rule for `Cu.import`
     "AddonManager": false,
     "AppConstants": false,
     "Downloads": false,
     "File": false,
     "FileUtils": false,
     "HelperApps": true, // TODO: Can be more specific here.
     "JNI": true, // TODO: Can be more specific here.
@@ -27,94 +26,55 @@ module.exports = {
     "strings": false,
     "Strings": false,
     "Task": false,
     "TelemetryStopwatch": false,
     "UITelemetry": false,
     "UserAgentOverrides": 0,
     "XPCOMUtils": false,
     "ctypes": false,
-    "dump": false,
     "exports": false,
     "importScripts": false,
     "module": false,
     "require": false,
     "uuidgen": false,
 
     "Iterator": false // TODO: Remove - deprecated!
   },
   rules: {
-    "global-strict": "off", // Overridden by "strict"
-    "no-underscore-dangle": "off", // We allow trailing underscores in names.
-
-    // We disable everything to get all files to pass w/o updating them.
-    // We'll re-enable one by one.
-    "camelcase": "off",
-    "comma-dangle": "off",
-    "comma-spacing": "off",
-
     // XXX Bug 1358949 - This should be reduced down - probably to 20 or to
     // be removed & synced with the mozilla/recommended value.
     "complexity": ["error", 31],
 
+    // Rules enabled in mozilla/recommended, and disabled for now, we should
+    // re-enable these over time.
+    "block-spacing": "off",
+    "brace-style": "off",
+    "comma-spacing": "off",
     "consistent-return": "off",
-    "curly": "off",
-    "dot-notation": "off",
-    "eqeqeq": "off",
+    "eol-last": "off",
     "key-spacing": "off",
-    "new-cap": "off",
-    "no-caller": "off",
-    "no-constant-condition": "off",
+    "keyword-spacing": "off",
+    "no-else-return": "off",
     "no-empty": "off",
     "no-extra-bind": "off",
     "no-extra-semi": "off",
-    "no-loop-func": "off",
+    "no-lonely-if": "off",
     "no-multi-spaces": "off",
+    "no-native-reassign": "off",
+    "no-nested-ternary": "off",
     "no-new-object": "off",
     "no-octal": "off",
-    "no-return-assign": "off",
-    "no-shadow": "off",
+    "no-redeclare": "off",
     "no-trailing-spaces": "off",
+    "no-useless-call": "off",
+    "no-useless-concat": "off",
+    "no-useless-return": "off",
+    "no-undef": "off",
     "no-unused-vars": "off",
-    "no-use-before-define": "off",
+    "object-shorthand": "off",
     "quotes": "off", // [2, "double"]
-    "semi": "off",
+    "space-before-blocks": "off",
+    "space-before-function-paren": "off",
     "space-infix-ops": "off",
-    "space-unary-ops": "off", // 2: https://github.com/eslint/eslint/issues/2764
-    "strict": "off"
+    "spaced-comment": "off",
   }
-
-  // "ecmaFeatures": {
-  //   "forOf": true,
-  //   "jsx": true,
-  // },
-  // "rules": {
-  //   // turn off all kinds of stuff that we actually do want, because
-  //   // right now, we're bootstrapping the linting infrastructure.  We'll
-  //   // want to audit these rules, and start turning them on and fixing the
-  //   // problems they find, one at a time.
-  //
-  //   // Eslint built-in rules are documented at <http://eslint.org/docs/rules/>
-  //   "camelcase": 0,               // TODO: Remove (use default)
-  //   "consistent-return": 0,       // TODO: Remove (use default)
-  //   dot-location: 0,              // [2, property],
-  //   "eqeqeq": 0,                  // TBD. Might need to be separate for content & chrome
-  //   "global-strict": 0,           // Leave as zero (this will be unsupported in eslint 1.0.0)
-  //   "linebreak-style": [2, "unix"],
-  //   "new-cap": 0,                 // TODO: Remove (use default)
-  //   "no-catch-shadow": 0,         // TODO: Remove (use default)
-  //   "no-console": 0,              // Leave as 0. We use console logging in content code.
-  //   "no-empty": 0,                // TODO: Remove (use default)
-  //   "no-extra-bind": 0,           // Leave as 0
-  //   "no-extra-boolean-cast": 0,   // TODO: Remove (use default)
-  //   "no-multi-spaces": 0,         // TBD.
-  //   "no-new": 0,                  // TODO: Remove (use default)
-  //   "no-redeclare": 0,            // TODO: Remove (use default)
-  //   "no-return-assign": 0,        // TODO: Remove (use default)
-  //   "no-underscore-dangle": 0,    // Leave as 0. Commonly used for private variables.
-  //   "no-unneeded-ternary": 2,
-  //   "no-unused-expressions": 0,   // TODO: Remove (use default)
-  //   "no-unused-vars": 0,          // TODO: Remove (use default)
-  //   "no-use-before-define": 0,    // TODO: Remove (use default)
-  //   "quotes": [2, "double", "avoid-escape"],
-  //   "strict": 0,                  // [2, "function"],
-  // }
 };