Skip to content

Commit

Permalink
chore: upgrade prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jul 8, 2019
1 parent 847bffe commit 6d972ab
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 68 deletions.
8 changes: 7 additions & 1 deletion package.json
Expand Up @@ -62,7 +62,7 @@
"mocha": "^6.0.2",
"mock-fs": "^4.4.1",
"opencollective": "^1.0.3",
"prettier": "^1.16.1",
"prettier": "^1.18.2",
"prettylint": "^1.0.0",
"progress": "^2.0.0",
"promise": "^8.0.2",
Expand Down Expand Up @@ -114,6 +114,12 @@
"singleQuote": true,
"trailingComma": "all",
"overrides": [
{
"files": "**/*.md",
"options": {
"printWidth": 500
}
},
{
"excludeFiles": [
"e2e/__tests__/**/*",
Expand Down
4 changes: 1 addition & 3 deletions packages/jest-circus/src/eventHandler.ts
Expand Up @@ -44,9 +44,7 @@ const eventHandler: Circus.EventHandler = (event, state): void => {

if (!describeBlockHasTests(currentDescribeBlock)) {
currentDescribeBlock.hooks.forEach(hook => {
hook.asyncError.message = `Invalid: ${
hook.type
}() may not be used in a describe block containing no tests.`;
hook.asyncError.message = `Invalid: ${hook.type}() may not be used in a describe block containing no tests.`;
state.unhandledErrors.push(hook.asyncError);
});
}
Expand Down
24 changes: 11 additions & 13 deletions packages/jest-diff/src/joinAlignedDiffs.ts
Expand Up @@ -189,20 +189,18 @@ export const joinAlignedDiffsNoExpand = (
// return joined lines with diff formatting.
export const joinAlignedDiffsExpand = (diffs: Array<Diff>) =>
diffs
.map(
(diff: Diff, i: number, diffs: Array<Diff>): string => {
const line = diff[1];
.map((diff: Diff, i: number, diffs: Array<Diff>): string => {
const line = diff[1];

switch (diff[0]) {
case DIFF_DELETE:
return printDeleteLine(line);
switch (diff[0]) {
case DIFF_DELETE:
return printDeleteLine(line);

case DIFF_INSERT:
return printInsertLine(line);
case DIFF_INSERT:
return printInsertLine(line);

default:
return printCommonLine(line, i === 0 || i === diffs.length - 1);
}
},
)
default:
return printCommonLine(line, i === 0 || i === diffs.length - 1);
}
})
.join('\n');
2 changes: 1 addition & 1 deletion packages/jest-haste-map/src/types.ts
Expand Up @@ -52,7 +52,7 @@ export type FileMetaData = [
/* size */ number,
/* visited */ 0 | 1,
/* dependencies */ string,
/* sha1 */ string | null | undefined
/* sha1 */ string | null | undefined,
];

export type MockData = Map<string, Config.Path>;
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-mock/src/index.ts
Expand Up @@ -81,11 +81,11 @@ type MockFunctionConfig = {

// see https://github.com/Microsoft/TypeScript/issues/25215
type NonFunctionPropertyNames<T> = {
[K in keyof T]: T[K] extends (...args: Array<any>) => any ? never : K
[K in keyof T]: T[K] extends (...args: Array<any>) => any ? never : K;
}[keyof T] &
string;
type FunctionPropertyNames<T> = {
[K in keyof T]: T[K] extends (...args: Array<any>) => any ? K : never
[K in keyof T]: T[K] extends (...args: Array<any>) => any ? K : never;
}[keyof T] &
string;

Expand Down
4 changes: 1 addition & 3 deletions packages/jest-snapshot/src/snapshot_resolver.ts
Expand Up @@ -109,9 +109,7 @@ function verifyConsistentTransformations(custom: SnapshotResolver) {
if (resolvedTestPath !== custom.testPathForConsistencyCheck) {
throw new Error(
chalk.bold(
`Custom snapshot resolver functions must transform paths consistently, i.e. expects resolveTestPath(resolveSnapshotPath('${
custom.testPathForConsistencyCheck
}')) === ${resolvedTestPath}`,
`Custom snapshot resolver functions must transform paths consistently, i.e. expects resolveTestPath(resolveSnapshotPath('${custom.testPathForConsistencyCheck}')) === ${resolvedTestPath}`,
),
);
}
Expand Down
36 changes: 18 additions & 18 deletions packages/jest-util/src/__tests__/deepCyclicCopy.test.ts
Expand Up @@ -85,14 +85,14 @@ it('uses the blacklist to avoid copying properties on the first level', () => {

it('does not keep the prototype by default when top level is object', () => {
// @ts-ignore
const sourceObject = new function() {}();
const sourceObject = new (function() {})();
// @ts-ignore
sourceObject.nestedObject = new function() {}();
sourceObject.nestedObject = new (function() {})();
// @ts-ignore
sourceObject.nestedArray = new function() {
sourceObject.nestedArray = new (function() {
// @ts-ignore
this.length = 0;
}();
})();

const spy = jest
.spyOn(Array, 'isArray')
Expand Down Expand Up @@ -125,10 +125,10 @@ it('does not keep the prototype by default when top level is array', () => {
const spy = jest.spyOn(Array, 'isArray').mockImplementation(() => true);

// @ts-ignore
const sourceArray = new function() {
const sourceArray = new (function() {
// @ts-ignore
this.length = 0;
}();
})();

const copy = deepCyclicCopy(sourceArray);
expect(Object.getPrototypeOf(copy)).not.toBe(
Expand All @@ -143,10 +143,10 @@ it('does not keep the prototype of arrays when keepPrototype = false', () => {
const spy = jest.spyOn(Array, 'isArray').mockImplementation(() => true);

// @ts-ignore
const sourceArray = new function() {
const sourceArray = new (function() {
// @ts-ignore
this.length = 0;
}();
})();

const copy = deepCyclicCopy(sourceArray, {keepPrototype: false});
expect(Object.getPrototypeOf(copy)).not.toBe(
Expand All @@ -161,10 +161,10 @@ it('keeps the prototype of arrays when keepPrototype = true', () => {
const spy = jest.spyOn(Array, 'isArray').mockImplementation(() => true);

// @ts-ignore
const sourceArray = new function() {
const sourceArray = new (function() {
// @ts-ignore
this.length = 0;
}();
})();

const copy = deepCyclicCopy(sourceArray, {keepPrototype: true});
expect(Object.getPrototypeOf(copy)).toBe(Object.getPrototypeOf(sourceArray));
Expand All @@ -174,14 +174,14 @@ it('keeps the prototype of arrays when keepPrototype = true', () => {

it('does not keep the prototype for objects when keepPrototype = false', () => {
// @ts-ignore
const sourceobject = new function() {}();
const sourceobject = new (function() {})();
// @ts-ignore
sourceobject.nestedObject = new function() {}();
sourceobject.nestedObject = new (function() {})();
// @ts-ignore
sourceobject.nestedArray = new function() {
sourceobject.nestedArray = new (function() {
// @ts-ignore
this.length = 0;
}();
})();

const spy = jest
.spyOn(Array, 'isArray')
Expand Down Expand Up @@ -211,14 +211,14 @@ it('does not keep the prototype for objects when keepPrototype = false', () => {

it('keeps the prototype for objects when keepPrototype = true', () => {
// @ts-ignore
const sourceObject = new function() {}();
const sourceObject = new (function() {})();
// @ts-ignore
sourceObject.nestedObject = new function() {}();
sourceObject.nestedObject = new (function() {})();
// @ts-ignore
sourceObject.nestedArray = new function() {
sourceObject.nestedArray = new (function() {
// @ts-ignore
this.length = 0;
}();
})();

const spy = jest
.spyOn(Array, 'isArray')
Expand Down
10 changes: 5 additions & 5 deletions packages/jest-worker/src/types.ts
Expand Up @@ -101,19 +101,19 @@ export type ChildMessageInitialize = [
boolean, // processed
string, // file
Array<unknown> | undefined, // setupArgs
MessagePort | undefined // MessagePort
MessagePort | undefined, // MessagePort
];

export type ChildMessageCall = [
typeof CHILD_MESSAGE_CALL, // type
boolean, // processed
string, // method
Array<unknown> // args
Array<unknown>, // args
];

export type ChildMessageEnd = [
typeof CHILD_MESSAGE_END, // type
boolean // processed
boolean, // processed
];

export type ChildMessage =
Expand All @@ -125,15 +125,15 @@ export type ChildMessage =

export type ParentMessageOk = [
typeof PARENT_MESSAGE_OK, // type
unknown // result
unknown, // result
];

export type ParentMessageError = [
PARENT_MESSAGE_ERROR, // type
string, // constructor
string, // message
string, // stack
unknown // extra
unknown, // extra
];

export type ParentMessage = ParentMessageOk | ParentMessageError;
Expand Down
11 changes: 2 additions & 9 deletions packages/pretty-format/README.md
Expand Up @@ -252,9 +252,7 @@ function serializeItems(items, config, indentation, depth, refs, printer) {
config.spacingOuter +
items
.map(
item =>
indentationItems +
printer(item, config, indentationItems, depth, refs), // callback
item => indentationItems + printer(item, config, indentationItems, depth, refs), // callback
)
.join(SEPARATOR + config.spacingInner) +
(config.min ? '' : SEPARATOR) + // following the last item
Expand All @@ -269,12 +267,7 @@ const plugin = {
},
serialize(array, config, indentation, depth, refs, printer) {
const name = array.constructor.name;
return ++depth > config.maxDepth
? '[' + name + ']'
: (config.min ? '' : name + ' ') +
'[' +
serializeItems(array, config, indentation, depth, refs, printer) +
']';
return ++depth > config.maxDepth ? '[' + name + ']' : (config.min ? '' : name + ' ') + '[' + serializeItems(array, config, indentation, depth, refs, printer) + ']';
},
};
```
Expand Down
12 changes: 3 additions & 9 deletions website/pages/en/versions.js
Expand Up @@ -34,9 +34,7 @@ class Versions extends React.Component {
<th>{latestVersion}</th>
<td>
<a
href={`${
siteConfig.baseUrl
}docs/${language}/getting-started.html`}
href={`${siteConfig.baseUrl}docs/${language}/getting-started.html`}
>
Documentation
</a>
Expand All @@ -59,9 +57,7 @@ class Versions extends React.Component {
<th>master</th>
<td>
<a
href={`${
siteConfig.baseUrl
}docs/${language}/next/getting-started.html`}
href={`${siteConfig.baseUrl}docs/${language}/next/getting-started.html`}
>
Documentation
</a>
Expand All @@ -85,9 +81,7 @@ class Versions extends React.Component {
<th>{version}</th>
<td>
<a
href={`${
siteConfig.baseUrl
}docs/${language}/${version}/getting-started.html`}
href={`${siteConfig.baseUrl}docs/${language}/${version}/getting-started.html`}
>
Documentation
</a>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -10501,10 +10501,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"

prettier@^1.13.4, prettier@^1.16.1:
version "1.16.4"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717"
integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==
prettier@^1.13.4, prettier@^1.18.2:
version "1.18.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==

pretty-format@24.0.0-alpha.6:
version "24.0.0-alpha.6"
Expand Down

0 comments on commit 6d972ab

Please sign in to comment.