Bug 1230088 - Update Loop's use of eslint and eslint-plugin-react, fix warnings in latest versions and add a few more rules. r=mancus
authorMark Banner <standard8@mozilla.com>
Thu, 03 Dec 2015 12:18:53 +0000
changeset 309622 30e7a3738645f55e9f492e063370775e9115af32
parent 309621 68a90b9e9293b100b177e781fb3bf83773af9f92
child 309623 1f527cd0e45af932a8b825ee1e24e74c7c85324a
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmancus
bugs1230088
milestone45.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 1230088 - Update Loop's use of eslint and eslint-plugin-react, fix warnings in latest versions and add a few more rules. r=mancus
browser/extensions/loop/.eslintrc
browser/extensions/loop/content/panels/js/panel.js
browser/extensions/loop/content/panels/js/panel.jsx
browser/extensions/loop/content/shared/js/actions.js
browser/extensions/loop/standalone/package.json
--- a/browser/extensions/loop/.eslintrc
+++ b/browser/extensions/loop/.eslintrc
@@ -54,28 +54,31 @@
     "comma-spacing": 2,
     "comma-style": 2,
     "computed-property-spacing": [2, "never"],
     "consistent-return": 2,
     "curly": [2, "all"],
     "dot-location": [2, "property"],
     "eol-last": 2,
     "eqeqeq": [2, "smart"],
+    "generator-star-spacing": [2, {"before": false, "after": true}],
     "jsx-quotes": [2, "prefer-double"],
     "key-spacing": [2, {"beforeColon": false, "afterColon": true }],
     "linebreak-style": [2, "unix"],
     "new-cap": 0,                 // TODO: set to 2
     "new-parens": 2,
     "no-alert": 2,
     "no-array-constructor": 2,
     "no-caller": 2,
     "no-catch-shadow": 2,
     "no-class-assign": 2,
     "no-const-assign": 2,
     "no-console": 0,              // Leave as 0. We use console logging in content code.
+    "no-duplicate-case": 2,
+    "no-else-return": 2,
     "no-empty": 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-extra-semi": 2,
     "no-implied-eval": 2,
@@ -94,16 +97,17 @@
     "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-self-compare": 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,
@@ -126,28 +130,29 @@
     "space-in-parens": [2, "never"],
     "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-curly-spacing": [2, "never"],
+    "react/jsx-no-bind": 2,
+    "react/jsx-no-duplicate-props": 2,
     "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,
     "react/no-did-mount-set-state": 2,
     "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,
-    "react/jsx-curly-spacing": [2, "never"],
     // 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-danger": 0,
     "react/no-multi-comp": 0
--- a/browser/extensions/loop/content/panels/js/panel.js
+++ b/browser/extensions/loop/content/panels/js/panel.js
@@ -375,19 +375,19 @@ loop.panel = (function(_, mozL10n) {
         )
       );
     },
 
     render: function() {
       var roomUrl = this.props.roomUrls && this.props.roomUrls[0];
       if (roomUrl && roomUrl.location) {
         return this._renderIcon(roomUrl);
-      } else {
-        return this._renderDefaultIcon();
       }
+
+      return this._renderDefaultIcon();
     }
   });
 
   /**
    * Room list entry.
    *
    * Active Room means there are participants in the room.
    * Opened Room means the user is in the room.
--- a/browser/extensions/loop/content/panels/js/panel.jsx
+++ b/browser/extensions/loop/content/panels/js/panel.jsx
@@ -375,19 +375,19 @@ loop.panel = (function(_, mozL10n) {
         </div>
       );
     },
 
     render: function() {
       var roomUrl = this.props.roomUrls && this.props.roomUrls[0];
       if (roomUrl && roomUrl.location) {
         return this._renderIcon(roomUrl);
-      } else {
-        return this._renderDefaultIcon();
       }
+
+      return this._renderDefaultIcon();
     }
   });
 
   /**
    * Room list entry.
    *
    * Active Room means there are participants in the room.
    * Opened Room means the user is in the room.
--- a/browser/extensions/loop/content/shared/js/actions.js
+++ b/browser/extensions/loop/content/shared/js/actions.js
@@ -12,18 +12,19 @@ loop.shared.actions = (function() {
    * or by an async event, e.g. status received.
    *
    * They should be dispatched to stores via the dispatcher.
    */
 
   function Action(name, schema, values) {
     var validatedData = new loop.validate.Validator(schema || {})
                                          .validate(values || {});
-    for (var prop in validatedData)
+    for (var prop in validatedData) {
       this[prop] = validatedData[prop];
+    }
 
     this.name = name;
   }
 
   Action.define = function(name, schema) {
     return Action.bind(null, name, schema);
   };
 
--- a/browser/extensions/loop/standalone/package.json
+++ b/browser/extensions/loop/standalone/package.json
@@ -9,19 +9,19 @@
   "engines": {
     "node": "0.10.x",
     "npm": "2.14.x"
   },
   "dependencies": {},
   "devDependencies": {
     "classnames": "2.2.x",
     "compression": "1.5.x",
-    "eslint": "1.6.x",
+    "eslint": "1.10.x",
     "eslint-plugin-mozilla": "../../../../testing/eslint-plugin-mozilla",
-    "eslint-plugin-react": "3.5.x",
+    "eslint-plugin-react": "3.10.x",
     "exports-loader": "0.6.x",
     "expose-loader": "0.7.x",
     "express": "4.x",
     "imports-loader": "0.6.x",
     "react": "0.13.3",
     "script-loader": "0.6.x",
     "webpack": "1.12.x"
   },