Upgrade prettier to version 1.14.0 (#21466)

This upgrades prettier to version 1.14.0. The main motivation is to gain support for the new TypeScript language features introduced in 2.9 and 3.0.

Prettier versions 1.13 and 1.14 also introduced some other JavaScript and TypeScript style improvements resulting in a few small line break and parenthesis changes.

The relevant release notes are:

* [Prettier 1.13.0 Release Notes](https://prettier.io/blog/2018/05/27/1.13.0.html)
* [Prettier 1.40.0 Release Notes](https://prettier.io/blog/2018/07/29/1.14.0.html)
This commit is contained in:
Felix Stürmer 2018-07-31 15:30:36 +02:00 committed by GitHub
parent 149ff8ed17
commit 1211efdf40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 126 additions and 51 deletions

View file

@ -333,7 +333,7 @@
"nock": "8.0.0",
"node-sass": "^4.9.0",
"pixelmatch": "4.0.2",
"prettier": "^1.12.1",
"prettier": "^1.14.0",
"proxyquire": "1.7.11",
"simple-git": "1.37.0",
"sinon": "^5.0.7",

View file

@ -30,8 +30,14 @@ import { first, ignoreElements, map } from 'rxjs/operators';
*/
export function observeReadable(readable) {
return Rx.race(
Rx.fromEvent(readable, 'end').pipe(first(), ignoreElements()),
Rx.fromEvent(readable, 'end').pipe(
first(),
ignoreElements()
),
Rx.fromEvent(readable, 'error').pipe(first(), map(err => Rx.throwError(err)))
Rx.fromEvent(readable, 'error').pipe(
first(),
map(err => Rx.throwError(err))
)
);
}

View file

@ -27,8 +27,7 @@ const tarFs = require('tar-fs');
function decompressTarball(archive, dirPath) {
return new Promise((resolve, reject) => {
fs
.createReadStream(archive)
fs.createReadStream(archive)
.on('error', reject)
.pipe(zlib.createGunzip())
.on('error', reject)

View file

@ -51,7 +51,7 @@
"log-symbols": "^2.2.0",
"mkdirp": "^0.5.1",
"ora": "^1.4.0",
"prettier": "^1.12.1",
"prettier": "^1.14.0",
"read-pkg": "^3.0.0",
"rxjs": "^6.2.1",
"spawn-sync": "^1.0.15",

View file

@ -58,18 +58,31 @@ function getWatchHandlers(
const typescriptHandler = buildOutput$.pipe(
first(data => data.includes('$ tsc')),
map(() =>
buildOutput$.pipe(first(data => data.includes('Compilation complete.')), mapTo('tsc'))
buildOutput$.pipe(
first(data => data.includes('Compilation complete.')),
mapTo('tsc')
)
)
);
const webpackHandler = buildOutput$.pipe(
first(data => data.includes('$ webpack')),
map(() => buildOutput$.pipe(first(data => data.includes('Chunk Names')), mapTo('webpack')))
map(() =>
buildOutput$.pipe(
first(data => data.includes('Chunk Names')),
mapTo('webpack')
)
)
);
const defaultHandler = Rx.of(undefined).pipe(
delay(handlerReadinessTimeout),
map(() => buildOutput$.pipe(timeout(handlerDelay), catchError(() => Rx.of('timeout'))))
map(() =>
buildOutput$.pipe(
timeout(handlerDelay),
catchError(() => Rx.of('timeout'))
)
)
);
return [typescriptHandler, webpackHandler, defaultHandler];

View file

@ -2909,9 +2909,9 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
prettier@^1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.12.1.tgz#c1ad20e803e7749faf905a409d2367e06bbe7325"
prettier@^1.14.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.0.tgz#847c235522035fd988100f1f43cf20a7d24f9372"
private@^0.1.6, private@^0.1.7:
version "0.1.8"

View file

@ -92,7 +92,11 @@ export async function startServers(options) {
async function silence(milliseconds, { log }) {
await Rx.fromEvent(log, 'data')
.pipe(startWith(null), switchMap(() => Rx.timer(milliseconds)), take(1))
.pipe(
startWith(null),
switchMap(() => Rx.timer(milliseconds)),
take(1)
)
.toPromise();
}

View file

@ -42,6 +42,10 @@ export function reduce<T, R>(
initialValue: R
): OperatorFunction<T, R> {
return function reduceOperation(source) {
return pipe(scan(accumulator, initialValue), ifEmpty(() => initialValue), last())(source);
return pipe(
scan(accumulator, initialValue),
ifEmpty(() => initialValue),
last()
)(source);
};
}

View file

@ -17,4 +17,7 @@ function mapStateToProps(state = {}) {
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(ErrorGroupDetails);
export default connect(
mapStateToProps,
mapDispatchToProps
)(ErrorGroupDetails);

View file

@ -251,7 +251,8 @@ export default class WatcherFlyout extends Component {
href={_.get(ELASTIC_DOCS, 'watcher-get-started.url')}
>
documentation
</EuiLink>.
</EuiLink>
.
</p>
<EuiForm>
@ -368,7 +369,8 @@ export default class WatcherFlyout extends Component {
href={_.get(ELASTIC_DOCS, 'x-pack-emails.url')}
>
documentation
</EuiLink>.
</EuiLink>
.
</span>
}
>
@ -399,7 +401,8 @@ export default class WatcherFlyout extends Component {
href="https://get.slack.help/hc/en-us/articles/115005265063-Incoming-WebHooks-for-Slack"
>
documentation
</EuiLink>.
</EuiLink>
.
</span>
}
>

View file

@ -19,4 +19,7 @@ function mapStateToProps(state = {}) {
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(ErrorGroupOverview);
export default connect(
mapStateToProps,
mapDispatchToProps
)(ErrorGroupOverview);

View file

@ -26,7 +26,9 @@ export default function Main() {
{routes.map((route, i) => {
return route.switch ? (
<Switch key={i}>
{route.routes.map((route, i) => <Route key={i} {...route} />)}
{route.routes.map((route, i) => (
<Route key={i} {...route} />
))}
</Switch>
) : (
<Route key={i} {...route} />

View file

@ -17,4 +17,7 @@ function mapStateToProps(state = {}) {
}
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(ServiceOverview);
export default connect(
mapStateToProps,
mapDispatchToProps
)(ServiceOverview);

View file

@ -29,7 +29,8 @@ const SamplingTooltip = () => (
<Tooltip>
<TooltipTitle>Sampling</TooltipTitle>
Each bucket will show a sample transaction. If there&apos;s no sample
available,<br />
available,
<br />
it&apos;s most likely because of the sampling limit set in the agent
configuration.
</Tooltip>

View file

@ -16,4 +16,7 @@ function mapStateToProps(state = {}) {
}
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(Distribution);
export default connect(
mapStateToProps,
mapDispatchToProps
)(Distribution);

View file

@ -104,8 +104,8 @@ class Span extends React.Component {
location
} = this.props;
const width = get({ span }, SPAN_DURATION) / totalDuration * 100;
const left = get({ span }, SPAN_START) / totalDuration * 100;
const width = (get({ span }, SPAN_DURATION) / totalDuration) * 100;
const left = (get({ span }, SPAN_START) / totalDuration) * 100;
const spanId = get({ span }, SPAN_ID);
const spanName = get({ span }, SPAN_NAME);
@ -132,7 +132,9 @@ class Span extends React.Component {
}}
/>
<SpanLabel style={{ left: `${left}%`, width: `${100 - left}%` }}>
&lrm;{spanName}&lrm;
&lrm;
{spanName}
&lrm;
</SpanLabel>
<Modal

View file

@ -16,4 +16,7 @@ function mapStateToProps(state = {}) {
}
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(Spans);
export default connect(
mapStateToProps,
mapDispatchToProps
)(Spans);

View file

@ -14,4 +14,7 @@ function mapStateToProps(state = {}) {
}
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(Transaction);
export default connect(
mapStateToProps,
mapDispatchToProps
)(Transaction);

View file

@ -67,7 +67,7 @@ const DEFAULT_TAB = 'timeline';
export function getAgentMarks(transaction) {
const duration = get(transaction, TRANSACTION_DURATION);
const threshold = duration / 100 * 2;
const threshold = (duration / 100) * 2;
return sortBy(
Object.entries(get(transaction, 'transaction.marks.agent', [])),

View file

@ -16,6 +16,7 @@ function mapStateToProps(state = {}) {
}
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(
TransactionsDetails
);
export default connect(
mapStateToProps,
mapDispatchToProps
)(TransactionsDetails);

View file

@ -68,7 +68,8 @@ export default class DynamicBaselineFlyout extends Component {
text: (
<p>
There&apos;s already a job running for anomaly detection on{' '}
{serviceName} ({transactionType}).{' '}
{serviceName} ({transactionType}
).{' '}
<a href={getMlJobUrl(serviceName, transactionType, location)}>
View existing job
</a>
@ -89,8 +90,8 @@ export default class DynamicBaselineFlyout extends Component {
color: 'success',
text: (
<p>
The analysis is now running for {serviceName} ({transactionType}).
It might take a while before results are added to the response
The analysis is now running for {serviceName} ({transactionType}
). It might take a while before results are added to the response
times graph.{' '}
<a href={getMlJobUrl(serviceName, transactionType, location)}>
View job
@ -140,9 +141,9 @@ export default class DynamicBaselineFlyout extends Component {
iconType="check"
>
<p>
There is currently a job running for {serviceName} ({
transactionType
}).{' '}
There is currently a job running for {serviceName} (
{transactionType}
).{' '}
<a href={getMlJobUrl(serviceName, transactionType, location)}>
View existing job
</a>

View file

@ -22,7 +22,9 @@ const ImpactTooltip = () => (
trigger="hover"
overlay={
<Tooltip>
Impact shows the most used and<br />slowest endpoints in your service.
Impact shows the most used and
<br />
slowest endpoints in your service.
</Tooltip>
}
>

View file

@ -21,6 +21,7 @@ function mapStateToProps(state = {}) {
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(
TransactionOverview
);
export default connect(
mapStateToProps,
mapDispatchToProps
)(TransactionOverview);

View file

@ -11,4 +11,7 @@ import { updateLocation } from '../../../store/location';
const mapDispatchToProps = {
updateLocation
};
export default connect(null, mapDispatchToProps)(view);
export default connect(
null,
mapDispatchToProps
)(view);

View file

@ -17,4 +17,7 @@ function mapStateToProps(state = {}) {
}
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(TabNavigation);
export default connect(
mapStateToProps,
mapDispatchToProps
)(TabNavigation);

View file

@ -80,7 +80,8 @@ function TabNavigation({ urlParams, location }) {
<TooltipOverlay
content={
<span>
Transaction type:<br />
Transaction type:
<br />
{label}
</span>
}

View file

@ -57,7 +57,12 @@ function MoreSeries({ hiddenSeriesCount }) {
return null;
}
return <MoreSeriesContainer>(+{hiddenSeriesCount})</MoreSeriesContainer>;
return (
<MoreSeriesContainer>
(+
{hiddenSeriesCount})
</MoreSeriesContainer>
);
}
export default function Legends({

View file

@ -15,7 +15,10 @@ const INITIAL_DATA = [];
const withInitialData = createInitialDataSelector(INITIAL_DATA);
const getRelativeImpact = (impact, impactMin, impactMax) =>
Math.max((impact - impactMin) / Math.max(impactMax - impactMin, 1) * 100, 1);
Math.max(
((impact - impactMin) / Math.max(impactMax - impactMin, 1)) * 100,
1
);
function getWithRelativeImpact(items) {
const impacts = items.map(({ impact }) => impact);

View file

@ -125,7 +125,10 @@ export function KibanaLinkComponent({
return <EuiLink {...props} href={href} />;
}
const withLocation = connect(({ location }) => ({ location }), {});
const withLocation = connect(
({ location }) => ({ location }),
{}
);
export const RelativeLink = withLocation(RelativeLinkComponent);
export const KibanaLink = withLocation(KibanaLinkComponent);

View file

@ -10397,9 +10397,9 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
prettier@^1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.12.1.tgz#c1ad20e803e7749faf905a409d2367e06bbe7325"
prettier@^1.14.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.0.tgz#847c235522035fd988100f1f43cf20a7d24f9372"
pretty-format@^22.4.3:
version "22.4.3"