mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 00:20:04 +01:00
Upgrade to newer eslint, use esprima-fb
Eslint now allows us to use a different parser, which allows us to use esprima-fb explicitly. This means we don't have to wait for espree to add things like rest-param parsing. Though we do need eslint to upgrade its rules to handle that AST. I had hoped to enable parsing of our tests but we can't do that until we change esprima-fb's XJS nodes to JSX. While I was here, I also enabled the no-unused-vars rule since eslint understands template strings. I also made the single quote enforcement actually fail instead of just warn.
This commit is contained in:
parent
44634c062a
commit
dae1dc6292
|
|
@ -1,7 +1,9 @@
|
|||
# We can probably lint these later but not important at this point
|
||||
src/vendor
|
||||
src/vendor_deprecated
|
||||
# estraverse stumbles on XJSSpreadAttribute so just ignore tests for now
|
||||
# eslint uses JSX* node types to determine if using JSX. esprima-fb still uses
|
||||
# XJS* nodes. When we fix that (https://github.com/facebook/esprima/pull/85) we
|
||||
# can enable linting the tests and fix those errors.
|
||||
src/**/__tests__/**
|
||||
# This should be enabled but that folder has too much in it that doesn't belong
|
||||
src/test
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@
|
|||
"envify": "^3.0.0",
|
||||
"es3ify": "~0.1.2",
|
||||
"es5-shim": "^4.0.0",
|
||||
"eslint": "0.11.0-alpha.0",
|
||||
"eslint": "^0.14.1",
|
||||
"esprima-fb": "^10001.1.0-dev-harmony-fb",
|
||||
"grunt": "~0.4.2",
|
||||
"grunt-cli": "~0.1.9",
|
||||
"grunt-compare-size": "~0.4.0",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
---
|
||||
settings:
|
||||
jsx: true
|
||||
ecmascript: 6
|
||||
parser: esprima-fb
|
||||
|
||||
env:
|
||||
browser: true
|
||||
|
|
@ -25,9 +23,10 @@ rules:
|
|||
eol-last: 2
|
||||
dot-notation: 2
|
||||
consistent-return: 2
|
||||
no-unused-vars: [2, args: none]
|
||||
quotes: [2, 'single']
|
||||
|
||||
# WARNINGS
|
||||
quotes: [1, 'single']
|
||||
# This is the only one that's hard to track since we don't lint just changes.
|
||||
max-len: [1, 80]
|
||||
|
||||
|
|
@ -43,8 +42,6 @@ rules:
|
|||
new-cap: 0
|
||||
# We do this a lot.
|
||||
no-use-before-define: 0
|
||||
# We should have this enabled but https://github.com/eslint/eslint/issues/1542
|
||||
no-unused-vars: 0
|
||||
# We do this in a few places to align values
|
||||
key-spacing: 0
|
||||
|
||||
|
|
|
|||
|
|
@ -131,9 +131,6 @@ var eventTypes = {
|
|||
}
|
||||
};
|
||||
|
||||
// Track characters inserted via keypress and composition events.
|
||||
var fallbackBeforeInputChars = null;
|
||||
|
||||
// Track whether we've ever handled a keypress on the space key.
|
||||
var hasSpaceKeypress = false;
|
||||
|
||||
|
|
@ -437,7 +434,6 @@ function extractBeforeInputEvent(
|
|||
);
|
||||
|
||||
event.data = chars;
|
||||
fallbackBeforeInputChars = null;
|
||||
EventPropagators.accumulateTwoPhaseDispatches(event);
|
||||
return event;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -285,8 +285,8 @@ var topLevelEventsToDispatchConfig = {
|
|||
topWheel: eventTypes.wheel
|
||||
};
|
||||
|
||||
for (var topLevelType in topLevelEventsToDispatchConfig) {
|
||||
topLevelEventsToDispatchConfig[topLevelType].dependencies = [topLevelType];
|
||||
for (var type in topLevelEventsToDispatchConfig) {
|
||||
topLevelEventsToDispatchConfig[type].dependencies = [type];
|
||||
}
|
||||
|
||||
var SimpleEventPlugin = {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ function assertValidProps(props) {
|
|||
invariant(
|
||||
props.dangerouslySetInnerHTML.__html != null,
|
||||
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
|
||||
'Please visit http://fb.me/react-invariant-dangerously-set-inner-html for more information.'
|
||||
'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' +
|
||||
'for more information.'
|
||||
);
|
||||
}
|
||||
if (__DEV__) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ var ReactDOMComponent = require('ReactDOMComponent');
|
|||
|
||||
var assign = require('Object.assign');
|
||||
var escapeTextContentForBrowser = require('escapeTextContentForBrowser');
|
||||
var invariant = require('invariant');
|
||||
|
||||
/**
|
||||
* Text nodes violate a couple assumptions that React makes about components:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
var DOMProperty = require('DOMProperty');
|
||||
|
||||
var escapeTextContentForBrowser = require('escapeTextContentForBrowser');
|
||||
var quoteAttributeValueForBrowser = require('quoteAttributeValueForBrowser');
|
||||
var warning = require('warning');
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
* @emails react-core
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
describe('ReactDOMIframe', function() {
|
||||
var React;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* @providesModule setTextContent
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ExecutionEnvironment = require('ExecutionEnvironment');
|
||||
var escapeTextContentForBrowser = require('escapeTextContentForBrowser');
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ function createChainableTypeChecker(validate) {
|
|||
var locationName = ReactPropTypeLocationNames[location];
|
||||
if (isRequired) {
|
||||
return new Error(
|
||||
`Required ${locationName} \`${propName}\` was not specified in `+
|
||||
`Required ${locationName} \`${propName}\` was not specified in ` +
|
||||
`\`${componentName}\`.`
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -564,7 +564,10 @@ var ReactCompositeComponentMixin = {
|
|||
|
||||
if (__DEV__) {
|
||||
if (nextUnmaskedContext != null) {
|
||||
this._warnIfContextsDiffer(nextParentElement._context, nextUnmaskedContext);
|
||||
this._warnIfContextsDiffer(
|
||||
nextParentElement._context,
|
||||
nextUnmaskedContext
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -663,7 +666,6 @@ var ReactCompositeComponentMixin = {
|
|||
) {
|
||||
var inst = this._instance;
|
||||
|
||||
var prevElement = this._currentElement;
|
||||
var prevProps = inst.props;
|
||||
var prevState = inst.state;
|
||||
var prevContext = inst.context;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* @providesModule ReactLifeCycle
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* This module manages the bookkeeping when a component is in the process
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* @providesModule ReactUpdateQueue
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ReactLifeCycle = require('ReactLifeCycle');
|
||||
var ReactCurrentOwner = require('ReactCurrentOwner');
|
||||
|
|
@ -101,7 +101,7 @@ var ReactUpdateQueue = {
|
|||
|
||||
enqueueCallbackInternal: function(internalInstance, callback) {
|
||||
invariant(
|
||||
typeof callback === "function",
|
||||
typeof callback === 'function',
|
||||
'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
|
||||
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
|
||||
'isn\'t callable.'
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ function executeDispatch(event, listener, domID) {
|
|||
/**
|
||||
* Standard/simple iteration through an event's collected dispatches.
|
||||
*/
|
||||
function executeDispatchesInOrder(event, executeDispatch) {
|
||||
forEachEventDispatch(event, executeDispatch);
|
||||
function executeDispatchesInOrder(event, cb) {
|
||||
forEachEventDispatch(event, cb);
|
||||
event._dispatchListeners = null;
|
||||
event._dispatchIDs = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,9 +119,9 @@ if (__DEV__) {
|
|||
// IE will fail on defineProperty (es5-shim/sham too)
|
||||
}
|
||||
};
|
||||
for (var methodName in deprecatedAPIs) {
|
||||
if (deprecatedAPIs.hasOwnProperty(methodName)) {
|
||||
defineDeprecationWarning(methodName, deprecatedAPIs[methodName]);
|
||||
for (var fnName in deprecatedAPIs) {
|
||||
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
||||
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* @emails react-core
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
describe('quoteAttributeValueForBrowser', function() {
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* @providesModule quoteAttributeValueForBrowser
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var escapeTextContentForBrowser = require('escapeTextContentForBrowser');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user