mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 12:20:38 +01:00
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 :(
This commit is contained in:
parent
1df466b23a
commit
58fb322e21
17
.eslintrc
17
.eslintrc
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
parser: esprima-fb
|
||||
parser: babel-eslint
|
||||
|
||||
env:
|
||||
browser: true
|
||||
|
|
@ -17,16 +17,18 @@ rules:
|
|||
strict: 2
|
||||
# We actually have a transform to support this and we fix this for bundled
|
||||
# releases but not for the npm package, so enforce it strictly
|
||||
no-comma-dangle: 2
|
||||
comma-dangle: [2, never]
|
||||
# Make this a warning for now. We do this in a few places so we might need to
|
||||
# disable
|
||||
no-unused-expressions: 2
|
||||
block-scoped-var: 2
|
||||
eol-last: 2
|
||||
dot-notation: 2
|
||||
dot-location: [2, property]
|
||||
consistent-return: 2
|
||||
no-unused-vars: [2, args: none]
|
||||
quotes: [2, 'single']
|
||||
quotes: [2, single]
|
||||
no-shadow: 2
|
||||
no-multi-spaces: 2
|
||||
|
||||
# WARNINGS
|
||||
# This is the only one that's hard to track since we don't lint just changes.
|
||||
|
|
@ -46,6 +48,9 @@ rules:
|
|||
no-use-before-define: 0
|
||||
# We do this in a few places to align values
|
||||
key-spacing: 0
|
||||
# It's nice to be able to leave catch blocks empty
|
||||
no-empty: 0
|
||||
|
||||
# DISABLED. These currently cause errors when running.
|
||||
no-multi-spaces: 0
|
||||
# BROKEN. We'd like to turn these back on.
|
||||
# causes a ton of noise, eslint is too picky?
|
||||
block-scoped-var: 0
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ module.exports = function() {
|
|||
var done = this.async();
|
||||
grunt.util.spawn({
|
||||
cmd: 'node_modules/.bin/eslint',
|
||||
args: ['.']
|
||||
args: ['.'],
|
||||
opts: {stdio: 'inherit'} // allows colors to passthrough
|
||||
}, function(err, result, code) {
|
||||
if (err) {
|
||||
grunt.log.error('Lint failed');
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ var EXAMPLES_PATH = 'examples/';
|
|||
var EXAMPLES_GLOB = [EXAMPLES_PATH + '**/*.*'];
|
||||
|
||||
var STARTER_PATH = 'starter/';
|
||||
var STARTER_GLOB = [STARTER_PATH + '/**/*.*'];
|
||||
var STARTER_GLOB = [STARTER_PATH + '/**/*.*'];
|
||||
|
||||
var STARTER_BUILD_PATH = 'build/starter/';
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*eslint-disable no-comma-dangle*/
|
||||
/*eslint-disable comma-dangle*/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
|
@ -157,11 +157,11 @@ function updateReactCreateClassToES6(file, api, options) {
|
|||
)
|
||||
.filter(isFunctionExpression);
|
||||
|
||||
const findAutobindNamesFor = (root, fnNames, literalOrIdentifier) => {
|
||||
const findAutobindNamesFor = (subtree, fnNames, literalOrIdentifier) => {
|
||||
const node = literalOrIdentifier;
|
||||
const autobindNames = {};
|
||||
|
||||
j(root)
|
||||
j(subtree)
|
||||
.find(j.MemberExpression, {
|
||||
object: node.name ? {
|
||||
type: node.type,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*eslint-disable no-comma-dangle*/
|
||||
/*eslint-disable comma-dangle*/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*eslint-disable no-comma-dangle*/
|
||||
/*eslint-disable comma-dangle*/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*eslint-disable no-comma-dangle*/
|
||||
/*eslint-disable comma-dangle*/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ module.exports = function(j) {
|
|||
const findReactCreateClass = path =>
|
||||
path
|
||||
.findVariableDeclarators()
|
||||
.filter(path => findReactCreateClassCallExpression(path).size() > 0);
|
||||
.filter(decl => findReactCreateClassCallExpression(decl).size() > 0);
|
||||
|
||||
const findReactCreateClassModuleExports = path =>
|
||||
path
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"babel": "^5.3.3",
|
||||
"babel-eslint": "^3.1.9",
|
||||
"benchmark": "~1.0.0",
|
||||
"browserify": "^9.0.3",
|
||||
"bundle-collapser": "^1.1.1",
|
||||
|
|
@ -38,8 +39,7 @@
|
|||
"derequire": "^2.0.0",
|
||||
"envify": "^3.0.0",
|
||||
"es5-shim": "^4.0.0",
|
||||
"eslint": "^0.14.1",
|
||||
"esprima-fb": "^15001.1.0-dev-harmony-fb",
|
||||
"eslint": "^0.21.2",
|
||||
"grunt": "~0.4.2",
|
||||
"grunt-cli": "^0.1.13",
|
||||
"grunt-compare-size": "~0.4.0",
|
||||
|
|
|
|||
|
|
@ -23,10 +23,13 @@ var warning = require('warning');
|
|||
* create a keyed fragment. The resulting data structure is opaque, for now.
|
||||
*/
|
||||
|
||||
var fragmentKey;
|
||||
var didWarnKey;
|
||||
var canWarnForReactFragment;
|
||||
|
||||
if (__DEV__) {
|
||||
var fragmentKey = '_reactFragment';
|
||||
var didWarnKey = '_reactDidWarn';
|
||||
var canWarnForReactFragment = false;
|
||||
fragmentKey = '_reactFragment';
|
||||
didWarnKey = '_reactDidWarn';
|
||||
|
||||
try {
|
||||
// Feature test. Don't even try to issue this warning if we can't use
|
||||
|
|
@ -49,7 +52,9 @@ if (__DEV__) {
|
|||
);
|
||||
|
||||
canWarnForReactFragment = true;
|
||||
} catch (x) { }
|
||||
} catch (x) {
|
||||
canWarnForReactFragment = false;
|
||||
}
|
||||
|
||||
var proxyPropertyAccessWithWarning = function(obj, key) {
|
||||
Object.defineProperty(obj, key, {
|
||||
|
|
|
|||
|
|
@ -212,8 +212,8 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|||
listenTo: function(registrationName, contentDocumentHandle) {
|
||||
var mountAt = contentDocumentHandle;
|
||||
var isListening = getListeningForDocument(mountAt);
|
||||
var dependencies = EventPluginRegistry.
|
||||
registrationNameDependencies[registrationName];
|
||||
var dependencies =
|
||||
EventPluginRegistry.registrationNameDependencies[registrationName];
|
||||
|
||||
var topLevelTypes = EventConstants.topLevelTypes;
|
||||
for (var i = 0; i < dependencies.length; i++) {
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ if (ExecutionEnvironment.canUseDOM) {
|
|||
* (For old IE.) Replacement getter/setter for the `value` property that gets
|
||||
* set on the active element.
|
||||
*/
|
||||
var newValueProp = {
|
||||
var newValueProp = {
|
||||
get: function() {
|
||||
return activeElementValueProp.get.call(this);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user