Skip to content

Commit

Permalink
Bump Prettier (#17811)
Browse files Browse the repository at this point in the history
* Bump Prettier

* Reformat

* Use non-deprecated option
  • Loading branch information
gaearon authored Jan 9, 2020
1 parent 18875b2 commit b979db4
Show file tree
Hide file tree
Showing 158 changed files with 2,341 additions and 2,392 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
jsxBracketSameLine: true,
trailingComma: 'es5',
printWidth: 80,
parser: 'babylon',
parser: 'babel',

overrides: [
{
Expand Down
14 changes: 5 additions & 9 deletions fixtures/attribute-behavior/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,7 @@ function prepareState(initGlobals) {
hasSameBehaviorForAll,
rowPatternHash,
// "Good enough" id that we can store in localStorage
rowIdHash: `${attribute.name} ${attribute.tagName} ${
attribute.overrideStringValue
}`,
rowIdHash: `${attribute.name} ${attribute.tagName} ${attribute.overrideStringValue}`,
};
const rowGroup = rowPatternHashes.get(rowPatternHash) || new Set();
rowGroup.add(row);
Expand Down Expand Up @@ -866,14 +864,12 @@ class App extends React.Component {
// Sort
switch (sortOrder) {
case ALPHABETICAL:
return filteredAttributes.sort(
(attr1, attr2) =>
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? -1 : 1
return filteredAttributes.sort((attr1, attr2) =>
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? -1 : 1
);
case REV_ALPHABETICAL:
return filteredAttributes.sort(
(attr1, attr2) =>
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? 1 : -1
return filteredAttributes.sort((attr1, attr2) =>
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? 1 : -1
);
case GROUPED_BY_ROW_PATTERN: {
return filteredAttributes.sort((attr1, attr2) => {
Expand Down
2 changes: 1 addition & 1 deletion fixtures/dom/src/components/Iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ class IframeSubtree extends React.Component {
}
}

export default (ReactDOM.createPortal ? IframePortal : IframeSubtree);
export default ReactDOM.createPortal ? IframePortal : IframeSubtree;
3 changes: 2 additions & 1 deletion fixtures/dom/src/components/fixtures/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export default function Home() {
<td>
<a href="https://www.mozilla.org/en-US/firefox/organizations/">
ESR<sup></sup>
</a>, Latest
</a>
, Latest
</td>
</tr>
<tr>
Expand Down
8 changes: 5 additions & 3 deletions fixtures/dom/src/components/fixtures/suspense/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ class TextInputFixtures extends React.Component {

<Fixture>
<SuspendyTree>
<img src="https://upload.wikimedia.org/wikipedia/commons/e/ee/Atom_%282%29.png" />React
is cool
<img src="https://upload.wikimedia.org/wikipedia/commons/e/ee/Atom_%282%29.png" />
React is cool
</SuspendyTree>
</Fixture>
</TestCase>
Expand Down Expand Up @@ -308,7 +308,9 @@ class TextInputFixtures extends React.Component {
<div style={{height: 200, overflow: 'scroll'}}>
{Array(20)
.fill()
.map((_, i) => <h2 key={i}>{i + 1}</h2>)}
.map((_, i) => (
<h2 key={i}>{i + 1}</h2>
))}
</div>
</SuspendyTree>
</Fixture>
Expand Down
4 changes: 1 addition & 3 deletions fixtures/dom/src/toWarnDev.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ const createMatcherFor = consoleMethod =>
if (withoutStack !== warningsWithoutComponentStack.length) {
return {
message: () =>
`Expected ${withoutStack} warnings without a component stack but received ${
warningsWithoutComponentStack.length
}:\n` +
`Expected ${withoutStack} warnings without a component stack but received ${warningsWithoutComponentStack.length}:\n` +
warningsWithoutComponentStack.map(warning =>
this.utils.printReceived(warning)
),
Expand Down
33 changes: 15 additions & 18 deletions fixtures/eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,19 @@ function Comment({comment, commentSource}) {
const currentUserID = comment.viewer.id;
const environment = RelayEnvironment.forUser(currentUserID);
const commentID = nullthrows(comment.id);
useEffect(
() => {
const subscription = SubscriptionCounter.subscribeOnce(
`StoreSubscription_${commentID}`,
() =>
StoreSubscription.subscribe(
environment,
{
comment_id: commentID,
},
currentUserID,
commentSource
)
);
return () => subscription.dispose();
},
[commentID, commentSource, currentUserID, environment]
);
useEffect(() => {
const subscription = SubscriptionCounter.subscribeOnce(
`StoreSubscription_${commentID}`,
() =>
StoreSubscription.subscribe(
environment,
{
comment_id: commentID,
},
currentUserID,
commentSource
)
);
return () => subscription.dispose();
}, [commentID, commentSource, currentUserID, environment]);
}
3 changes: 1 addition & 2 deletions fixtures/fiber-debugger/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ class App extends Component {
}
/>
<p>
Step {currentStep}
: {friendlyAction} (
Step {currentStep}: {friendlyAction} (
<a style={{color: 'gray'}} onClick={this.handleEdit} href="#">
Edit
</a>
Expand Down
147 changes: 70 additions & 77 deletions fixtures/fiber-debugger/src/Fibers.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,83 +330,76 @@ export default function Fibers({fibers, show, graphSettings, ...rest}) {
]}
</div>
</Vertex>,
fiber.child &&
show.child && (
<Edge
source={fiber.id}
target={fiber.child}
kind="child"
weight={1000}
key={`${fiber.id}-${fiber.child}-child`}>
child
</Edge>
),
fiber.sibling &&
show.sibling && (
<Edge
source={fiber.id}
target={fiber.sibling}
kind="sibling"
weight={2000}
key={`${fiber.id}-${fiber.sibling}-sibling`}>
sibling
</Edge>
),
fiber.return &&
show.return && (
<Edge
source={fiber.id}
target={fiber.return}
kind="return"
weight={1000}
key={`${fiber.id}-${fiber.return}-return`}>
return
</Edge>
),
fiber.nextEffect &&
show.fx && (
<Edge
source={fiber.id}
target={fiber.nextEffect}
kind="fx"
weight={100}
key={`${fiber.id}-${fiber.nextEffect}-nextEffect`}>
nextFx
</Edge>
),
fiber.firstEffect &&
show.fx && (
<Edge
source={fiber.id}
target={fiber.firstEffect}
kind="fx"
weight={100}
key={`${fiber.id}-${fiber.firstEffect}-firstEffect`}>
firstFx
</Edge>
),
fiber.lastEffect &&
show.fx && (
<Edge
source={fiber.id}
target={fiber.lastEffect}
kind="fx"
weight={100}
key={`${fiber.id}-${fiber.lastEffect}-lastEffect`}>
lastFx
</Edge>
),
fiber.alternate &&
show.alt && (
<Edge
source={fiber.id}
target={fiber.alternate}
kind="alt"
weight={10}
key={`${fiber.id}-${fiber.alternate}-alt`}>
alt
</Edge>
),
fiber.child && show.child && (
<Edge
source={fiber.id}
target={fiber.child}
kind="child"
weight={1000}
key={`${fiber.id}-${fiber.child}-child`}>
child
</Edge>
),
fiber.sibling && show.sibling && (
<Edge
source={fiber.id}
target={fiber.sibling}
kind="sibling"
weight={2000}
key={`${fiber.id}-${fiber.sibling}-sibling`}>
sibling
</Edge>
),
fiber.return && show.return && (
<Edge
source={fiber.id}
target={fiber.return}
kind="return"
weight={1000}
key={`${fiber.id}-${fiber.return}-return`}>
return
</Edge>
),
fiber.nextEffect && show.fx && (
<Edge
source={fiber.id}
target={fiber.nextEffect}
kind="fx"
weight={100}
key={`${fiber.id}-${fiber.nextEffect}-nextEffect`}>
nextFx
</Edge>
),
fiber.firstEffect && show.fx && (
<Edge
source={fiber.id}
target={fiber.firstEffect}
kind="fx"
weight={100}
key={`${fiber.id}-${fiber.firstEffect}-firstEffect`}>
firstFx
</Edge>
),
fiber.lastEffect && show.fx && (
<Edge
source={fiber.id}
target={fiber.lastEffect}
kind="fx"
weight={100}
key={`${fiber.id}-${fiber.lastEffect}-lastEffect`}>
lastFx
</Edge>
),
fiber.alternate && show.alt && (
<Edge
source={fiber.id}
target={fiber.alternate}
kind="alt"
weight={10}
key={`${fiber.id}-${fiber.alternate}-alt`}>
alt
</Edge>
),
])}
</Graph>
</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"ncp": "^2.0.0",
"object-assign": "^4.1.1",
"pacote": "^9.5.6",
"prettier": "1.13.7",
"prettier": "1.19.1",
"prop-types": "^15.6.2",
"random-seed": "^0.3.0",
"react-lifecycles-compat": "^3.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ describe('createSubscription', () => {
const Subscription = createSubscription({
getCurrentValue: source => undefined,
subscribe: (source, callback) => {
source.then(value => callback(value), value => callback(value));
source.then(
value => callback(value),
value => callback(value),
);
// (Can't unsubscribe from a Promise)
return () => {};
},
Expand Down Expand Up @@ -196,7 +199,10 @@ describe('createSubscription', () => {
const Subscription = createSubscription({
getCurrentValue: source => undefined,
subscribe: (source, callback) => {
source.then(value => callback(value), value => callback(value));
source.then(
value => callback(value),
value => callback(value),
);
// (Can't unsubscribe from a Promise)
return () => {};
},
Expand Down
24 changes: 6 additions & 18 deletions packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,21 +613,15 @@ export default {
context.report({
node: declaredDependencyNode,
message:
`The ${
declaredDependencyNode.raw
} literal is not a valid dependency ` +
`The ${declaredDependencyNode.raw} literal is not a valid dependency ` +
`because it never changes. ` +
`Did you mean to include ${
declaredDependencyNode.value
} in the array instead?`,
`Did you mean to include ${declaredDependencyNode.value} in the array instead?`,
});
} else {
context.report({
node: declaredDependencyNode,
message:
`The ${
declaredDependencyNode.raw
} literal is not a valid dependency ` +
`The ${declaredDependencyNode.raw} literal is not a valid dependency ` +
'because it never changes. You can safely remove it.',
});
}
Expand Down Expand Up @@ -697,22 +691,16 @@ export default {
bareFunctions.forEach(({fn, suggestUseCallback}) => {
let message =
`The '${fn.name.name}' function makes the dependencies of ` +
`${reactiveHookName} Hook (at line ${
declaredDependenciesNode.loc.start.line
}) ` +
`${reactiveHookName} Hook (at line ${declaredDependenciesNode.loc.start.line}) ` +
`change on every render.`;
if (suggestUseCallback) {
message +=
` To fix this, ` +
`wrap the '${
fn.name.name
}' definition into its own useCallback() Hook.`;
`wrap the '${fn.name.name}' definition into its own useCallback() Hook.`;
} else {
message +=
` Move it inside the ${reactiveHookName} callback. ` +
`Alternatively, wrap the '${
fn.name.name
}' definition into its own useCallback() Hook.`;
`Alternatively, wrap the '${fn.name.name}' definition into its own useCallback() Hook.`;
}
// TODO: What if the function needs to change on every render anyway?
// Should we suggest removing effect deps as an appropriate fix too?
Expand Down
8 changes: 4 additions & 4 deletions packages/legacy-events/EventPluginUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ if (__DEV__) {
const listenersLen = listenersIsArr
? dispatchListeners.length
: dispatchListeners
? 1
: 0;
? 1
: 0;

const instancesIsArr = Array.isArray(dispatchInstances);
const instancesLen = instancesIsArr
? dispatchInstances.length
: dispatchInstances
? 1
: 0;
? 1
: 0;

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

0 comments on commit b979db4

Please sign in to comment.