Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
update prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
vsumner committed Jun 11, 2024
1 parent 54f02c7 commit 504f842
Show file tree
Hide file tree
Showing 42 changed files with 358 additions and 1,371 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module.exports = {
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@typescript-eslint/consistent-indexed-object-style': 'off',
// Enforce camelCase naming convention and PascalCase class and interface names
'@typescript-eslint/naming-convention': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"jest-watch-typeahead": "^2.2.2",
"npm-run-all": "^4.1.5",
"plop": "^2.6.0",
"prettier": "~2.8.6",
"prettier": "~3.3.2",
"puppeteer": "^13.2.0",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand Down
35 changes: 18 additions & 17 deletions packages/graphql-fixtures/src/fill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,32 @@ export type DeepThunk<Request, T> =
export type GraphQLFillerData<
Operation extends GraphQLOperation,
Request = undefined,
> = Operation extends GraphQLOperation<
infer Data,
infer Variables,
infer PartialData
>
? Thunk<
undefined extends Request
? GraphQLRequest<
Data,
undefined extends Variables ? {} : Variables,
PartialData
>
: Request,
DeepThunk<
> =
Operation extends GraphQLOperation<
infer Data,
infer Variables,
infer PartialData
>
? Thunk<
undefined extends Request
? GraphQLRequest<
Data,
undefined extends Variables ? {} : Variables,
PartialData
>
: Request,
PartialData
DeepThunk<
undefined extends Request
? GraphQLRequest<
Data,
undefined extends Variables ? {} : Variables,
PartialData
>
: Request,
PartialData
>
>
>
: never;
: never;

export interface Options<
Request extends GraphQLRequest<any, any, any> | null = GraphQLRequest<
Expand Down
4 changes: 3 additions & 1 deletion packages/graphql-testing/src/tests/e2e.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ describe('graphql-testing', () => {
{cursor: 'd', node: {__typename: 'Cat', name: 'Not Odie'}},
].map((item) => ({__typename: 'Edge', ...item}));

// eslint-disable-next-line jest/no-if
// eslint-disable-next-line jest/no-conditional-in-test
const startPosition = after
? fullData.findIndex((item) => item.cursor === after) + 1
: 0;
Expand Down Expand Up @@ -571,6 +571,7 @@ describe('graphql-testing', () => {
);

useEffect(() => {
/* eslint-disable jest/no-conditional-in-test */
if (petData?.pet) {
(async () => {
const personData = await client.query({
Expand All @@ -580,6 +581,7 @@ describe('graphql-testing', () => {
setPersonData(personData.data.person);
})();
}
/* eslint-enable jest/no-conditional-in-test */
}, [client, petData?.pet]);

return <div>{personData?.name}</div>;
Expand Down
23 changes: 6 additions & 17 deletions packages/graphql-typed/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,14 @@ export interface SimpleDocument<Data = {}, Variables = {}, DeepPartial = {}>
readonly source: string;
}

export type GraphQLData<T> = T extends GraphQLOperation<infer Data, any, any>
? Data
: never;
export type GraphQLData<T> =
T extends GraphQLOperation<infer Data, any, any> ? Data : never;

export type GraphQLVariables<T> = T extends GraphQLOperation<
any,
infer Variables,
any
>
? Variables
: never;
export type GraphQLVariables<T> =
T extends GraphQLOperation<any, infer Variables, any> ? Variables : never;

export type GraphQLDeepPartial<T> = T extends GraphQLOperation<
any,
any,
infer DeepPartial
>
? DeepPartial
: never;
export type GraphQLDeepPartial<T> =
T extends GraphQLOperation<any, any, infer DeepPartial> ? DeepPartial : never;

export const parse: <Data = {}, Variables = {}, DeepPartial = {}>(
source: string | Source,
Expand Down
5 changes: 2 additions & 3 deletions packages/graphql-typescript-definitions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,8 @@ export class Builder extends EventEmitter {
filesystem: GraphQLFilesystem,
projectConfig: GraphQLProjectConfig,
) {
const filePaths = await filesystem.getGraphQLProjectIncludedFilePaths(
projectConfig,
);
const filePaths =
await filesystem.getGraphQLProjectIncludedFilePaths(projectConfig);

return Promise.all(
filePaths.map((filePath) =>
Expand Down
5 changes: 2 additions & 3 deletions packages/graphql-validate-fixtures/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ export async function evaluateFixtures(
async function getOperationsForProject(
projectConfig: GraphQLProjectConfig,
): Promise<GraphQLProjectAST> {
const operationPaths = await getGraphQLProjectIncludedFilePaths(
projectConfig,
);
const operationPaths =
await getGraphQLProjectIncludedFilePaths(projectConfig);

const operationSources = await Promise.all(
operationPaths.map(loadOperationSource),
Expand Down
5 changes: 2 additions & 3 deletions packages/jest-dom-mocks/src/intersection-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ export default class IntersectionObserverMock {
(this.observers = setter(this.observers));

/* eslint-disable @typescript-eslint/no-extraneous-class */
(
global as any
).IntersectionObserverEntry = class IntersectionObserverEntry {};
(global as any).IntersectionObserverEntry =
class IntersectionObserverEntry {};
/* eslint-enable @typescript-eslint/no-extraneous-class */
Object.defineProperty(
IntersectionObserverEntry.prototype,
Expand Down
1 change: 1 addition & 0 deletions packages/jest-dom-mocks/src/tests/dimension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ describe('Dimension mocks', () => {

dimension.mock({
scrollWidth(element) {
/* eslint-disable-next-line jest/no-conditional-in-test */
return element.id === 'testId' ? 200 : 0;
},
});
Expand Down
4 changes: 4 additions & 0 deletions packages/koa-metrics/src/tests/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ describe('koa-metrics', () => {
ctx.response.length = length;
const originalGet = ctx.response.get;
ctx.response.get = (headerName) => {
/* eslint-disable jest/no-conditional-in-test */
if (headerName === 'Content-Length') {
return String(length);
}
/* eslint-enable jest/no-conditional-in-test */
return originalGet(headerName);
};
});
Expand Down Expand Up @@ -272,9 +274,11 @@ describe('koa-metrics', () => {
ctx.response.length = 7500;
const originalGet = ctx.response.get;
ctx.response.get = (headerName) => {
/* eslint-disable jest/no-conditional-in-test */
if (headerName === 'Content-Length') {
return '7500';
}
/* eslint-enable jest/no-conditional-in-test */
return originalGet(headerName);
};
});
Expand Down
4 changes: 2 additions & 2 deletions packages/koa-performance/src/tests/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,8 @@ type DeepPartial<T> = {
[K in keyof T]?: T[K] extends any[]
? T[K]
: T[K] extends object
? DeepPartial<T[K]>
: T[K];
? DeepPartial<T[K]>
: T[K];
};

function createBody({
Expand Down
6 changes: 3 additions & 3 deletions packages/name/src/tests/tryAbbreviateBusinessName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('tryAbbreviateBusinessName()', () => {
idealMaxLength: testCase.idealMaxLength,
});
// UNLESS Node version ≤ 14, in which case returns undefined as Intl.Segmenter is not available in this context
// eslint-disable-next-line jest/no-if
// eslint-disable-next-line jest/no-conditional-in-test
if (nodeMajorVersion() <= 14) {
// eslint-disable-next-line jest/no-conditional-expect
expect(abbreviatedName).toBeUndefined();
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('tryAbbreviateBusinessName()', () => {
name: testCase.name,
});
// UNLESS Node version ≤ 14, in which case returns undefined as Intl.Segmenter is not available in this context
// eslint-disable-next-line jest/no-if
// eslint-disable-next-line jest/no-conditional-in-test
if (nodeMajorVersion() <= 14) {
// eslint-disable-next-line jest/no-conditional-expect
expect(abbreviatedName).toBeUndefined();
Expand Down Expand Up @@ -143,7 +143,7 @@ describe('tryAbbreviateBusinessName()', () => {
idealMaxLength: testCase.idealMaxLength,
});
// UNLESS Node version ≤ 14, in which case returns undefined as Intl.Segmenter is not available in this context
// eslint-disable-next-line jest/no-if
// eslint-disable-next-line jest/no-conditional-in-test
if (nodeMajorVersion() <= 14) {
// eslint-disable-next-line jest/no-conditional-expect
expect(abbreviatedName).toBeUndefined();
Expand Down
10 changes: 6 additions & 4 deletions packages/name/src/tests/tryAbbreviateName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe('tryAbbreviateName()', () => {
familyName: '재현',
});
// UNLESS Node version ≤ 14, in which case returns undefined as Intl.Segmenter is not available in this context
// eslint-disable-next-line jest/no-if
// eslint-disable-next-line jest/no-conditional-in-test
if (nodeMajorVersion() <= 14) {
// eslint-disable-next-line jest/no-conditional-expect
expect(abbreviation).toBeUndefined();
Expand All @@ -140,7 +140,7 @@ describe('tryAbbreviateName()', () => {
idealMaxLength: 1,
});
// UNLESS Node version ≤ 14, in which case returns undefined as Intl.Segmenter is not available in this context
// eslint-disable-next-line jest/no-if
// eslint-disable-next-line jest/no-conditional-in-test
if (nodeMajorVersion() <= 14) {
// eslint-disable-next-line jest/no-conditional-expect
expect(abbreviation).toBeUndefined();
Expand Down Expand Up @@ -171,7 +171,7 @@ describe('tryAbbreviateName()', () => {
familyName: 'อภัยวงศ์',
});
// UNLESS Node version ≤ 14, in which case returns undefined as Intl.Segmenter is not available in this context
// eslint-disable-next-line jest/no-if
// eslint-disable-next-line jest/no-conditional-in-test
if (nodeMajorVersion() <= 14) {
// eslint-disable-next-line jest/no-conditional-expect
expect(abbreviation).toBeUndefined();
Expand All @@ -187,7 +187,7 @@ describe('tryAbbreviateName()', () => {
familyName: 'อภัยวงศ์',
});
// UNLESS Node version ≤ 14, in which case returns undefined as Intl.Segmenter is not available in this context
// eslint-disable-next-line jest/no-if
// eslint-disable-next-line jest/no-conditional-in-test
if (nodeMajorVersion() <= 14) {
// eslint-disable-next-line jest/no-conditional-expect
expect(abbreviation).toBeUndefined();
Expand All @@ -200,13 +200,15 @@ describe('tryAbbreviateName()', () => {
givenName: undefined,
familyName: 'อภัยวงศ์',
});
/* eslint-disable jest/no-conditional-in-test */
if (nodeMajorVersion() <= 14) {
// eslint-disable-next-line jest/no-conditional-expect
expect(abbreviation).toBeUndefined();
} else {
// eslint-disable-next-line jest/no-conditional-expect
expect(abbreviation).toBe('อ');
}
/* eslint-enable jest/no-conditional-in-test */
});
});

Expand Down
30 changes: 6 additions & 24 deletions packages/react-async/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,11 @@ export interface AsyncComponentType<
renderLoading: ((props: Props) => ReactNode) | undefined;
}

export type PreloadOptions<T> = T extends AsyncHookTarget<
any,
infer U,
any,
any
>
? U
: never;
export type PreloadOptions<T> =
T extends AsyncHookTarget<any, infer U, any, any> ? U : never;

export type PrefetchOptions<T> = T extends AsyncHookTarget<
any,
any,
infer U,
any
>
? U
: never;
export type PrefetchOptions<T> =
T extends AsyncHookTarget<any, any, infer U, any> ? U : never;

export type KeepFreshOptions<T> = T extends AsyncHookTarget<
any,
any,
any,
infer U
>
? U
: never;
export type KeepFreshOptions<T> =
T extends AsyncHookTarget<any, any, any, infer U> ? U : never;
1 change: 0 additions & 1 deletion packages/react-effect/src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export function extract(
afterEachPass,
}: Options = {},
) {
// eslint-disable-next-line react/jsx-no-constructed-context-values
const manager = new EffectManager({include});
const element = (
<EffectContext.Provider value={manager}>
Expand Down
9 changes: 9 additions & 0 deletions packages/react-effect/src/tests/server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('extract()', () => {
it('waits for effects to resolve', async () => {
jest.useRealTimers();
const {promise, resolve, resolved} = createResolvablePromise();
/* eslint-disable-next-line jest/no-conditional-in-test */
const spy = jest.fn(() => (resolved() ? promise : undefined));
const extractSpy = jest.fn();
const extractPromise = extract(<Effect perform={spy} />).then(extractSpy);
Expand All @@ -45,12 +46,14 @@ describe('extract()', () => {
it('calls betweenEachPass on each used kind', async () => {
const {resolve, resolved} = createResolvablePromise();
const kind = {id: Symbol('id'), betweenEachPass: jest.fn()};
/* eslint-disable jest/no-conditional-in-test */
await extract(
<Effect
perform={() => (resolved() ? undefined : resolve())}
kind={kind}
/>,
);
/* eslint-enable jest/no-conditional-in-test */
expect(kind.betweenEachPass).toHaveBeenCalledTimes(1);
});

Expand Down Expand Up @@ -126,12 +129,14 @@ describe('extract()', () => {
it('is called between passes', async () => {
const spy = jest.fn();
const {resolve, resolved} = createResolvablePromise();
/* eslint-disable jest/no-conditional-in-test */
await extract(
<Effect perform={() => (resolved() ? undefined : resolve())} />,
{
betweenEachPass: spy,
},
);
/* eslint-enable jest/no-conditional-in-test */
expect(spy).toHaveBeenCalledTimes(1);
});

Expand All @@ -144,6 +149,7 @@ describe('extract()', () => {
await extract(
<Effect
perform={() => {
/* eslint-disable-next-line jest/no-conditional-in-test */
return resolved()
? undefined
: resolve().then(() => {
Expand Down Expand Up @@ -182,12 +188,14 @@ describe('extract()', () => {
it('is called after each pass', async () => {
const spy = jest.fn();
const {resolve, resolved} = createResolvablePromise();
/* eslint-disable jest/no-conditional-in-test */
await extract(
<Effect perform={() => (resolved() ? undefined : resolve())} />,
{
afterEachPass: spy,
},
);
/* eslint-enable jest/no-conditional-in-test */
expect(spy).toHaveBeenCalledTimes(2);
});

Expand All @@ -200,6 +208,7 @@ describe('extract()', () => {
await extract(
<Effect
perform={() => {
/* eslint-disable-next-line jest/no-conditional-in-test */
return resolved()
? undefined
: resolve().then(() => {
Expand Down
Loading

0 comments on commit 504f842

Please sign in to comment.