Skip to content

Commit

Permalink
chore(deps): update dependency prettier to v2 (#668)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency prettier to v2

* format

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jimmy Jia <tesrin@gmail.com>
  • Loading branch information
3 people committed Mar 22, 2020
1 parent 6149b46 commit d284b02
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 46 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const BrowserRouter = createBrowserRouter({
<Route
path="widgets/:widgetId"
getComponent={() =>
System.import('./WidgetPage').then(module => module.default)
System.import('./WidgetPage').then((module) => module.default)
}
getData={({ params: { widgetId } }) =>
fetchWidget(widgetId).catch(() => {
Expand Down
4 changes: 2 additions & 2 deletions examples/basic-jsx/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ const BrowserRouter = createBrowserRouter({
<Route path="foo" Component={() => <div>Foo</div>} />
<Route
path="bar"
getComponent={() => import('./Bar').then(m => m.default)}
getComponent={() => import('./Bar').then((m) => m.default)}
getData={() =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, 'Bar');
})
}
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ const BrowserRouter = createBrowserRouter({
},
{
path: 'bar',
getComponent: () => import('./Bar').then(m => m.default),
getComponent: () => import('./Bar').then((m) => m.default),
getData: () =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, 'Bar');
}),
render: (
Expand Down
4 changes: 2 additions & 2 deletions examples/global-pending/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ const BrowserRouter = createBrowserRouter({
{
path: 'foo',
getComponent: () =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, () => <div>Foo</div>);
}),
},
{
path: 'bar',
Component: ({ data }) => <div>{data}</div>, // eslint-disable-line react/prop-types
getData: () =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, 'Bar');
}),
},
Expand Down
4 changes: 2 additions & 2 deletions examples/hot-reloading/src/routeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export default hotRouteConfig(
<Route
path="bar"
getComponent={() =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, ({ data }) => <div>{data}</div>);
})
}
getData={() =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, 'Bar');
})
}
Expand Down
4 changes: 2 additions & 2 deletions examples/redux/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ const routeConfig = [
{
path: 'bar',
getComponent: () =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, ({ data }) => <div>{data}</div>);
}),
getData: () =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, 'Bar');
}),
render: (
Expand Down
12 changes: 6 additions & 6 deletions examples/transition-hook/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Main extends React.Component {
this.removeTransitionHook();
}

onTransition = location => {
onTransition = (location) => {
switch (this.state.transitionType) {
case 'confirm':
return 'Confirm';
Expand All @@ -71,20 +71,20 @@ class Main extends React.Component {
return false;
case 'delayedConfirm':
// This won't prompt on before unload.
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(resolve, 1000, 'Confirm');
});
case 'delayedAllow':
// This won't prompt on before unload.
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(resolve, 1000, true);
});
default:
return null;
}
};

onChangeSelect = event => {
onChangeSelect = (event) => {
this.setState({ transitionType: event.target.value });
};

Expand All @@ -99,8 +99,8 @@ class Main extends React.Component {
showCustomConfirm() {
this.setState({ showCustomConfirm: true });

return new Promise(resolve => {
this.resolveCustomConfirm = result => {
return new Promise((resolve) => {
this.resolveCustomConfirm = (result) => {
this.setState({ showCustomConfirm: false });
this.resolveCustomConfirm = null;
resolve(result);
Expand Down
4 changes: 2 additions & 2 deletions examples/universal-redux/src/routeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export default [
{
path: 'bar',
getComponent: () =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, ({ data }) => <div>{data}</div>);
}),
getData: () =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, 'Bar');
}),
render: (
Expand Down
4 changes: 2 additions & 2 deletions examples/universal/src/routeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ export default makeRouteConfig(
<Route
path="bar"
getComponent={() =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, ({ data }) => <div>{data}</div>);
})
}
getData={() =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, 'Bar');
})
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"jest": "^25.1.0",
"lint-staged": "^10.0.8",
"p-defer": "^3.0.0",
"prettier": "^1.19.1",
"prettier": "^2.0.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-proxy": "^3.0.0-alpha.1",
Expand Down
2 changes: 1 addition & 1 deletion src/BaseLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const defaultProps = {
};

class BaseLink extends React.Component {
onClick = event => {
onClick = (event) => {
const { onClick, target, router, to } = this.props;

if (onClick) {
Expand Down
8 changes: 5 additions & 3 deletions src/ResolverUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function checkResolved(value) {

return Promise.race([
value,
new Promise(resolve => {
new Promise((resolve) => {
setImmediate(resolve, UNRESOLVED);
}),
]);
Expand All @@ -32,7 +32,7 @@ function accumulateRouteValuesImpl(
for (const routeIndex of routeIndices) {
if (typeof routeIndex === 'object') {
// eslint-disable-next-line no-loop-func
Object.values(routeIndex).forEach(groupRouteIndices => {
Object.values(routeIndex).forEach((groupRouteIndices) => {
accumulated.push(
...accumulateRouteValuesImpl(
routeValues,
Expand Down Expand Up @@ -81,7 +81,9 @@ export function getRouteValue(match, getGetter, getValue) {

// This is a little more versatile than if we only passed in keys.
export function getRouteValues(routeMatches, getGetter, getValue) {
return routeMatches.map(match => getRouteValue(match, getGetter, getValue));
return routeMatches.map((match) =>
getRouteValue(match, getGetter, getValue),
);
}

function getRouteGetComponent(route) {
Expand Down
2 changes: 1 addition & 1 deletion src/createConnectedRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function createConnectedRouter({
...options
}) {
return connect(
state => {
(state) => {
const { match, resolvedMatch } = getFound(state);
return { match, resolvedMatch };
},
Expand Down
2 changes: 1 addition & 1 deletion src/createMatchEnhancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ActionTypes from './ActionTypes';

function createMatchMiddleware(matcher) {
return function matchMiddleware() {
return next => action => {
return (next) => (action) => {
const { type, payload } = action;
if (type !== FarceActionTypes.UPDATE_LOCATION) {
return next(action);
Expand Down
2 changes: 1 addition & 1 deletion src/makeRouteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import invariant from 'invariant';
import React from 'react';

function buildRouteConfig(node, routeConfig) {
React.Children.forEach(node, child => {
React.Children.forEach(node, (child) => {
// Falsy children get coerced to null. We check for this instead of
// implicit falsiness because we don't want to allow empty strings or 0.
if (child === null) {
Expand Down
2 changes: 1 addition & 1 deletion src/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
earlyData,
);

yield pendingElements.every(element => element !== undefined)
yield pendingElements.every((element) => element !== undefined)
? pendingElements
: undefined;

Expand Down
2 changes: 1 addition & 1 deletion src/withRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function withRouter(Component) {
return mapContextToProps(
{
consumers: RouterContext,
mapToProps: context => context,
mapToProps: (context) => context,
displayName: `withRouter(${Component.displayName || Component.name})`,
},
Component,
Expand Down
2 changes: 1 addition & 1 deletion test/BaseLink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('<BaseLink>', () => {
to="/"
match={{}}
router={router}
onClick={event => {
onClick={(event) => {
event.preventDefault();
}}
/>,
Expand Down
6 changes: 3 additions & 3 deletions test/ResolverUtils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('ResolverUtils', () => {

expect(
isResolved(
await checkResolved(Promise.resolve({}).then(value => value)),
await checkResolved(Promise.resolve({}).then((value) => value)),
),
).toBe(true);
});
Expand Down Expand Up @@ -101,8 +101,8 @@ describe('ResolverUtils', () => {
expect(
getRouteValues(
getRouteMatches(match),
route => route.getValue,
route => route.value,
(route) => route.getValue,
(route) => route.value,
),
).toEqual([9, 'a', undefined, undefined]);
});
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class InstrumentedResolver {
// eslint-disable-next-line require-await
async *resolveElements(match) {
let resolveDone;
this.done = new Promise(resolve => {
this.done = new Promise((resolve) => {
resolveDone = resolve;
});

Expand Down
4 changes: 2 additions & 2 deletions test/makeRouteConfig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('makeRouteConfig', () => {
}).toThrowErrorMatchingSnapshot();
});

['react-proxy', 'react-stand-in'].forEach(packageName => {
['react-proxy', 'react-stand-in'].forEach((packageName) => {
it(`should work with proxies from ${packageName}`, () => {
// eslint-disable-next-line global-require, import/no-dynamic-require
const createProxy = require(packageName).default;
Expand All @@ -247,7 +247,7 @@ describe('makeRouteConfig', () => {
match: {
router: {
matcher: {
format: to => to,
format: (to) => to,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion test/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('render', () => {
routeConfig: [
{
path: '/foo',
render: () => children => <div className="foo">{children}</div>,
render: () => (children) => <div className="foo">{children}</div>,
children: [
{
render: () => ({ nav, main }) => (
Expand Down
6 changes: 3 additions & 3 deletions types/example-app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { MainPage } from './MainPage';
import { WidgetsPage } from './WidgetsPage';

const fetchWidget = (widgetId: any) =>
new Promise(resolve => {
new Promise((resolve) => {
throw new Error('oops');
});

Expand All @@ -33,7 +33,7 @@ const BrowserRouter = createBrowserRouter({
<Route
path="widgets/:widgetId"
getComponent={() =>
import('./WidgetsPage').then(module => module.WidgetsPage)
import('./WidgetsPage').then((module) => module.WidgetsPage)
}
getData={({ params: { widgetId } }) =>
fetchWidget(widgetId).catch(() => {
Expand All @@ -54,7 +54,7 @@ const BrowserRouter = createBrowserRouter({
<Route
path="bar"
getData={() =>
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(resolve, 1000, 'Bar');
})
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5685,10 +5685,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"

prettier@^1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.1.tgz#3f00ac71263be34684b2b2c8d7e7f63737592dac"
integrity sha512-piXGBcY1zoFOG0MvHpNE5reAGseLmaCRifQ/fmfF49BcYkInEs/naD/unxGNAeOKFA5+JxVrPyMvMlpzcd20UA==

pretty-format@^25.1.0:
version "25.1.0"
Expand Down

0 comments on commit d284b02

Please sign in to comment.