Use babel-eslint and update eslint
- Removes esprima-fb dependency - Tightens up eslintrc with some minor rules we were pretty-much following anyways. - Adds pretty colors to the `grunt lint` output - Breaks block-scoped-var :(
Benjamin Woodruff committed
May 27, 2015 at 14:45 UTC
58fb322e211614ffb4fc6a8228e96e93c5ea65dc
11 files changed
+35
-24
.eslintrc
+11
-6
@@ -1,5 +1,5 @@
1
---
2
-parser: esprima-fb
2
+parser: babel-eslint
3
4
env:
5
browser: true
@@ -17,16 +17,18 @@ rules:
17
strict: 2
18
# We actually have a transform to support this and we fix this for bundled
19
# releases but not for the npm package, so enforce it strictly
20
- no-comma-dangle: 2
20
+ comma-dangle: [2, never]
21
# Make this a warning for now. We do this in a few places so we might need to
22
# disable
23
no-unused-expressions: 2
24
- block-scoped-var: 2
24
eol-last: 2
25
dot-notation: 2
26
+ dot-location: [2, property]
27
consistent-return: 2
28
no-unused-vars: [2, args: none]
29
- quotes: [2, 'single']
29
+ quotes: [2, single]
30
+ no-shadow: 2
31
+ no-multi-spaces: 2
32
33
# WARNINGS
34
# This is the only one that's hard to track since we don't lint just changes.
@@ -46,6 +48,9 @@ rules:
48
no-use-before-define: 0
49
# We do this in a few places to align values
50
key-spacing: 0
51
+ # It's nice to be able to leave catch blocks empty
52
+ no-empty: 0
53
50
- # DISABLED. These currently cause errors when running.
51
- no-multi-spaces: 0
54
+ # BROKEN. We'd like to turn these back on.
55
+ # causes a ton of noise, eslint is too picky?
56
+ block-scoped-var: 0
grunt/tasks/eslint.js
+2
-1
@@ -6,7 +6,8 @@ module.exports = function() {
6
var done = this.async();
7
grunt.util.spawn({
8
cmd: 'node_modules/.bin/eslint',
9
- args: ['.']
9
+ args: ['.'],
10
+ opts: {stdio: 'inherit'} // allows colors to passthrough
11
}, function(err, result, code) {
12
if (err) {
13
grunt.log.error('Lint failed');
grunt/tasks/release.js
+1
-1
@@ -15,7 +15,7 @@ var EXAMPLES_PATH = 'examples/';
15
var EXAMPLES_GLOB = [EXAMPLES_PATH + '**/*.*'];
16
17
var STARTER_PATH = 'starter/';
18
-var STARTER_GLOB = [STARTER_PATH + '/**/*.*'];
18
+var STARTER_GLOB = [STARTER_PATH + '/**/*.*'];
19
20
var STARTER_BUILD_PATH = 'build/starter/';
21
npm-react-codemod/transforms/class.js
+3
-3
@@ -8,7 +8,7 @@
8
*
9
*/
10
11
-/*eslint-disable no-comma-dangle*/
11
+/*eslint-disable comma-dangle*/
12
13
'use strict';
14
@@ -157,11 +157,11 @@ function updateReactCreateClassToES6(file, api, options) {
157
)
158
.filter(isFunctionExpression);
159
160
- const findAutobindNamesFor = (root, fnNames, literalOrIdentifier) => {
160
+ const findAutobindNamesFor = (subtree, fnNames, literalOrIdentifier) => {
161
const node = literalOrIdentifier;
162
const autobindNames = {};
163
164
- j(root)
164
+ j(subtree)
165
.find(j.MemberExpression, {
166
object: node.name ? {
167
type: node.type,
npm-react-codemod/transforms/findDOMNode.js
+1
-1
@@ -8,7 +8,7 @@
8
*
9
*/
10
11
-/*eslint-disable no-comma-dangle*/
11
+/*eslint-disable comma-dangle*/
12
13
'use strict';
14
npm-react-codemod/transforms/pure-render-mixin.js
+1
-1
@@ -8,7 +8,7 @@
8
*
9
*/
10
11
-/*eslint-disable no-comma-dangle*/
11
+/*eslint-disable comma-dangle*/
12
13
'use strict';
14
npm-react-codemod/transforms/utils/ReactUtils.js
+2
-2
@@ -8,7 +8,7 @@
8
*
9
*/
10
11
- /*eslint-disable no-comma-dangle*/
11
+/*eslint-disable comma-dangle*/
12
13
'use strict';
14
@@ -47,7 +47,7 @@ module.exports = function(j) {
47
const findReactCreateClass = path =>
48
path
49
.findVariableDeclarators()
50
- .filter(path => findReactCreateClassCallExpression(path).size() > 0);
50
+ .filter(decl => findReactCreateClassCallExpression(decl).size() > 0);
51
52
const findReactCreateClassModuleExports = path =>
53
path
package.json
+2
-2
@@ -30,6 +30,7 @@
30
},
31
"devDependencies": {
32
"babel": "^5.3.3",
33
+ "babel-eslint": "^3.1.9",
34
"benchmark": "~1.0.0",
35
"browserify": "^9.0.3",
36
"bundle-collapser": "^1.1.1",
@@ -38,8 +39,7 @@
39
"derequire": "^2.0.0",
40
"envify": "^3.0.0",
41
"es5-shim": "^4.0.0",
41
- "eslint": "^0.14.1",
42
- "esprima-fb": "^15001.1.0-dev-harmony-fb",
42
+ "eslint": "^0.21.2",
43
"grunt": "~0.4.2",
44
"grunt-cli": "^0.1.13",
45
"grunt-compare-size": "~0.4.0",
src/addons/ReactFragment.js
+9
-4
@@ -23,10 +23,13 @@ var warning = require('warning');
23
* create a keyed fragment. The resulting data structure is opaque, for now.
24
*/
25
26
+var fragmentKey;
27
+var didWarnKey;
28
+var canWarnForReactFragment;
29
+
30
if (__DEV__) {
27
- var fragmentKey = '_reactFragment';
28
- var didWarnKey = '_reactDidWarn';
29
- var canWarnForReactFragment = false;
31
+ fragmentKey = '_reactFragment';
32
+ didWarnKey = '_reactDidWarn';
33
34
try {
35
// Feature test. Don't even try to issue this warning if we can't use
@@ -49,7 +52,9 @@ if (__DEV__) {
52
);
53
54
canWarnForReactFragment = true;
52
- } catch (x) { }
55
+ } catch (x) {
56
+ canWarnForReactFragment = false;
57
+ }
58
59
var proxyPropertyAccessWithWarning = function(obj, key) {
60
Object.defineProperty(obj, key, {
src/renderers/dom/client/ReactBrowserEventEmitter.js
+2
-2
@@ -212,8 +212,8 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
212
listenTo: function(registrationName, contentDocumentHandle) {
213
var mountAt = contentDocumentHandle;
214
var isListening = getListeningForDocument(mountAt);
215
- var dependencies = EventPluginRegistry.
216
- registrationNameDependencies[registrationName];
215
+ var dependencies =
216
+ EventPluginRegistry.registrationNameDependencies[registrationName];
217
218
var topLevelTypes = EventConstants.topLevelTypes;
219
for (var i = 0; i < dependencies.length; i++) {
src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js
+1
-1
@@ -150,7 +150,7 @@ if (ExecutionEnvironment.canUseDOM) {
150
* (For old IE.) Replacement getter/setter for the `value` property that gets
151
* set on the active element.
152
*/
153
-var newValueProp = {
153
+var newValueProp = {
154
get: function() {
155
return activeElementValueProp.get.call(this);
156
},