Bug 1158112 - Move the Loop modules into a sub-directory and prepare eslint for enabling more rules for Loop. r=dmose
authorMark Banner <standard8@mozilla.com>
Thu, 30 Apr 2015 07:40:49 +0100
changeset 273185 6eb3e36c9795cfb5a226b329adc46a3a7e5972b5
parent 273073 bad247df4aecc6303cd5423fa02861c31e1e4ea3
child 273186 511678a783bc29cfb1f718e5e8baf61513f7f271
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmose
bugs1158112
milestone40.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 1158112 - Move the Loop modules into a sub-directory and prepare eslint for enabling more rules for Loop. r=dmose
browser/components/loop/.eslintignore
browser/components/loop/.eslintrc
browser/components/loop/CardDavImporter.jsm
browser/components/loop/GoogleImporter.jsm
browser/components/loop/LoopCalls.jsm
browser/components/loop/LoopContacts.jsm
browser/components/loop/LoopRooms.jsm
browser/components/loop/LoopStorage.jsm
browser/components/loop/MozLoopAPI.jsm
browser/components/loop/MozLoopPushHandler.jsm
browser/components/loop/MozLoopService.jsm
browser/components/loop/MozLoopWorker.js
browser/components/loop/content/js/.eslintrc
browser/components/loop/content/shared/.eslintrc
browser/components/loop/modules/.eslintrc
browser/components/loop/modules/CardDavImporter.jsm
browser/components/loop/modules/GoogleImporter.jsm
browser/components/loop/modules/LoopCalls.jsm
browser/components/loop/modules/LoopContacts.jsm
browser/components/loop/modules/LoopRooms.jsm
browser/components/loop/modules/LoopStorage.jsm
browser/components/loop/modules/MozLoopAPI.jsm
browser/components/loop/modules/MozLoopPushHandler.jsm
browser/components/loop/modules/MozLoopService.jsm
browser/components/loop/modules/MozLoopWorker.js
browser/components/loop/moz.build
browser/components/loop/standalone/.eslintrc
browser/components/loop/standalone/package.json
browser/components/loop/test/.eslintrc
--- a/browser/components/loop/.eslintignore
+++ b/browser/components/loop/.eslintignore
@@ -1,12 +1,14 @@
-# We still need to fix warnings in this file.
-MozLoopWorker.js
-# This file currently uses es7 features
-MozLoopAPI.jsm
+# This file currently uses a non-standard (and not on a standards track)
+# if statement within catch.
+modules/MozLoopWorker.js
+# This file currently uses es7 features eslint issue:
+# https://github.com/eslint/espree/issues/125
+modules/MozLoopAPI.jsm
 # Libs we don't need to check
 content/libs
 content/shared/libs
 standalone/content/libs
 standalone/node_modules
 # We should look at turning these on when we fix the warnings
 test/xpcshell
 test/mochitest
--- a/browser/components/loop/.eslintrc
+++ b/browser/components/loop/.eslintrc
@@ -1,27 +1,17 @@
+// Note: there are extra allowances for files used solely in Firefox desktop,
+// see content/js/.eslintrc and modules/.eslintrc
 {
   "plugins": [
     "react"
   ],
   "ecmaFeatures": {
     "forOf": true,
     "jsx": true,
-    // These are on for this directory for .jsm and content/js files.
-    // If adding more items here, consider turning them off for the following
-    // files if they aren't supported by all browsers.
-    // content/shared/.eslintrc
-    // content/standalone/.eslintrc
-    "blockBindings": true,
-    "arrowFunctions": true,
-    "destructuring": true,
-    "generators": true,
-    "spread": true,
-    "restParams": true,
-    "objectLiteralShorthandMethods": true
   },
   "env": {
     "browser": true,
     "mocha": true
   },
   "globals": {
     "_": false,
     "$": false,
@@ -38,69 +28,71 @@
   },
   "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,
-    "comma-dangle": 0,
-    "comma-spacing": 0,
-    "consistent-return": 0,
-    "curly": 0,
-    "dot-notation": 0,
-    "eol-last": 0,
-    "eqeqeq": 0,
-    "global-strict": 0,
-    "key-spacing": 0,
-    "new-cap": 0,
-    "no-catch-shadow": 0,
-    "no-console": 0,
-    "no-empty": 0,
-    "no-extra-bind": 0,
-    "no-extra-boolean-cast": 0,
-    "no-extra-semi": 0,
-    "no-multi-spaces": 0,
-    "no-new": 0,
-    "no-redeclare": 0,
-    "no-return-assign": 0,
-    "no-shadow": 0,
-    "no-spaced-func": 0,
-    "no-trailing-spaces": 0,
-    "no-undef": 0,
-    "no-underscore-dangle": 0,
-    "no-unused-expressions": 0,
-    "no-unused-vars": 0,
-    "no-use-before-define": 0,
-    "no-wrap-func": 0,
-    "quotes": 0,
-    "semi": 0,
-    "semi-spacing": 0,
-    "space-infix-ops": 0,
-    "space-return-throw-case": 0,
-    "strict": 0,
-    "yoda": 0,
+    "camelcase": 0,               // TODO: Remove (use default)
+    "comma-dangle": 0,            // TODO: Remove (use default)
+    "comma-spacing": 0,           // TODO: Remove (use default)
+    "consistent-return": 0,       // TODO: Remove (use default)
+    "curly": 0,                   // TODO: Remove (use default)
+    "dot-notation": 0,            // TODO: Remove (use default)
+    "eol-last": 0,                // TODO: Remove (use default)
+    "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)
+    "key-spacing": 0,             // TODO: Remove (use default)
+    "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-extra-semi": 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-shadow": 0,               // TODO: Remove (use default)
+    "no-spaced-func": 0,          // TODO: Remove (use default)
+    "no-trailing-spaces": 0,      // TODO: Remove (use default)
+    "no-undef": 0,                // TODO: Remove (use default)
+    "no-underscore-dangle": 0,    // Leave as 0. Commonly used for private variables.
+    "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)
+    "no-wrap-func": 0,            // TODO: Remove (use default)
+    "quotes": 0,                  // [2, "double", "avoid-escape"],
+    "semi": 0,                    // TODO: Remove (use default)
+    "semi-spacing": 0,            // TODO: Remove (use default)
+    "space-infix-ops": 0,         // TODO: Remove (use default)
+    "space-return-throw-case": 0, // TODO: Remove (use default)
+    "strict": 0,                  // [2, "function"],
+    "yoda": 0,                    // [2, "never"],
     // eslint-plugin-react rules. These are documented at
     // <https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules>
     "react/jsx-quotes": [2, "double", "avoid-escape"],
     "react/jsx-no-undef": 2,
     // Need to fix instances where this is failing.
     "react/jsx-sort-props": 0,
+    "react/jsx-sort-prop-types": 0,
     "react/jsx-uses-vars": 2,
     // Need to fix the couple of instances which don't
     // currently pass this rule.
     "react/no-did-mount-set-state": 0,
     "react/no-did-update-set-state": 2,
     "react/no-unknown-property": 2,
     // Need to fix instances where this is currently failing
     "react/prop-types": 0,
     "react/self-closing-comp": 2,
     "react/wrap-multilines": 2,
     // Not worth it: React is defined globally
     "react/jsx-uses-react": 0,
     "react/react-in-jsx-scope": 0,
     // These ones we don't want to ever enable
     "react/display-name": 0,
+    "react/jsx-boolean-value": 0,
     "react/no-multi-comp": 0
   }
 }
new file mode 100644
--- /dev/null
+++ b/browser/components/loop/content/js/.eslintrc
@@ -0,0 +1,15 @@
+{
+  "ecmaFeatures": {
+   // These are on for this directory for .jsm and content/js files.
+    "blockBindings": true,
+    "arrowFunctions": true,
+    "destructuring": true,
+    "generators": true,
+    "spread": true,
+    "restParams": true,
+    "objectLiteralShorthandMethods": true
+  },
+  "rules": {
+    "generator-star-spacing": [2, "after"]
+  }
+}
deleted file mode 100644
--- a/browser/components/loop/content/shared/.eslintrc
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-  "ecmaFeatures": {
-    // Turn off top-level items needed for the jsm files, but not wanted
-    // for shared code as we can't support them.
-    "blockBindings": false,
-    "arrowFunctions": false,
-    "destructuring": false,
-    "forOf": true,
-    "generators": false,
-    "spread": false,
-    "restParams": false,
-    "objectLiteralShorthandMethods": false
-  }
-}
new file mode 100644
--- /dev/null
+++ b/browser/components/loop/modules/.eslintrc
@@ -0,0 +1,17 @@
+{
+  "ecmaFeatures": {
+    "arrowFunctions": true,
+    "blockBindings": true,
+    "destructuring": true,
+    "generators": true,
+    "restParams": true,
+    "spread": true,
+    "objectLiteralShorthandMethods": true,
+  },
+  "rules": {
+    "generator-star-spacing": [2, "after"],
+    // We should fix the errors and enable this (set to 2)
+    "no-var": 0,
+    "strict": [2, "global"]
+  }
+}
rename from browser/components/loop/CardDavImporter.jsm
rename to browser/components/loop/modules/CardDavImporter.jsm
rename from browser/components/loop/GoogleImporter.jsm
rename to browser/components/loop/modules/GoogleImporter.jsm
rename from browser/components/loop/LoopCalls.jsm
rename to browser/components/loop/modules/LoopCalls.jsm
rename from browser/components/loop/LoopContacts.jsm
rename to browser/components/loop/modules/LoopContacts.jsm
rename from browser/components/loop/LoopRooms.jsm
rename to browser/components/loop/modules/LoopRooms.jsm
rename from browser/components/loop/LoopStorage.jsm
rename to browser/components/loop/modules/LoopStorage.jsm
rename from browser/components/loop/MozLoopAPI.jsm
rename to browser/components/loop/modules/MozLoopAPI.jsm
rename from browser/components/loop/MozLoopPushHandler.jsm
rename to browser/components/loop/modules/MozLoopPushHandler.jsm
rename from browser/components/loop/MozLoopService.jsm
rename to browser/components/loop/modules/MozLoopService.jsm
rename from browser/components/loop/MozLoopWorker.js
rename to browser/components/loop/modules/MozLoopWorker.js
--- a/browser/components/loop/moz.build
+++ b/browser/components/loop/moz.build
@@ -8,24 +8,24 @@ JAR_MANIFESTS += ['jar.mn']
 
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
 
 BROWSER_CHROME_MANIFESTS += [
     'test/mochitest/browser.ini',
 ]
 
 EXTRA_JS_MODULES.loop += [
-    'CardDavImporter.jsm',
     'content/shared/js/crypto.js',
     'content/shared/js/utils.js',
-    'GoogleImporter.jsm',
-    'LoopCalls.jsm',
-    'LoopContacts.jsm',
-    'LoopRooms.jsm',
-    'LoopStorage.jsm',
-    'MozLoopAPI.jsm',
-    'MozLoopPushHandler.jsm',
-    'MozLoopService.jsm',
-    'MozLoopWorker.js',
+    'modules/CardDavImporter.jsm',
+    'modules/GoogleImporter.jsm',
+    'modules/LoopCalls.jsm',
+    'modules/LoopContacts.jsm',
+    'modules/LoopRooms.jsm',
+    'modules/LoopStorage.jsm',
+    'modules/MozLoopAPI.jsm',
+    'modules/MozLoopPushHandler.jsm',
+    'modules/MozLoopService.jsm',
+    'modules/MozLoopWorker.js',
 ]
 
 with Files('**'):
     BUG_COMPONENT = ('Loop', 'Client')
deleted file mode 100644
--- a/browser/components/loop/standalone/.eslintrc
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-  "ecmaFeatures": {
-    // Turn off top-level items needed for the jsm files, but not wanted
-    // for shared code as we can't support them.
-    "blockBindings": false,
-    "arrowFunctions": false,
-    "destructuring": false,
-    "forOf": true,
-    "generators": false,
-    "spread": false,
-    "restParams": false,
-    "objectLiteralShorthandMethods": false
-  }
-}
--- a/browser/components/loop/standalone/package.json
+++ b/browser/components/loop/standalone/package.json
@@ -7,18 +7,18 @@
     "url": "git@github.com:mozilla/loop-client.git"
   },
   "engines": {
     "node": "0.10.x",
     "npm": "1.3.x"
   },
   "dependencies": {},
   "devDependencies": {
-    "eslint": "0.18.x",
-    "eslint-plugin-react": "2.0.x",
+    "eslint": "0.20.x",
+    "eslint-plugin-react": "2.2.x",
     "express": "3.x"
   },
   "scripts": {
     "test": "make test",
     "start": "make runserver"
   },
   "license": "MPL-2.0"
 }
new file mode 100644
--- /dev/null
+++ b/browser/components/loop/test/.eslintrc
@@ -0,0 +1,7 @@
+{
+  "rules": {
+    // This is useful for some of the tests, e.g.
+    // expect(new Foo()).to.Throw(/error/)
+    "no-new": 0
+  }
+}