Skip to content

Commit ecb34de

Browse files
committed
Upgrade ESLint, fix code
1 parent 2f07935 commit ecb34de

File tree

22 files changed

+115
-84
lines changed

22 files changed

+115
-84
lines changed

.eslintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ globals:
2727
rules:
2828
# ERRORS
2929
space-before-blocks: 2
30-
indent: [2, 2, indentSwitchCase: true]
30+
indent: [2, 2, {SwitchCase: 1}]
3131
brace-style: 2
3232
space-after-keywords: 2
33-
strict: 2
33+
strict: [2, global]
3434
comma-dangle: [2, always-multiline]
3535
# Make this a warning for now. We do this in a few places so we might need to
3636
# disable

docs/_js/examples/.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
rules:
33
block-scoped-var: 0
44
no-undef: 0
5+
strict: 0
56
react/react-in-jsx-scope: 0
67
react/jsx-no-undef: 0

eslint-rules/__tests__/warning-and-invariant-args-test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
'use strict';
1313

14-
var eslint = require('eslint');
15-
var ESLintTester = require('eslint-tester');
16-
var eslintTester = new ESLintTester(eslint.linter);
14+
var rule = require('../warning-and-invariant-args');
15+
var RuleTester = require('eslint').RuleTester;
16+
var ruleTester = new RuleTester();
1717

18-
eslintTester.addRuleTest('eslint-rules/warning-and-invariant-args', {
18+
ruleTester.run('eslint-rules/warning-and-invariant-args', rule, {
1919
valid: [
2020
"warning(true, 'hello, world');",
2121
"warning(true, 'expected %s, got %s', 42, 24);",
@@ -100,4 +100,3 @@ eslintTester.addRuleTest('eslint-rules/warning-and-invariant-args', {
100100
},
101101
],
102102
});
103-

grunt/config/npm.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
'use strict';
2+
13
exports.pack = {};

grunt/tasks/release.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,14 @@ function docs() {
127127
function msg() {
128128
// Just output a friendly reminder message for the rest of the process
129129
grunt.log.subhead('Release *almost* complete...');
130-
[
130+
var steps = [
131131
'Still todo:',
132132
'* put files on CDN',
133133
'* push changes to git repositories',
134134
'* publish npm module (`npm publish .`)',
135135
'* announce it on FB/Twitter/mailing list',
136-
].forEach(function(ln) {
136+
];
137+
steps.forEach(function(ln) {
137138
grunt.log.writeln(ln);
138139
});
139140
}

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44
"version": "0.14.0-beta3",
55
"devDependencies": {
66
"babel": "^5.8.3",
7-
"babel-eslint": "^3.1.25",
7+
"babel-eslint": "^4.0.5",
88
"benchmark": "^1.0.0",
99
"browserify": "^9.0.3",
1010
"bundle-collapser": "^1.1.1",
1111
"coffee-script": "^1.8.0",
1212
"del": "^1.2.0",
1313
"derequire": "^2.0.0",
1414
"envify": "^3.0.0",
15-
"eslint": "^0.24.1",
16-
"eslint-plugin-react": "^2.5.0",
15+
"eslint": "^1.1.0",
16+
"eslint-plugin-react": "^3.2.1",
1717
"eslint-plugin-react-internal": "file:eslint-rules",
18-
"eslint-tester": "^0.7.0",
1918
"fbjs": "0.1.0-alpha.4",
2019
"grunt": "^0.4.5",
2120
"grunt-cli": "^0.1.13",

packages/react-dom/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
'use strict';
2+
13
module.exports = require('react/lib/ReactDOM');

packages/react-dom/server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
'use strict';
2+
13
module.exports = require('react/lib/ReactDOMServer');

packages/react/addons.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
var warning = require('fbjs/lib/warning');
24
warning(
35
false,

scripts/jest/environment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
/* eslint-disable */
12
__DEV__ = true;

src/renderers/dom/client/ReactMount.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,13 @@ function findDeepestCachedAncestor(targetID) {
257257
* @param {boolean} shouldReuseMarkup If true, do not insert markup
258258
*/
259259
function mountComponentIntoNode(
260-
componentInstance,
261-
rootID,
262-
container,
263-
transaction,
264-
shouldReuseMarkup,
265-
context) {
260+
componentInstance,
261+
rootID,
262+
container,
263+
transaction,
264+
shouldReuseMarkup,
265+
context
266+
) {
266267
if (__DEV__) {
267268
if (context === emptyObject) {
268269
context = {};
@@ -287,11 +288,12 @@ function mountComponentIntoNode(
287288
* @param {boolean} shouldReuseMarkup If true, do not insert markup
288289
*/
289290
function batchedMountComponentIntoNode(
290-
componentInstance,
291-
rootID,
292-
container,
293-
shouldReuseMarkup,
294-
context) {
291+
componentInstance,
292+
rootID,
293+
container,
294+
shouldReuseMarkup,
295+
context
296+
) {
295297
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
296298
transaction.perform(
297299
mountComponentIntoNode,

src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,19 @@ function stopWatchingForChangeEventIE8() {
115115
}
116116

117117
function getTargetIDForChangeEvent(
118-
topLevelType,
119-
topLevelTarget,
120-
topLevelTargetID) {
118+
topLevelType,
119+
topLevelTarget,
120+
topLevelTargetID
121+
) {
121122
if (topLevelType === topLevelTypes.topChange) {
122123
return topLevelTargetID;
123124
}
124125
}
125126
function handleEventsForChangeEventIE8(
126-
topLevelType,
127-
topLevelTarget,
128-
topLevelTargetID) {
127+
topLevelType,
128+
topLevelTarget,
129+
topLevelTargetID
130+
) {
129131
if (topLevelType === topLevelTypes.topFocus) {
130132
// stopWatching() should be a noop here but we call it just in case we
131133
// missed a blur event somehow.
@@ -222,9 +224,10 @@ function handlePropertyChange(nativeEvent) {
222224
* If a `change` event should be fired, returns the target's ID.
223225
*/
224226
function getTargetIDForInputEvent(
225-
topLevelType,
226-
topLevelTarget,
227-
topLevelTargetID) {
227+
topLevelType,
228+
topLevelTarget,
229+
topLevelTargetID
230+
) {
228231
if (topLevelType === topLevelTypes.topInput) {
229232
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
230233
// what we want so fall through here and trigger an abstract event
@@ -234,9 +237,10 @@ function getTargetIDForInputEvent(
234237

235238
// For IE8 and IE9.
236239
function handleEventsForInputEventIE(
237-
topLevelType,
238-
topLevelTarget,
239-
topLevelTargetID) {
240+
topLevelType,
241+
topLevelTarget,
242+
topLevelTargetID
243+
) {
240244
if (topLevelType === topLevelTypes.topFocus) {
241245
// In IE8, we can capture almost all .value changes by adding a
242246
// propertychange handler and looking for events with propertyName
@@ -260,9 +264,10 @@ function handleEventsForInputEventIE(
260264

261265
// For IE8 and IE9.
262266
function getTargetIDForInputEventIE(
263-
topLevelType,
264-
topLevelTarget,
265-
topLevelTargetID) {
267+
topLevelType,
268+
topLevelTarget,
269+
topLevelTargetID
270+
) {
266271
if (topLevelType === topLevelTypes.topSelectionChange ||
267272
topLevelType === topLevelTypes.topKeyUp ||
268273
topLevelType === topLevelTypes.topKeyDown) {
@@ -298,9 +303,10 @@ function shouldUseClickEvent(elem) {
298303
}
299304

300305
function getTargetIDForClickEvent(
301-
topLevelType,
302-
topLevelTarget,
303-
topLevelTargetID) {
306+
topLevelType,
307+
topLevelTarget,
308+
topLevelTargetID
309+
) {
304310
if (topLevelType === topLevelTypes.topClick) {
305311
return topLevelTargetID;
306312
}

src/renderers/dom/client/syntheticEvents/SyntheticCompositionEvent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ function SyntheticCompositionEvent(
3232
dispatchConfig,
3333
dispatchMarker,
3434
nativeEvent,
35-
nativeEventTarget) {
35+
nativeEventTarget
36+
) {
3637
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
3738
}
3839

src/renderers/dom/client/syntheticEvents/SyntheticInputEvent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ function SyntheticInputEvent(
3333
dispatchConfig,
3434
dispatchMarker,
3535
nativeEvent,
36-
nativeEventTarget) {
36+
nativeEventTarget
37+
) {
3738
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
3839
}
3940

src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,9 @@ describe('ReactDOMComponent', function() {
478478

479479
it('should not duplicate uppercased selfclosing tags', function() {
480480
var Container = React.createClass({
481-
render: function() {
482-
return React.createElement('BR', null);
483-
},
481+
render: function() {
482+
return React.createElement('BR', null);
483+
},
484484
});
485485
var returnedValue = React.renderToString(<Container/>);
486486
expect(returnedValue).not.toContain('</BR>');

src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,11 @@ to return true:wantsResponderID| |
323323
* @return {*} An accumulation of synthetic events.
324324
*/
325325
function setResponderAndExtractTransfer(
326-
topLevelType,
327-
topLevelTargetID,
328-
nativeEvent,
329-
nativeEventTarget) {
326+
topLevelType,
327+
topLevelTargetID,
328+
nativeEvent,
329+
nativeEventTarget
330+
) {
330331
var shouldSetEventType =
331332
isStartish(topLevelType) ? eventTypes.startShouldSetResponder :
332333
isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder :

src/renderers/shared/event/eventPlugins/__tests__/ResponderEventPlugin-test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ var antiSubsequence = function(arr, indices) {
6666
* Helper for creating touch test config data.
6767
* @param allTouchHandles
6868
*/
69-
var _touchConfig =
70-
function(topType, targetNodeHandle, allTouchHandles, changedIndices, eventTarget) {
69+
var _touchConfig = function(
70+
topType,
71+
targetNodeHandle,
72+
allTouchHandles,
73+
changedIndices,
74+
eventTarget
75+
) {
7176
var allTouchObjects = allTouchHandles.map(touch);
7277
var changedTouchObjects = subsequence(allTouchObjects, changedIndices);
7378
var activeTouchObjects =

src/renderers/shared/reconciler/ReactUpdates.js

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,32 +74,34 @@ function ReactUpdatesFlushTransaction() {
7474

7575
assign(
7676
ReactUpdatesFlushTransaction.prototype,
77-
Transaction.Mixin, {
78-
getTransactionWrappers: function() {
79-
return TRANSACTION_WRAPPERS;
80-
},
81-
82-
destructor: function() {
83-
this.dirtyComponentsLength = null;
84-
CallbackQueue.release(this.callbackQueue);
85-
this.callbackQueue = null;
86-
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
87-
this.reconcileTransaction = null;
88-
},
89-
90-
perform: function(method, scope, a) {
91-
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
92-
// with this transaction's wrappers around it.
93-
return Transaction.Mixin.perform.call(
94-
this,
95-
this.reconcileTransaction.perform,
96-
this.reconcileTransaction,
97-
method,
98-
scope,
99-
a
100-
);
101-
},
102-
});
77+
Transaction.Mixin,
78+
{
79+
getTransactionWrappers: function() {
80+
return TRANSACTION_WRAPPERS;
81+
},
82+
83+
destructor: function() {
84+
this.dirtyComponentsLength = null;
85+
CallbackQueue.release(this.callbackQueue);
86+
this.callbackQueue = null;
87+
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
88+
this.reconcileTransaction = null;
89+
},
90+
91+
perform: function(method, scope, a) {
92+
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
93+
// with this transaction's wrappers around it.
94+
return Transaction.Mixin.perform.call(
95+
this,
96+
this.reconcileTransaction.perform,
97+
this.reconcileTransaction,
98+
method,
99+
scope,
100+
a
101+
);
102+
},
103+
}
104+
);
103105

104106
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
105107

src/renderers/shared/reconciler/__tests__/ReactComponent-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ describe('ReactComponent', function() {
224224
log.push('start unmount');
225225
React.unmountComponentAtNode(el);
226226

227+
/* eslint-disable indent */
227228
expect(log).toEqual([
228229
'start mount',
229230
'inner 1 render',
@@ -251,6 +252,7 @@ describe('ReactComponent', function() {
251252
'ref 2 got null',
252253
'inner 2 componentWillUnmount',
253254
]);
255+
/* eslint-enable indent */
254256
});
255257

256258
it('fires the callback after a component is rendered', function() {

src/renderers/shared/reconciler/__tests__/ReactUpdates-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ describe('ReactUpdates', function() {
409409
ref="switcherDiv"
410410
style={{
411411
display: this.state.tabKey === child.key ? '' : 'none',
412-
}}>
412+
}}>
413413
{child}
414414
</div>
415415
</Box>
@@ -601,6 +601,7 @@ describe('ReactUpdates', function() {
601601
});
602602
});
603603

604+
/* eslint-disable indent */
604605
expect(updates).toEqual([
605606
'Outer-render-0',
606607
'Inner-render-0-0',
@@ -627,6 +628,7 @@ describe('ReactUpdates', function() {
627628
'Inner-callback-2',
628629
'Outer-callback-2',
629630
]);
631+
/* eslint-enable indent */
630632
});
631633

632634
it('should flush updates in the correct order across roots', function() {

0 commit comments

Comments
 (0)