Upgrade ESLint, fix code
This commit is contained in:
parent
2f079359e8
commit
ecb34de574
|
@ -27,10 +27,10 @@ globals:
|
|||
rules:
|
||||
# ERRORS
|
||||
space-before-blocks: 2
|
||||
indent: [2, 2, indentSwitchCase: true]
|
||||
indent: [2, 2, {SwitchCase: 1}]
|
||||
brace-style: 2
|
||||
space-after-keywords: 2
|
||||
strict: 2
|
||||
strict: [2, global]
|
||||
comma-dangle: [2, always-multiline]
|
||||
# Make this a warning for now. We do this in a few places so we might need to
|
||||
# disable
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
rules:
|
||||
block-scoped-var: 0
|
||||
no-undef: 0
|
||||
strict: 0
|
||||
react/react-in-jsx-scope: 0
|
||||
react/jsx-no-undef: 0
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var eslint = require('eslint');
|
||||
var ESLintTester = require('eslint-tester');
|
||||
var eslintTester = new ESLintTester(eslint.linter);
|
||||
var rule = require('../warning-and-invariant-args');
|
||||
var RuleTester = require('eslint').RuleTester;
|
||||
var ruleTester = new RuleTester();
|
||||
|
||||
eslintTester.addRuleTest('eslint-rules/warning-and-invariant-args', {
|
||||
ruleTester.run('eslint-rules/warning-and-invariant-args', rule, {
|
||||
valid: [
|
||||
"warning(true, 'hello, world');",
|
||||
"warning(true, 'expected %s, got %s', 42, 24);",
|
||||
|
@ -100,4 +100,3 @@ eslintTester.addRuleTest('eslint-rules/warning-and-invariant-args', {
|
|||
},
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
exports.pack = {};
|
||||
|
|
|
@ -127,13 +127,14 @@ function docs() {
|
|||
function msg() {
|
||||
// Just output a friendly reminder message for the rest of the process
|
||||
grunt.log.subhead('Release *almost* complete...');
|
||||
[
|
||||
var steps = [
|
||||
'Still todo:',
|
||||
'* put files on CDN',
|
||||
'* push changes to git repositories',
|
||||
'* publish npm module (`npm publish .`)',
|
||||
'* announce it on FB/Twitter/mailing list',
|
||||
].forEach(function(ln) {
|
||||
];
|
||||
steps.forEach(function(ln) {
|
||||
grunt.log.writeln(ln);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"version": "0.14.0-beta3",
|
||||
"devDependencies": {
|
||||
"babel": "^5.8.3",
|
||||
"babel-eslint": "^3.1.25",
|
||||
"babel-eslint": "^4.0.5",
|
||||
"benchmark": "^1.0.0",
|
||||
"browserify": "^9.0.3",
|
||||
"bundle-collapser": "^1.1.1",
|
||||
|
@ -12,10 +12,9 @@
|
|||
"del": "^1.2.0",
|
||||
"derequire": "^2.0.0",
|
||||
"envify": "^3.0.0",
|
||||
"eslint": "^0.24.1",
|
||||
"eslint-plugin-react": "^2.5.0",
|
||||
"eslint": "^1.1.0",
|
||||
"eslint-plugin-react": "^3.2.1",
|
||||
"eslint-plugin-react-internal": "file:eslint-rules",
|
||||
"eslint-tester": "^0.7.0",
|
||||
"fbjs": "0.1.0-alpha.4",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-cli": "^0.1.13",
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = require('react/lib/ReactDOM');
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = require('react/lib/ReactDOMServer');
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
var warning = require('fbjs/lib/warning');
|
||||
warning(
|
||||
false,
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
/* eslint-disable */
|
||||
__DEV__ = true;
|
||||
|
|
|
@ -257,12 +257,13 @@ function findDeepestCachedAncestor(targetID) {
|
|||
* @param {boolean} shouldReuseMarkup If true, do not insert markup
|
||||
*/
|
||||
function mountComponentIntoNode(
|
||||
componentInstance,
|
||||
rootID,
|
||||
container,
|
||||
transaction,
|
||||
shouldReuseMarkup,
|
||||
context) {
|
||||
componentInstance,
|
||||
rootID,
|
||||
container,
|
||||
transaction,
|
||||
shouldReuseMarkup,
|
||||
context
|
||||
) {
|
||||
if (__DEV__) {
|
||||
if (context === emptyObject) {
|
||||
context = {};
|
||||
|
@ -287,11 +288,12 @@ function mountComponentIntoNode(
|
|||
* @param {boolean} shouldReuseMarkup If true, do not insert markup
|
||||
*/
|
||||
function batchedMountComponentIntoNode(
|
||||
componentInstance,
|
||||
rootID,
|
||||
container,
|
||||
shouldReuseMarkup,
|
||||
context) {
|
||||
componentInstance,
|
||||
rootID,
|
||||
container,
|
||||
shouldReuseMarkup,
|
||||
context
|
||||
) {
|
||||
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
|
||||
transaction.perform(
|
||||
mountComponentIntoNode,
|
||||
|
|
|
@ -115,17 +115,19 @@ function stopWatchingForChangeEventIE8() {
|
|||
}
|
||||
|
||||
function getTargetIDForChangeEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID
|
||||
) {
|
||||
if (topLevelType === topLevelTypes.topChange) {
|
||||
return topLevelTargetID;
|
||||
}
|
||||
}
|
||||
function handleEventsForChangeEventIE8(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID
|
||||
) {
|
||||
if (topLevelType === topLevelTypes.topFocus) {
|
||||
// stopWatching() should be a noop here but we call it just in case we
|
||||
// missed a blur event somehow.
|
||||
|
@ -222,9 +224,10 @@ function handlePropertyChange(nativeEvent) {
|
|||
* If a `change` event should be fired, returns the target's ID.
|
||||
*/
|
||||
function getTargetIDForInputEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID
|
||||
) {
|
||||
if (topLevelType === topLevelTypes.topInput) {
|
||||
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
|
||||
// what we want so fall through here and trigger an abstract event
|
||||
|
@ -234,9 +237,10 @@ function getTargetIDForInputEvent(
|
|||
|
||||
// For IE8 and IE9.
|
||||
function handleEventsForInputEventIE(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID
|
||||
) {
|
||||
if (topLevelType === topLevelTypes.topFocus) {
|
||||
// In IE8, we can capture almost all .value changes by adding a
|
||||
// propertychange handler and looking for events with propertyName
|
||||
|
@ -260,9 +264,10 @@ function handleEventsForInputEventIE(
|
|||
|
||||
// For IE8 and IE9.
|
||||
function getTargetIDForInputEventIE(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID
|
||||
) {
|
||||
if (topLevelType === topLevelTypes.topSelectionChange ||
|
||||
topLevelType === topLevelTypes.topKeyUp ||
|
||||
topLevelType === topLevelTypes.topKeyDown) {
|
||||
|
@ -298,9 +303,10 @@ function shouldUseClickEvent(elem) {
|
|||
}
|
||||
|
||||
function getTargetIDForClickEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID
|
||||
) {
|
||||
if (topLevelType === topLevelTypes.topClick) {
|
||||
return topLevelTargetID;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,8 @@ function SyntheticCompositionEvent(
|
|||
dispatchConfig,
|
||||
dispatchMarker,
|
||||
nativeEvent,
|
||||
nativeEventTarget) {
|
||||
nativeEventTarget
|
||||
) {
|
||||
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ function SyntheticInputEvent(
|
|||
dispatchConfig,
|
||||
dispatchMarker,
|
||||
nativeEvent,
|
||||
nativeEventTarget) {
|
||||
nativeEventTarget
|
||||
) {
|
||||
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
||||
}
|
||||
|
||||
|
|
|
@ -478,9 +478,9 @@ describe('ReactDOMComponent', function() {
|
|||
|
||||
it('should not duplicate uppercased selfclosing tags', function() {
|
||||
var Container = React.createClass({
|
||||
render: function() {
|
||||
return React.createElement('BR', null);
|
||||
},
|
||||
render: function() {
|
||||
return React.createElement('BR', null);
|
||||
},
|
||||
});
|
||||
var returnedValue = React.renderToString(<Container/>);
|
||||
expect(returnedValue).not.toContain('</BR>');
|
||||
|
|
|
@ -323,10 +323,11 @@ to return true:wantsResponderID| |
|
|||
* @return {*} An accumulation of synthetic events.
|
||||
*/
|
||||
function setResponderAndExtractTransfer(
|
||||
topLevelType,
|
||||
topLevelTargetID,
|
||||
nativeEvent,
|
||||
nativeEventTarget) {
|
||||
topLevelType,
|
||||
topLevelTargetID,
|
||||
nativeEvent,
|
||||
nativeEventTarget
|
||||
) {
|
||||
var shouldSetEventType =
|
||||
isStartish(topLevelType) ? eventTypes.startShouldSetResponder :
|
||||
isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder :
|
||||
|
|
|
@ -66,8 +66,13 @@ var antiSubsequence = function(arr, indices) {
|
|||
* Helper for creating touch test config data.
|
||||
* @param allTouchHandles
|
||||
*/
|
||||
var _touchConfig =
|
||||
function(topType, targetNodeHandle, allTouchHandles, changedIndices, eventTarget) {
|
||||
var _touchConfig = function(
|
||||
topType,
|
||||
targetNodeHandle,
|
||||
allTouchHandles,
|
||||
changedIndices,
|
||||
eventTarget
|
||||
) {
|
||||
var allTouchObjects = allTouchHandles.map(touch);
|
||||
var changedTouchObjects = subsequence(allTouchObjects, changedIndices);
|
||||
var activeTouchObjects =
|
||||
|
|
|
@ -74,32 +74,34 @@ function ReactUpdatesFlushTransaction() {
|
|||
|
||||
assign(
|
||||
ReactUpdatesFlushTransaction.prototype,
|
||||
Transaction.Mixin, {
|
||||
getTransactionWrappers: function() {
|
||||
return TRANSACTION_WRAPPERS;
|
||||
},
|
||||
Transaction.Mixin,
|
||||
{
|
||||
getTransactionWrappers: function() {
|
||||
return TRANSACTION_WRAPPERS;
|
||||
},
|
||||
|
||||
destructor: function() {
|
||||
this.dirtyComponentsLength = null;
|
||||
CallbackQueue.release(this.callbackQueue);
|
||||
this.callbackQueue = null;
|
||||
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
|
||||
this.reconcileTransaction = null;
|
||||
},
|
||||
destructor: function() {
|
||||
this.dirtyComponentsLength = null;
|
||||
CallbackQueue.release(this.callbackQueue);
|
||||
this.callbackQueue = null;
|
||||
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
|
||||
this.reconcileTransaction = null;
|
||||
},
|
||||
|
||||
perform: function(method, scope, a) {
|
||||
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
|
||||
// with this transaction's wrappers around it.
|
||||
return Transaction.Mixin.perform.call(
|
||||
this,
|
||||
this.reconcileTransaction.perform,
|
||||
this.reconcileTransaction,
|
||||
method,
|
||||
scope,
|
||||
a
|
||||
);
|
||||
},
|
||||
});
|
||||
perform: function(method, scope, a) {
|
||||
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
|
||||
// with this transaction's wrappers around it.
|
||||
return Transaction.Mixin.perform.call(
|
||||
this,
|
||||
this.reconcileTransaction.perform,
|
||||
this.reconcileTransaction,
|
||||
method,
|
||||
scope,
|
||||
a
|
||||
);
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
|
||||
|
||||
|
|
|
@ -224,6 +224,7 @@ describe('ReactComponent', function() {
|
|||
log.push('start unmount');
|
||||
React.unmountComponentAtNode(el);
|
||||
|
||||
/* eslint-disable indent */
|
||||
expect(log).toEqual([
|
||||
'start mount',
|
||||
'inner 1 render',
|
||||
|
@ -251,6 +252,7 @@ describe('ReactComponent', function() {
|
|||
'ref 2 got null',
|
||||
'inner 2 componentWillUnmount',
|
||||
]);
|
||||
/* eslint-enable indent */
|
||||
});
|
||||
|
||||
it('fires the callback after a component is rendered', function() {
|
||||
|
|
|
@ -409,7 +409,7 @@ describe('ReactUpdates', function() {
|
|||
ref="switcherDiv"
|
||||
style={{
|
||||
display: this.state.tabKey === child.key ? '' : 'none',
|
||||
}}>
|
||||
}}>
|
||||
{child}
|
||||
</div>
|
||||
</Box>
|
||||
|
@ -601,6 +601,7 @@ describe('ReactUpdates', function() {
|
|||
});
|
||||
});
|
||||
|
||||
/* eslint-disable indent */
|
||||
expect(updates).toEqual([
|
||||
'Outer-render-0',
|
||||
'Inner-render-0-0',
|
||||
|
@ -627,6 +628,7 @@ describe('ReactUpdates', function() {
|
|||
'Inner-callback-2',
|
||||
'Outer-callback-2',
|
||||
]);
|
||||
/* eslint-enable indent */
|
||||
});
|
||||
|
||||
it('should flush updates in the correct order across roots', function() {
|
||||
|
|
|
@ -616,9 +616,9 @@ describe('OrderedMap', function() {
|
|||
expect(res.get('dog')).toBe(undefined);
|
||||
};
|
||||
result = OrderedMap.fromArray([
|
||||
{uniqueID: 'two', val: 'secondOM2'},
|
||||
{uniqueID: 'three', val: 'third'},
|
||||
], extractUniqueID).merge(oneTwo);
|
||||
{uniqueID: 'two', val: 'secondOM2'},
|
||||
{uniqueID: 'three', val: 'third'},
|
||||
], extractUniqueID).merge(oneTwo);
|
||||
testTwoThreeMergedWithOneTwo(result);
|
||||
|
||||
});
|
||||
|
|
|
@ -163,7 +163,7 @@ describe('ReactTestUtils', function() {
|
|||
|
||||
var shallowRenderer = ReactTestUtils.createRenderer();
|
||||
shallowRenderer.render(<SimpleComponent />, {
|
||||
name: 'foo',
|
||||
name: 'foo',
|
||||
});
|
||||
var result = shallowRenderer.getRenderOutput();
|
||||
expect(result).toEqual(<div>foo</div>);
|
||||
|
|
Loading…
Reference in New Issue