Bug 1190293 - Upgrade Loop's use of eslint to 1.0.x and the eslint-plugin-react to 3.2.x. r=andreio
authorMark Banner <standard8@mozilla.com>
Tue, 04 Aug 2015 21:01:00 +0100
changeset 287790 fc1efb158f9b67c9ceee30787e3a8f7763cea297
parent 287789 6a6088330911606c797adf308b4ff12819c261fb
child 287791 1aac59a31bc3824c6b3efb66a675972c835b5fa7
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersandreio
bugs1190293
milestone42.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 1190293 - Upgrade Loop's use of eslint to 1.0.x and the eslint-plugin-react to 3.2.x. r=andreio
browser/components/loop/.eslintrc
browser/components/loop/.eslintrc-gecko
browser/components/loop/content/shared/js/utils.js
browser/components/loop/standalone/package.json
browser/components/loop/test/desktop-local/roomStore_test.js
--- a/browser/components/loop/.eslintrc
+++ b/browser/components/loop/.eslintrc
@@ -7,16 +7,17 @@
   "ecmaFeatures": {
     "forOf": true,
     "jsx": true,
   },
   "env": {
     "browser": true,
     "mocha": true
   },
+  "extends": "eslint:recommended",
   "globals": {
     "_": false,
     "$": false,
     "Backbone": false,
     "chai": false,
     "console": false,
     "jQuery": false,
     "loop": true,
@@ -30,48 +31,93 @@
   },
   "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)
+    "callback-return": 0,         // TBD
+    "camelcase": 0,               // TODO: set to 2
+    "comma-spacing": 2,
     "computed-property-spacing": [2, "never"],
-    "consistent-return": 0,       // TODO: Remove (use default)
+    "consistent-return": 0,       // TODO: set to 2
+    "curly": [2, "all"],
     dot-location: 0,              // [2, property],
+    "eol-last": 2,
     "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": [2, {"beforeColon": false, "afterColon": true }],
     "linebreak-style": [2, "unix"],
-    "new-cap": 0,                 // TODO: Remove (use default)
-    "no-catch-shadow": 0,         // TODO: Remove (use default)
+    "new-cap": 0,                 // TODO: set to 2
+    "new-parens": 2,
+    "no-alert": 2,
+    "no-array-constructor": 2,
+    "no-caller": 2,
+    "no-catch-shadow": 0,         // TODO: set to 2
+    "no-class-assign": 2,
+    "no-const-assign": 2,
     "no-console": 0,              // Leave as 0. We use console logging in content code.
-    "no-empty": 0,                // TODO: Remove (use default)
+    "no-empty": 0,                // TODO: set to 2
+    "no-empty-label": 2,
+    "no-eval": 2,
+    "no-extend-native": 2, // XXX
     "no-extra-bind": 0,           // Leave as 0
+    "no-extra-parens": 0,         // TODO: (bug?) [2, "functions"],
+    "no-implied-eval": 2,
+    "no-invalid-this": 0,         // TBD
+    "no-iterator": 2,
+    "no-label-var": 2,
+    "no-labels": 2,
+    "no-lone-blocks": 2,
+    "no-loop-func": 2,
     "no-multi-spaces": 0,         // TBD.
-    "no-new": 0,                  // TODO: Remove (use default)
-    "no-return-assign": 0,        // TODO: Remove (use default)
+    "no-multi-str": 2,
+    "no-native-reassign": 2,
+    "no-new": 2,
+    "no-new-func": 2,
+    "no-new-object": 2,
+    "no-new-wrappers": 2,
+    "no-octal-escape": 2,
+    "no-process-exit": 2,
+    "no-proto": 2,
+    "no-return-assign": 2,
+    "no-script-url": 2,
+    "no-sequences": 2,
+    "no-shadow": 2,
+    "no-shadow-restricted-names": 2,
+    "no-spaced-func": 2,
+    "no-trailing-spaces": 2,
+    "no-undef-init": 2,
     "no-underscore-dangle": 0,    // Leave as 0. Commonly used for private variables.
     "no-unexpected-multiline": 2,
     "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)
+    "no-unused-expressions": 0,   // TODO: Set to 2
+    "no-unused-vars": 0,          // TODO: Set to 2
+    "no-use-before-define": 0,    // TODO: Set to 2
+    "no-useless-call": 2,
+    "no-with": 2,
     "object-curly-spacing": 0,    // [2, "always"],
     "quotes": [2, "double", "avoid-escape"],
+    "semi": 2,
+    "semi-spacing": [2, {"before": false, "after": true}],
+    "space-infix-ops": 2,
+    "space-return-throw-case": 2,
+    "space-unary-ops": [2, {"words": true, "nonwords": false}],
     "spaced-comment": [2, "always"],
     "strict": [2, "function"],
+    "yoda": [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,
     "react/jsx-sort-props": 2,
     "react/jsx-sort-prop-types": 2,
     "react/jsx-uses-vars": 2,
+    "react/jsx-no-duplicate-props": 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,
     "react/prop-types": 2,
     "react/self-closing-comp": 2,
     "react/wrap-multilines": 2,
--- a/browser/components/loop/.eslintrc-gecko
+++ b/browser/components/loop/.eslintrc-gecko
@@ -51,14 +51,17 @@
     "Task": false,
     "UITour": false,
     "XPCOMUtils": false,
     "uuidgen": true,
     // Test Related
     "Assert": false,
   },
   "rules": {
+    "arrow-parens": 0, // TBD
+    "arrow-spacing": 2,
     "generator-star-spacing": [2, "after"],
     // We should fix the errors and enable this (set to 2)
     "no-var": 0,
+    "require-yield": 0,        // TODO: Set to 2.
     "strict": [2, "global"]
   }
 }
--- a/browser/components/loop/content/shared/js/utils.js
+++ b/browser/components/loop/content/shared/js/utils.js
@@ -441,17 +441,21 @@ var inChrome = typeof Components != "und
       return;
     }
     mozLoop.telemetryAddValue("LOOP_SHARING_ROOM_URL", bucket);
   }
 
   // We can alias `subarray` to `slice` when the latter is not available, because
   // they're semantically identical.
   if (!Uint8Array.prototype.slice) {
+    /* eslint-disable */
+    // Eslint disabled for no-extend-native; Specific override needed for Firefox 37
+    // and earlier, also for other browsers.
     Uint8Array.prototype.slice = Uint8Array.prototype.subarray;
+    /* eslint-enable */
   }
 
   /**
    * Binary-compatible Base64 decoding.
    *
    * Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Base64_encoding_and_decoding
    *
    * @param {String} base64str The string to decode.
--- 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.24.x",
-    "eslint-plugin-react": "2.7.x",
+    "eslint": "1.0.x",
+    "eslint-plugin-react": "3.2.x",
     "express": "4.x"
   },
   "scripts": {
     "test": "make test",
     "start": "make runserver"
   },
   "license": "MPL-2.0"
 }
--- a/browser/components/loop/test/desktop-local/roomStore_test.js
+++ b/browser/components/loop/test/desktop-local/roomStore_test.js
@@ -147,17 +147,17 @@ describe("loop.store.RoomStore", functio
 
         it("should avoid adding a duplicate room", function() {
           var sampleRoom = fakeRoomList[0];
 
           fakeMozLoop.rooms.trigger("add", "add", sampleRoom);
 
           expect(store.getStoreState().rooms).to.have.length.of(3);
           expect(store.getStoreState().rooms.reduce(function(count, room) {
-            return count += room.roomToken === sampleRoom.roomToken ? 1 : 0;
+            return count + (room.roomToken === sampleRoom.roomToken ? 1 : 0);
           }, 0)).eql(1);
         });
       });
 
       describe("update", function() {
         it("should update a room entry", function() {
           fakeMozLoop.rooms.trigger("update", "update", {
             roomToken: "_nxD4V4FflQ",