Skip to content

Commit 1843f87

Browse files
committed
Run prettier
1 parent 46bcd7f commit 1843f87

File tree

325 files changed

+12714
-11413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+12714
-11413
lines changed

src/__mocks__/InitializeCore.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
// Noop
1313

1414
// TODO #10932517: Move all initialization callers back into react-native
15+

src/__mocks__/deepDiffer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ var deepDiffer = function(one: any, two: any): boolean {
1616
// Short circuit on identical object references instead of traversing them.
1717
return false;
1818
}
19-
if ((typeof one === 'function') && (typeof two === 'function')) {
19+
if (typeof one === 'function' && typeof two === 'function') {
2020
// We consider all functions equal
2121
return false;
2222
}
23-
if ((typeof one !== 'object') || (one === null)) {
23+
if (typeof one !== 'object' || one === null) {
2424
// Primitives can be directly compared
2525
return one !== two;
2626
}
27-
if ((typeof two !== 'object') || (two === null)) {
27+
if (typeof two !== 'object' || two === null) {
2828
// We know they are different because the previous case would have triggered
2929
// otherwise.
3030
return true;

src/__mocks__/deepFreezeAndThrowOnMutationInDev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
// TODO: move into react or fbjs
1313

14-
var deepFreezeAndThrowOnMutationInDev = function() { };
14+
var deepFreezeAndThrowOnMutationInDev = function() {};
1515

1616
module.exports = deepFreezeAndThrowOnMutationInDev;

src/__mocks__/flattenStyle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
// TODO: Move flattenStyle into react
1313

14-
var flattenStyle = function() { };
14+
var flattenStyle = function() {};
1515

1616
module.exports = flattenStyle;

src/addons/ReactFragment.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ var ReactFragment = {
4141
warning(
4242
false,
4343
'React.addons.createFragment only accepts a single object. Got: %s',
44-
object
44+
object,
4545
);
4646
return object;
4747
}
4848
if (ReactElement.isValidElement(object)) {
4949
warning(
5050
false,
5151
'React.addons.createFragment does not accept a ReactElement ' +
52-
'without a wrapper object.'
52+
'without a wrapper object.',
5353
);
5454
return object;
5555
}
5656

5757
invariant(
5858
object.nodeType !== 1,
5959
'React.addons.createFragment(...): Encountered an invalid child; DOM ' +
60-
'elements are not valid children of React components.'
60+
'elements are not valid children of React components.',
6161
);
6262

6363
var result = [];
@@ -68,7 +68,7 @@ var ReactFragment = {
6868
warning(
6969
false,
7070
'React.addons.createFragment(...): Child objects should have ' +
71-
'non-numeric keys so ordering is preserved.'
71+
'non-numeric keys so ordering is preserved.',
7272
);
7373
warnedAboutNumeric = true;
7474
}
@@ -77,7 +77,7 @@ var ReactFragment = {
7777
object[key],
7878
result,
7979
key,
80-
emptyFunction.thatReturnsArgument
80+
emptyFunction.thatReturnsArgument,
8181
);
8282
}
8383

src/addons/ReactWithAddons.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
var React = require('react');
1515
var ReactAddonsDOMDependencies = require('ReactAddonsDOMDependencies');
16-
var ReactComponentWithPureRenderMixin =
17-
require('ReactComponentWithPureRenderMixin');
16+
var ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
1817
var ReactCSSTransitionGroup = require('ReactCSSTransitionGroup');
1918
var ReactFragment = require('ReactFragment');
2019
var ReactTransitionGroup = require('ReactTransitionGroup');

src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ var ReactComponentWithPureRenderMixin;
1616
var ReactTestUtils;
1717

1818
describe('ReactComponentWithPureRenderMixin', () => {
19-
2019
beforeEach(() => {
2120
React = require('react');
22-
ReactComponentWithPureRenderMixin =
23-
require('ReactComponentWithPureRenderMixin');
21+
ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
2422
ReactTestUtils = require('ReactTestUtils');
2523
});
2624

@@ -35,12 +33,7 @@ describe('ReactComponentWithPureRenderMixin', () => {
3533
}
3634

3735
render() {
38-
return (
39-
<Apple
40-
color={this.state.color}
41-
ref="apple"
42-
/>
43-
);
36+
return <Apple color={this.state.color} ref="apple" />;
4437
}
4538
}
4639

@@ -141,5 +134,4 @@ describe('ReactComponentWithPureRenderMixin', () => {
141134
instance.setState(getInitialState());
142135
expect(renderCalls).toBe(3);
143136
});
144-
145137
});

src/addons/__tests__/ReactFragment-test.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ var ReactDOM;
1616
var ReactFragment;
1717

1818
describe('ReactFragment', () => {
19-
2019
beforeEach(() => {
2120
React = require('react');
2221
ReactDOM = require('react-dom');
@@ -33,9 +32,9 @@ describe('ReactFragment', () => {
3332
var container = document.createElement('div');
3433
expect(() => ReactDOM.render(element, container)).toThrowError(
3534
'Objects are not valid as a React child (found: object with keys ' +
36-
'{x, y, z}). If you meant to render a collection of children, use an ' +
37-
'array instead or wrap the object using createFragment(object) from ' +
38-
'the React add-ons.'
35+
'{x, y, z}). If you meant to render a collection of children, use an ' +
36+
'array instead or wrap the object using createFragment(object) from ' +
37+
'the React add-ons.',
3938
);
4039
});
4140

@@ -53,9 +52,9 @@ describe('ReactFragment', () => {
5352
var container = document.createElement('div');
5453
expect(() => ReactDOM.render(<Foo />, container)).toThrowError(
5554
'Objects are not valid as a React child (found: object with keys ' +
56-
'{a, b, c}). If you meant to render a collection of children, use an ' +
57-
'array instead or wrap the object using createFragment(object) from ' +
58-
'the React add-ons.\n\nCheck the render method of `Foo`.'
55+
'{a, b, c}). If you meant to render a collection of children, use an ' +
56+
'array instead or wrap the object using createFragment(object) from ' +
57+
'the React add-ons.\n\nCheck the render method of `Foo`.',
5958
);
6059
});
6160

@@ -66,7 +65,7 @@ describe('ReactFragment', () => {
6665

6766
expectDev(console.error.calls.count()).toBe(1);
6867
expectDev(console.error.calls.argsFor(0)[0]).toContain(
69-
'Child objects should have non-numeric keys so ordering is preserved.'
68+
'Child objects should have non-numeric keys so ordering is preserved.',
7069
);
7170
});
7271

@@ -75,7 +74,7 @@ describe('ReactFragment', () => {
7574
ReactFragment.create(null);
7675
expectDev(console.error.calls.count()).toBe(1);
7776
expectDev(console.error.calls.argsFor(0)[0]).toContain(
78-
'React.addons.createFragment only accepts a single object.'
77+
'React.addons.createFragment only accepts a single object.',
7978
);
8079
});
8180

@@ -84,7 +83,7 @@ describe('ReactFragment', () => {
8483
ReactFragment.create([]);
8584
expectDev(console.error.calls.count()).toBe(1);
8685
expectDev(console.error.calls.argsFor(0)[0]).toContain(
87-
'React.addons.createFragment only accepts a single object.'
86+
'React.addons.createFragment only accepts a single object.',
8887
);
8988
});
9089

@@ -94,8 +93,7 @@ describe('ReactFragment', () => {
9493
expectDev(console.error.calls.count()).toBe(1);
9594
expectDev(console.error.calls.argsFor(0)[0]).toContain(
9695
'React.addons.createFragment does not accept a ReactElement without a ' +
97-
'wrapper object.'
96+
'wrapper object.',
9897
);
9998
});
100-
10199
});

src/addons/__tests__/renderSubtreeIntoContainer-test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ var ReactTestUtils = require('ReactTestUtils');
1717
var renderSubtreeIntoContainer = require('renderSubtreeIntoContainer');
1818

1919
describe('renderSubtreeIntoContainer', () => {
20-
2120
it('should pass context when rendering subtree elsewhere', () => {
2221
var portal = document.createElement('div');
2322

@@ -47,9 +46,11 @@ describe('renderSubtreeIntoContainer', () => {
4746
}
4847

4948
componentDidMount() {
50-
expect(function() {
51-
renderSubtreeIntoContainer(this, <Component />, portal);
52-
}.bind(this)).not.toThrow();
49+
expect(
50+
function() {
51+
renderSubtreeIntoContainer(this, <Component />, portal);
52+
}.bind(this),
53+
).not.toThrow();
5354
}
5455
}
5556

@@ -296,5 +297,4 @@ describe('renderSubtreeIntoContainer', () => {
296297
ReactDOM.render(<Parent value="foo" />, container);
297298
expect(portal2.textContent).toBe('foo');
298299
});
299-
300300
});

src/addons/__tests__/update-test.js

+39-35
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
var update = require('update');
1515

1616
describe('update', () => {
17-
1817
describe('$push', () => {
1918
it('pushes', () => {
2019
expect(update([1], {$push: [7]})).toEqual([1, 7]);
@@ -27,12 +26,12 @@ describe('update', () => {
2726
it('only pushes an array', () => {
2827
expect(update.bind(null, [], {$push: 7})).toThrowError(
2928
'update(): expected spec of $push to be an array; got 7. Did you ' +
30-
'forget to wrap your parameter in an array?'
29+
'forget to wrap your parameter in an array?',
3130
);
3231
});
3332
it('only pushes unto an array', () => {
3433
expect(update.bind(null, 1, {$push: 7})).toThrowError(
35-
'update(): expected target of $push to be an array; got 1.'
34+
'update(): expected target of $push to be an array; got 1.',
3635
);
3736
});
3837
});
@@ -49,12 +48,12 @@ describe('update', () => {
4948
it('only unshifts an array', () => {
5049
expect(update.bind(null, [], {$unshift: 7})).toThrowError(
5150
'update(): expected spec of $unshift to be an array; got 7. Did you ' +
52-
'forget to wrap your parameter in an array?'
51+
'forget to wrap your parameter in an array?',
5352
);
5453
});
5554
it('only unshifts unto an array', () => {
5655
expect(update.bind(null, 1, {$unshift: 7})).toThrowError(
57-
'update(): expected target of $unshift to be an array; got 1.'
56+
'update(): expected target of $unshift to be an array; got 1.',
5857
);
5958
});
6059
});
@@ -71,16 +70,16 @@ describe('update', () => {
7170
it('only splices an array of arrays', () => {
7271
expect(update.bind(null, [], {$splice: 1})).toThrowError(
7372
'update(): expected spec of $splice to be an array of arrays; got 1. ' +
74-
'Did you forget to wrap your parameters in an array?'
73+
'Did you forget to wrap your parameters in an array?',
7574
);
7675
expect(update.bind(null, [], {$splice: [1]})).toThrowError(
7776
'update(): expected spec of $splice to be an array of arrays; got 1. ' +
78-
'Did you forget to wrap your parameters in an array?'
77+
'Did you forget to wrap your parameters in an array?',
7978
);
8079
});
8180
it('only splices unto an array', () => {
8281
expect(update.bind(null, 1, {$splice: 7})).toThrowError(
83-
'Expected $splice target to be an array; got 1'
82+
'Expected $splice target to be an array; got 1',
8483
);
8584
});
8685
});
@@ -96,12 +95,12 @@ describe('update', () => {
9695
});
9796
it('only merges with an object', () => {
9897
expect(update.bind(null, {}, {$merge: 7})).toThrowError(
99-
'update(): $merge expects a spec of type \'object\'; got 7'
98+
"update(): $merge expects a spec of type 'object'; got 7",
10099
);
101100
});
102101
it('only merges with an object', () => {
103102
expect(update.bind(null, 7, {$merge: {a: 'b'}})).toThrowError(
104-
'update(): $merge expects a target of type \'object\'; got 7'
103+
"update(): $merge expects a target of type 'object'; got 7",
105104
);
106105
});
107106
});
@@ -131,32 +130,37 @@ describe('update', () => {
131130
});
132131
it('only applies a function', () => {
133132
expect(update.bind(null, 2, {$apply: 123})).toThrowError(
134-
'update(): expected spec of $apply to be a function; got 123.'
133+
'update(): expected spec of $apply to be a function; got 123.',
135134
);
136135
});
137136
});
138137

139138
it('should support deep updates', () => {
140-
expect(update({
141-
a: 'b',
142-
c: {
143-
d: 'e',
144-
f: [1],
145-
g: [2],
146-
h: [3],
147-
i: {j: 'k'},
148-
l: 4,
149-
},
150-
}, {
151-
c: {
152-
d: {$set: 'm'},
153-
f: {$push: [5]},
154-
g: {$unshift: [6]},
155-
h: {$splice: [[0, 1, 7]]},
156-
i: {$merge: {n: 'o'}},
157-
l: {$apply: (x) => x * 2},
158-
},
159-
})).toEqual({
139+
expect(
140+
update(
141+
{
142+
a: 'b',
143+
c: {
144+
d: 'e',
145+
f: [1],
146+
g: [2],
147+
h: [3],
148+
i: {j: 'k'},
149+
l: 4,
150+
},
151+
},
152+
{
153+
c: {
154+
d: {$set: 'm'},
155+
f: {$push: [5]},
156+
g: {$unshift: [6]},
157+
h: {$splice: [[0, 1, 7]]},
158+
i: {$merge: {n: 'o'}},
159+
l: {$apply: x => x * 2},
160+
},
161+
},
162+
),
163+
).toEqual({
160164
a: 'b',
161165
c: {
162166
d: 'm',
@@ -172,14 +176,14 @@ describe('update', () => {
172176
it('should require a command', () => {
173177
expect(update.bind(null, {a: 'b'}, {a: 'c'})).toThrowError(
174178
'update(): You provided a key path to update() that did not contain ' +
175-
'one of $push, $unshift, $splice, $set, $merge, $apply. Did you ' +
176-
'forget to include {$set: ...}?'
179+
'one of $push, $unshift, $splice, $set, $merge, $apply. Did you ' +
180+
'forget to include {$set: ...}?',
177181
);
178182
});
179183

180184
it('should perform safe hasOwnProperty check', () => {
181-
expect(update({}, {'hasOwnProperty': {$set: 'a'}})).toEqual({
182-
'hasOwnProperty': 'a',
185+
expect(update({}, {hasOwnProperty: {$set: 'a'}})).toEqual({
186+
hasOwnProperty: 'a',
183187
});
184188
});
185189
});

src/addons/shallowCompare.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ var shallowEqual = require('fbjs/lib/shallowEqual');
1919
* See also https://facebook.github.io/react/docs/shallow-compare.html
2020
*/
2121
function shallowCompare(instance, nextProps, nextState) {
22-
return (
23-
!shallowEqual(instance.props, nextProps) ||
24-
!shallowEqual(instance.state, nextState)
25-
);
22+
return !shallowEqual(instance.props, nextProps) ||
23+
!shallowEqual(instance.state, nextState);
2624
}
2725

2826
module.exports = shallowCompare;

0 commit comments

Comments
 (0)