Skip to content

Commit b979db4

Browse files
authored
Bump Prettier (facebook#17811)
* Bump Prettier * Reformat * Use non-deprecated option
1 parent 18875b2 commit b979db4

File tree

158 files changed

+2341
-2392
lines changed

Some content is hidden

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

158 files changed

+2341
-2392
lines changed

.prettierrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
jsxBracketSameLine: true,
99
trailingComma: 'es5',
1010
printWidth: 80,
11-
parser: 'babylon',
11+
parser: 'babel',
1212

1313
overrides: [
1414
{

fixtures/attribute-behavior/src/App.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,7 @@ function prepareState(initGlobals) {
461461
hasSameBehaviorForAll,
462462
rowPatternHash,
463463
// "Good enough" id that we can store in localStorage
464-
rowIdHash: `${attribute.name} ${attribute.tagName} ${
465-
attribute.overrideStringValue
466-
}`,
464+
rowIdHash: `${attribute.name} ${attribute.tagName} ${attribute.overrideStringValue}`,
467465
};
468466
const rowGroup = rowPatternHashes.get(rowPatternHash) || new Set();
469467
rowGroup.add(row);
@@ -866,14 +864,12 @@ class App extends React.Component {
866864
// Sort
867865
switch (sortOrder) {
868866
case ALPHABETICAL:
869-
return filteredAttributes.sort(
870-
(attr1, attr2) =>
871-
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? -1 : 1
867+
return filteredAttributes.sort((attr1, attr2) =>
868+
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? -1 : 1
872869
);
873870
case REV_ALPHABETICAL:
874-
return filteredAttributes.sort(
875-
(attr1, attr2) =>
876-
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? 1 : -1
871+
return filteredAttributes.sort((attr1, attr2) =>
872+
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? 1 : -1
877873
);
878874
case GROUPED_BY_ROW_PATTERN: {
879875
return filteredAttributes.sort((attr1, attr2) => {

fixtures/dom/src/components/Iframe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ class IframeSubtree extends React.Component {
5555
}
5656
}
5757

58-
export default (ReactDOM.createPortal ? IframePortal : IframeSubtree);
58+
export default ReactDOM.createPortal ? IframePortal : IframeSubtree;

fixtures/dom/src/components/fixtures/home.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export default function Home() {
3333
<td>
3434
<a href="https://www.mozilla.org/en-US/firefox/organizations/">
3535
ESR<sup></sup>
36-
</a>, Latest
36+
</a>
37+
, Latest
3738
</td>
3839
</tr>
3940
<tr>

fixtures/dom/src/components/fixtures/suspense/index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ class TextInputFixtures extends React.Component {
213213

214214
<Fixture>
215215
<SuspendyTree>
216-
<img src="https://upload.wikimedia.org/wikipedia/commons/e/ee/Atom_%282%29.png" />React
217-
is cool
216+
<img src="https://upload.wikimedia.org/wikipedia/commons/e/ee/Atom_%282%29.png" />
217+
React is cool
218218
</SuspendyTree>
219219
</Fixture>
220220
</TestCase>
@@ -308,7 +308,9 @@ class TextInputFixtures extends React.Component {
308308
<div style={{height: 200, overflow: 'scroll'}}>
309309
{Array(20)
310310
.fill()
311-
.map((_, i) => <h2 key={i}>{i + 1}</h2>)}
311+
.map((_, i) => (
312+
<h2 key={i}>{i + 1}</h2>
313+
))}
312314
</div>
313315
</SuspendyTree>
314316
</Fixture>

fixtures/dom/src/toWarnDev.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,7 @@ const createMatcherFor = consoleMethod =>
205205
if (withoutStack !== warningsWithoutComponentStack.length) {
206206
return {
207207
message: () =>
208-
`Expected ${withoutStack} warnings without a component stack but received ${
209-
warningsWithoutComponentStack.length
210-
}:\n` +
208+
`Expected ${withoutStack} warnings without a component stack but received ${warningsWithoutComponentStack.length}:\n` +
211209
warningsWithoutComponentStack.map(warning =>
212210
this.utils.printReceived(warning)
213211
),

fixtures/eslint/index.js

+15-18
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@ function Comment({comment, commentSource}) {
88
const currentUserID = comment.viewer.id;
99
const environment = RelayEnvironment.forUser(currentUserID);
1010
const commentID = nullthrows(comment.id);
11-
useEffect(
12-
() => {
13-
const subscription = SubscriptionCounter.subscribeOnce(
14-
`StoreSubscription_${commentID}`,
15-
() =>
16-
StoreSubscription.subscribe(
17-
environment,
18-
{
19-
comment_id: commentID,
20-
},
21-
currentUserID,
22-
commentSource
23-
)
24-
);
25-
return () => subscription.dispose();
26-
},
27-
[commentID, commentSource, currentUserID, environment]
28-
);
11+
useEffect(() => {
12+
const subscription = SubscriptionCounter.subscribeOnce(
13+
`StoreSubscription_${commentID}`,
14+
() =>
15+
StoreSubscription.subscribe(
16+
environment,
17+
{
18+
comment_id: commentID,
19+
},
20+
currentUserID,
21+
commentSource
22+
)
23+
);
24+
return () => subscription.dispose();
25+
}, [commentID, commentSource, currentUserID, environment]);
2926
}

fixtures/fiber-debugger/src/App.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ class App extends Component {
192192
}
193193
/>
194194
<p>
195-
Step {currentStep}
196-
: {friendlyAction} (
195+
Step {currentStep}: {friendlyAction} (
197196
<a style={{color: 'gray'}} onClick={this.handleEdit} href="#">
198197
Edit
199198
</a>

fixtures/fiber-debugger/src/Fibers.js

+70-77
Original file line numberDiff line numberDiff line change
@@ -330,83 +330,76 @@ export default function Fibers({fibers, show, graphSettings, ...rest}) {
330330
]}
331331
</div>
332332
</Vertex>,
333-
fiber.child &&
334-
show.child && (
335-
<Edge
336-
source={fiber.id}
337-
target={fiber.child}
338-
kind="child"
339-
weight={1000}
340-
key={`${fiber.id}-${fiber.child}-child`}>
341-
child
342-
</Edge>
343-
),
344-
fiber.sibling &&
345-
show.sibling && (
346-
<Edge
347-
source={fiber.id}
348-
target={fiber.sibling}
349-
kind="sibling"
350-
weight={2000}
351-
key={`${fiber.id}-${fiber.sibling}-sibling`}>
352-
sibling
353-
</Edge>
354-
),
355-
fiber.return &&
356-
show.return && (
357-
<Edge
358-
source={fiber.id}
359-
target={fiber.return}
360-
kind="return"
361-
weight={1000}
362-
key={`${fiber.id}-${fiber.return}-return`}>
363-
return
364-
</Edge>
365-
),
366-
fiber.nextEffect &&
367-
show.fx && (
368-
<Edge
369-
source={fiber.id}
370-
target={fiber.nextEffect}
371-
kind="fx"
372-
weight={100}
373-
key={`${fiber.id}-${fiber.nextEffect}-nextEffect`}>
374-
nextFx
375-
</Edge>
376-
),
377-
fiber.firstEffect &&
378-
show.fx && (
379-
<Edge
380-
source={fiber.id}
381-
target={fiber.firstEffect}
382-
kind="fx"
383-
weight={100}
384-
key={`${fiber.id}-${fiber.firstEffect}-firstEffect`}>
385-
firstFx
386-
</Edge>
387-
),
388-
fiber.lastEffect &&
389-
show.fx && (
390-
<Edge
391-
source={fiber.id}
392-
target={fiber.lastEffect}
393-
kind="fx"
394-
weight={100}
395-
key={`${fiber.id}-${fiber.lastEffect}-lastEffect`}>
396-
lastFx
397-
</Edge>
398-
),
399-
fiber.alternate &&
400-
show.alt && (
401-
<Edge
402-
source={fiber.id}
403-
target={fiber.alternate}
404-
kind="alt"
405-
weight={10}
406-
key={`${fiber.id}-${fiber.alternate}-alt`}>
407-
alt
408-
</Edge>
409-
),
333+
fiber.child && show.child && (
334+
<Edge
335+
source={fiber.id}
336+
target={fiber.child}
337+
kind="child"
338+
weight={1000}
339+
key={`${fiber.id}-${fiber.child}-child`}>
340+
child
341+
</Edge>
342+
),
343+
fiber.sibling && show.sibling && (
344+
<Edge
345+
source={fiber.id}
346+
target={fiber.sibling}
347+
kind="sibling"
348+
weight={2000}
349+
key={`${fiber.id}-${fiber.sibling}-sibling`}>
350+
sibling
351+
</Edge>
352+
),
353+
fiber.return && show.return && (
354+
<Edge
355+
source={fiber.id}
356+
target={fiber.return}
357+
kind="return"
358+
weight={1000}
359+
key={`${fiber.id}-${fiber.return}-return`}>
360+
return
361+
</Edge>
362+
),
363+
fiber.nextEffect && show.fx && (
364+
<Edge
365+
source={fiber.id}
366+
target={fiber.nextEffect}
367+
kind="fx"
368+
weight={100}
369+
key={`${fiber.id}-${fiber.nextEffect}-nextEffect`}>
370+
nextFx
371+
</Edge>
372+
),
373+
fiber.firstEffect && show.fx && (
374+
<Edge
375+
source={fiber.id}
376+
target={fiber.firstEffect}
377+
kind="fx"
378+
weight={100}
379+
key={`${fiber.id}-${fiber.firstEffect}-firstEffect`}>
380+
firstFx
381+
</Edge>
382+
),
383+
fiber.lastEffect && show.fx && (
384+
<Edge
385+
source={fiber.id}
386+
target={fiber.lastEffect}
387+
kind="fx"
388+
weight={100}
389+
key={`${fiber.id}-${fiber.lastEffect}-lastEffect`}>
390+
lastFx
391+
</Edge>
392+
),
393+
fiber.alternate && show.alt && (
394+
<Edge
395+
source={fiber.id}
396+
target={fiber.alternate}
397+
kind="alt"
398+
weight={10}
399+
key={`${fiber.id}-${fiber.alternate}-alt`}>
400+
alt
401+
</Edge>
402+
),
410403
])}
411404
</Graph>
412405
</div>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"ncp": "^2.0.0",
7272
"object-assign": "^4.1.1",
7373
"pacote": "^9.5.6",
74-
"prettier": "1.13.7",
74+
"prettier": "1.19.1",
7575
"prop-types": "^15.6.2",
7676
"random-seed": "^0.3.0",
7777
"react-lifecycles-compat": "^3.0.2",

packages/create-subscription/src/__tests__/createSubscription-test.internal.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ describe('createSubscription', () => {
118118
const Subscription = createSubscription({
119119
getCurrentValue: source => undefined,
120120
subscribe: (source, callback) => {
121-
source.then(value => callback(value), value => callback(value));
121+
source.then(
122+
value => callback(value),
123+
value => callback(value),
124+
);
122125
// (Can't unsubscribe from a Promise)
123126
return () => {};
124127
},
@@ -196,7 +199,10 @@ describe('createSubscription', () => {
196199
const Subscription = createSubscription({
197200
getCurrentValue: source => undefined,
198201
subscribe: (source, callback) => {
199-
source.then(value => callback(value), value => callback(value));
202+
source.then(
203+
value => callback(value),
204+
value => callback(value),
205+
);
200206
// (Can't unsubscribe from a Promise)
201207
return () => {};
202208
},

packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js

+6-18
Original file line numberDiff line numberDiff line change
@@ -613,21 +613,15 @@ export default {
613613
context.report({
614614
node: declaredDependencyNode,
615615
message:
616-
`The ${
617-
declaredDependencyNode.raw
618-
} literal is not a valid dependency ` +
616+
`The ${declaredDependencyNode.raw} literal is not a valid dependency ` +
619617
`because it never changes. ` +
620-
`Did you mean to include ${
621-
declaredDependencyNode.value
622-
} in the array instead?`,
618+
`Did you mean to include ${declaredDependencyNode.value} in the array instead?`,
623619
});
624620
} else {
625621
context.report({
626622
node: declaredDependencyNode,
627623
message:
628-
`The ${
629-
declaredDependencyNode.raw
630-
} literal is not a valid dependency ` +
624+
`The ${declaredDependencyNode.raw} literal is not a valid dependency ` +
631625
'because it never changes. You can safely remove it.',
632626
});
633627
}
@@ -697,22 +691,16 @@ export default {
697691
bareFunctions.forEach(({fn, suggestUseCallback}) => {
698692
let message =
699693
`The '${fn.name.name}' function makes the dependencies of ` +
700-
`${reactiveHookName} Hook (at line ${
701-
declaredDependenciesNode.loc.start.line
702-
}) ` +
694+
`${reactiveHookName} Hook (at line ${declaredDependenciesNode.loc.start.line}) ` +
703695
`change on every render.`;
704696
if (suggestUseCallback) {
705697
message +=
706698
` To fix this, ` +
707-
`wrap the '${
708-
fn.name.name
709-
}' definition into its own useCallback() Hook.`;
699+
`wrap the '${fn.name.name}' definition into its own useCallback() Hook.`;
710700
} else {
711701
message +=
712702
` Move it inside the ${reactiveHookName} callback. ` +
713-
`Alternatively, wrap the '${
714-
fn.name.name
715-
}' definition into its own useCallback() Hook.`;
703+
`Alternatively, wrap the '${fn.name.name}' definition into its own useCallback() Hook.`;
716704
}
717705
// TODO: What if the function needs to change on every render anyway?
718706
// Should we suggest removing effect deps as an appropriate fix too?

packages/legacy-events/EventPluginUtils.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ if (__DEV__) {
4040
const listenersLen = listenersIsArr
4141
? dispatchListeners.length
4242
: dispatchListeners
43-
? 1
44-
: 0;
43+
? 1
44+
: 0;
4545

4646
const instancesIsArr = Array.isArray(dispatchInstances);
4747
const instancesLen = instancesIsArr
4848
? dispatchInstances.length
4949
: dispatchInstances
50-
? 1
51-
: 0;
50+
? 1
51+
: 0;
5252

5353
if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
5454
console.error('EventPluginUtils: Invalid `event`.');

0 commit comments

Comments
 (0)