Skip to content

Commit

Permalink
Run 'prettier' on the v15.6 branch (facebook#9487)
Browse files Browse the repository at this point in the history
* Run 'prettier' on the v15.6 branch

This is an easy fix and I'd like this branch to be as similar to master
(v16.0) as possible.

* `npm install --save-dev prettier && yarn prettier`

Checking in the updated `package.json` and `yarn.lock` for the 15.6
branch.

Oddly, running `yarn prettier` updated more files. I thought the
previous commit had covered all `prettier` syntax updates. Will commit
the new changes in a separate commit.

* Ran prettier

More syntax updates to get `prettier` checks passing on the `15.6-dev`
branch, and eventually, on 15-stable.

* Tweak eslint ignore comments to get linter passing

Something with running `prettier` moves or changes these comments in a
way that they were no longer being applied. We tweaked them so that both
'prettier' and 'eslint' pass.
  • Loading branch information
flarnie committed Jun 7, 2017
1 parent e98b956 commit 7ae4805
Show file tree
Hide file tree
Showing 287 changed files with 9,389 additions and 7,934 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"merge-stream": "^1.0.0",
"object-assign": "^4.1.1",
"platform": "^1.1.0",
"prettier": "^1.2.2",
"prop-types": "15.5.7",
"run-sequence": "^1.1.4",
"through2": "^2.0.0",
Expand Down
10 changes: 5 additions & 5 deletions src/addons/ReactFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ var ReactFragment = {
warning(
false,
'React.addons.createFragment only accepts a single object. Got: %s',
object
object,
);
return object;
}
if (ReactElement.isValidElement(object)) {
warning(
false,
'React.addons.createFragment does not accept a ReactElement ' +
'without a wrapper object.'
'without a wrapper object.',
);
return object;
}

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

var result = [];
Expand All @@ -68,7 +68,7 @@ var ReactFragment = {
warning(
false,
'React.addons.createFragment(...): Child objects should have ' +
'non-numeric keys so ordering is preserved.'
'non-numeric keys so ordering is preserved.',
);
warnedAboutNumeric = true;
}
Expand All @@ -77,7 +77,7 @@ var ReactFragment = {
object[key],
result,
key,
emptyFunction.thatReturnsArgument
emptyFunction.thatReturnsArgument,
);
}

Expand Down
3 changes: 1 addition & 2 deletions src/addons/ReactWithAddons.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
var LinkedStateMixin = require('LinkedStateMixin');
var React = require('React');
var ReactAddonsDOMDependencies = require('ReactAddonsDOMDependencies');
var ReactComponentWithPureRenderMixin =
require('ReactComponentWithPureRenderMixin');
var ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
var ReactCSSTransitionGroup = require('ReactCSSTransitionGroup');
var ReactFragment = require('ReactFragment');
var ReactTransitionGroup = require('ReactTransitionGroup');
Expand Down
28 changes: 13 additions & 15 deletions src/addons/__tests__/ReactFragment-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ var ReactDOM;
var ReactFragment;

describe('ReactFragment', () => {

beforeEach(() => {
React = require('React');
ReactDOM = require('ReactDOM');
Expand All @@ -33,9 +32,9 @@ describe('ReactFragment', () => {
var container = document.createElement('div');
expect(() => ReactDOM.render(element, container)).toThrowError(
'Objects are not valid as a React child (found: object with keys ' +
'{x, y, z}). If you meant to render a collection of children, use an ' +
'array instead or wrap the object using createFragment(object) from ' +
'the React add-ons.'
'{x, y, z}). If you meant to render a collection of children, use an ' +
'array instead or wrap the object using createFragment(object) from ' +
'the React add-ons.',
);
});

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

Expand All @@ -64,9 +63,9 @@ describe('ReactFragment', () => {
var container = document.createElement('div');
expect(() => ReactDOM.render(<div>{oldEl}</div>, container)).toThrowError(
'Objects are not valid as a React child (found: object with keys ' +
'{_isReactElement, type, props}). It looks like you\'re using an ' +
'element created by a different version of React. Make sure to use ' +
'only one copy of React.'
"{_isReactElement, type, props}). It looks like you're using an " +
'element created by a different version of React. Make sure to use ' +
'only one copy of React.',
);
});

Expand All @@ -77,7 +76,7 @@ describe('ReactFragment', () => {

expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.argsFor(0)[0]).toContain(
'Child objects should have non-numeric keys so ordering is preserved.'
'Child objects should have non-numeric keys so ordering is preserved.',
);
});

Expand All @@ -86,7 +85,7 @@ describe('ReactFragment', () => {
ReactFragment.create(null);
expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.argsFor(0)[0]).toContain(
'React.addons.createFragment only accepts a single object.'
'React.addons.createFragment only accepts a single object.',
);
});

Expand All @@ -95,7 +94,7 @@ describe('ReactFragment', () => {
ReactFragment.create([]);
expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.argsFor(0)[0]).toContain(
'React.addons.createFragment only accepts a single object.'
'React.addons.createFragment only accepts a single object.',
);
});

Expand All @@ -105,8 +104,7 @@ describe('ReactFragment', () => {
expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.argsFor(0)[0]).toContain(
'React.addons.createFragment does not accept a ReactElement without a ' +
'wrapper object.'
'wrapper object.',
);
});

});
10 changes: 5 additions & 5 deletions src/addons/__tests__/renderSubtreeIntoContainer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ var ReactTestUtils = require('ReactTestUtils');
var renderSubtreeIntoContainer = require('renderSubtreeIntoContainer');

describe('renderSubtreeIntoContainer', () => {

it('should pass context when rendering subtree elsewhere', () => {
var portal = document.createElement('div');

Expand Down Expand Up @@ -47,9 +46,11 @@ describe('renderSubtreeIntoContainer', () => {
}

componentDidMount() {
expect(function() {
renderSubtreeIntoContainer(this, <Component />, portal);
}.bind(this)).not.toThrow();
expect(
function() {
renderSubtreeIntoContainer(this, <Component />, portal);
}.bind(this),
).not.toThrow();
}
}

Expand Down Expand Up @@ -195,5 +196,4 @@ describe('renderSubtreeIntoContainer', () => {
ReactDOM.render(<Parent bar="changed" />, container);
expect(portal.firstChild.innerHTML).toBe('changed-changed');
});

});
74 changes: 39 additions & 35 deletions src/addons/__tests__/update-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
var update = require('update');

describe('update', () => {

describe('$push', () => {
it('pushes', () => {
expect(update([1], {$push: [7]})).toEqual([1, 7]);
Expand All @@ -27,12 +26,12 @@ describe('update', () => {
it('only pushes an array', () => {
expect(update.bind(null, [], {$push: 7})).toThrowError(
'update(): expected spec of $push to be an array; got 7. Did you ' +
'forget to wrap your parameter in an array?'
'forget to wrap your parameter in an array?',
);
});
it('only pushes unto an array', () => {
expect(update.bind(null, 1, {$push: 7})).toThrowError(
'update(): expected target of $push to be an array; got 1.'
'update(): expected target of $push to be an array; got 1.',
);
});
});
Expand All @@ -49,12 +48,12 @@ describe('update', () => {
it('only unshifts an array', () => {
expect(update.bind(null, [], {$unshift: 7})).toThrowError(
'update(): expected spec of $unshift to be an array; got 7. Did you ' +
'forget to wrap your parameter in an array?'
'forget to wrap your parameter in an array?',
);
});
it('only unshifts unto an array', () => {
expect(update.bind(null, 1, {$unshift: 7})).toThrowError(
'update(): expected target of $unshift to be an array; got 1.'
'update(): expected target of $unshift to be an array; got 1.',
);
});
});
Expand All @@ -71,16 +70,16 @@ describe('update', () => {
it('only splices an array of arrays', () => {
expect(update.bind(null, [], {$splice: 1})).toThrowError(
'update(): expected spec of $splice to be an array of arrays; got 1. ' +
'Did you forget to wrap your parameters in an array?'
'Did you forget to wrap your parameters in an array?',
);
expect(update.bind(null, [], {$splice: [1]})).toThrowError(
'update(): expected spec of $splice to be an array of arrays; got 1. ' +
'Did you forget to wrap your parameters in an array?'
'Did you forget to wrap your parameters in an array?',
);
});
it('only splices unto an array', () => {
expect(update.bind(null, 1, {$splice: 7})).toThrowError(
'Expected $splice target to be an array; got 1'
'Expected $splice target to be an array; got 1',
);
});
});
Expand All @@ -96,12 +95,12 @@ describe('update', () => {
});
it('only merges with an object', () => {
expect(update.bind(null, {}, {$merge: 7})).toThrowError(
'update(): $merge expects a spec of type \'object\'; got 7'
"update(): $merge expects a spec of type 'object'; got 7",
);
});
it('only merges with an object', () => {
expect(update.bind(null, 7, {$merge: {a: 'b'}})).toThrowError(
'update(): $merge expects a target of type \'object\'; got 7'
"update(): $merge expects a target of type 'object'; got 7",
);
});
});
Expand Down Expand Up @@ -131,32 +130,37 @@ describe('update', () => {
});
it('only applies a function', () => {
expect(update.bind(null, 2, {$apply: 123})).toThrowError(
'update(): expected spec of $apply to be a function; got 123.'
'update(): expected spec of $apply to be a function; got 123.',
);
});
});

it('should support deep updates', () => {
expect(update({
a: 'b',
c: {
d: 'e',
f: [1],
g: [2],
h: [3],
i: {j: 'k'},
l: 4,
},
}, {
c: {
d: {$set: 'm'},
f: {$push: [5]},
g: {$unshift: [6]},
h: {$splice: [[0, 1, 7]]},
i: {$merge: {n: 'o'}},
l: {$apply: (x) => x * 2},
},
})).toEqual({
expect(
update(
{
a: 'b',
c: {
d: 'e',
f: [1],
g: [2],
h: [3],
i: {j: 'k'},
l: 4,
},
},
{
c: {
d: {$set: 'm'},
f: {$push: [5]},
g: {$unshift: [6]},
h: {$splice: [[0, 1, 7]]},
i: {$merge: {n: 'o'}},
l: {$apply: x => x * 2},
},
},
),
).toEqual({
a: 'b',
c: {
d: 'm',
Expand All @@ -172,14 +176,14 @@ describe('update', () => {
it('should require a command', () => {
expect(update.bind(null, {a: 'b'}, {a: 'c'})).toThrowError(
'update(): You provided a key path to update() that did not contain ' +
'one of $push, $unshift, $splice, $set, $merge, $apply. Did you ' +
'forget to include {$set: ...}?'
'one of $push, $unshift, $splice, $set, $merge, $apply. Did you ' +
'forget to include {$set: ...}?',
);
});

it('should perform safe hasOwnProperty check', () => {
expect(update({}, {'hasOwnProperty': {$set: 'a'}})).toEqual({
'hasOwnProperty': 'a',
expect(update({}, {hasOwnProperty: {$set: 'a'}})).toEqual({
hasOwnProperty: 'a',
});
});
});
2 changes: 1 addition & 1 deletion src/addons/link/LinkedStateMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var LinkedStateMixin = {
linkState: function(key) {
return new ReactLink(
this.state[key],
ReactStateSetters.createStateKeySetter(this, key)
ReactStateSetters.createStateKeySetter(this, key),
);
},
};
Expand Down
6 changes: 3 additions & 3 deletions src/addons/link/ReactLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ function ReactLink(value, requestChange) {
*/
function createLinkTypeChecker(linkType) {
var shapes = {
value: linkType === undefined ?
React.PropTypes.any.isRequired :
linkType.isRequired,
value: linkType === undefined
? React.PropTypes.any.isRequired
: linkType.isRequired,
requestChange: React.PropTypes.func.isRequired,
};
return React.PropTypes.shape(shapes);
Expand Down

0 comments on commit 7ae4805

Please sign in to comment.