Bug 1190293 - Upgrade Loop's use of eslint to 1.0.x and the eslint-plugin-react to 3.2.x. r=andreio

This commit is contained in:
Mark Banner 2015-08-04 21:01:00 +01:00
parent 6da08df9ba
commit 484f248a2b
5 changed files with 67 additions and 14 deletions

View File

@ -12,6 +12,7 @@
"browser": true,
"mocha": true
},
"extends": "eslint:recommended",
"globals": {
"_": false,
"$": false,
@ -35,31 +36,75 @@
// 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"],
@ -67,6 +112,7 @@
"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,

View File

@ -56,9 +56,12 @@
"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"]
}
}

View File

@ -446,7 +446,11 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
// 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 */
}
/**

View File

@ -12,8 +12,8 @@
},
"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": {

View File

@ -152,7 +152,7 @@ describe("loop.store.RoomStore", function () {
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);
});
});