Skip to content

Commit 9a1b3d1

Browse files
ntuckercursoragent
andcommitted
fix: Align prettier and jest-environment-node for validation upgrades
Prettier 3.9 reformats union types; force jest-environment-node@30.4.1 so React Native's Jest preset no longer ships a 29.x mocker that lacks clearMocksOnScope under Jest 30.4. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent c262c76 commit 9a1b3d1

25 files changed

Lines changed: 66 additions & 198 deletions

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@
120120
"react-dom": "19.2.3",
121121
"react-test-renderer": "19.2.3",
122122
"twig": "^2.0.0",
123-
"webpackbar": "^7.0.0"
123+
"webpackbar": "^7.0.0",
124+
"jest-environment-node": "30.4.1"
124125
},
125126
"packageManager": "yarn@4.17.1",
126127
"prettier": {

packages/core/src/mock/fixtureTypes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ export interface SuccessFixtureEndpoint<
1111
readonly endpoint: E;
1212
readonly args: Parameters<E>;
1313
readonly response:
14-
| ResolveType<E>
15-
| ((...args: Parameters<E>) => ResolveType<E>);
14+
ResolveType<E> | ((...args: Parameters<E>) => ResolveType<E>);
1615
readonly error?: false;
1716
/** Number of miliseconds to wait before resolving */
1817
readonly delay?: number;

packages/endpoint/src/interface.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import type { EndpointExtraOptions, FetchFunction } from './types.js';
33
export * from './SnapshotInterface.js';
44

55
export type Schema =
6-
| null
7-
| string
8-
| { [K: string]: any }
9-
| Schema[]
10-
| SchemaSimple
11-
| Serializable;
6+
null | string | { [K: string]: any } | Schema[] | SchemaSimple | Serializable;
127

138
export interface Queryable<Args extends readonly any[] = readonly any[]> {
149
queryKey(

packages/endpoint/src/schema.d.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,10 @@ export class Array<S extends Schema = Schema> implements SchemaClass {
7373
): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[];
7474

7575
_normalizeNullable():
76-
| (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]
77-
| undefined;
76+
(S extends EntityMap ? UnionResult<S> : Normalize<S>)[] | undefined;
7877

7978
_denormalizeNullable():
80-
| (S extends EntityMap<infer T> ? T : Denormalize<S>)[]
81-
| undefined;
79+
(S extends EntityMap<infer T> ? T : Denormalize<S>)[] | undefined;
8280

8381
denormalize(
8482
input: {},
@@ -125,12 +123,10 @@ export class All<
125123
): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[];
126124

127125
_normalizeNullable():
128-
| (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]
129-
| undefined;
126+
(S extends EntityMap ? UnionResult<S> : Normalize<S>)[] | undefined;
130127

131128
_denormalizeNullable():
132-
| (S extends EntityMap<infer T> ? T : Denormalize<S>)[]
133-
| undefined;
129+
(S extends EntityMap<infer T> ? T : Denormalize<S>)[] | undefined;
134130

135131
denormalize(
136132
input: {},
@@ -251,8 +247,7 @@ export interface UnionInstance<
251247
_normalizeNullable(): UnionResult<Choices> | undefined;
252248

253249
_denormalizeNullable():
254-
| AbstractInstanceType<Choices[keyof Choices]>
255-
| undefined;
250+
AbstractInstanceType<Choices[keyof Choices]> | undefined;
256251

257252
denormalize(
258253
input: {},

packages/endpoint/src/schemaTypes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ export type SchemaFunction<K = string, Args = any> = (
246246
key: string,
247247
) => K;
248248
export type SchemaAttribute<K = string, Args = any> =
249-
| K
250-
| SchemaFunction<K, Args>;
249+
K | SchemaFunction<K, Args>;
251250
export type MergeFunction = (entityA: any, entityB: any) => any;
252251
export type SchemaAttributeFunction<S extends Schema> = (
253252
value: any,

packages/endpoint/src/schemas/EntityFields.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/** Attempts to infer reasonable input type to construct an Entity */
22
export type EntityFields<U> = {
3-
readonly [K in keyof U as U[K] extends (...args: any) => any ? never
4-
: K]?: U[K] extends number ? U[K] | string
3+
readonly [
4+
K in keyof U as U[K] extends (...args: any) => any ? never : K
5+
]?: U[K] extends number ? U[K] | string
56
: U[K] extends string ? U[K] | number
67
: U[K];
78
};

packages/endpoint/src/schemas/EntityTypes.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,19 @@ export type EntityOptions<TInstance extends {}> = {
235235
| keyof TInstance;
236236
readonly key?: string;
237237
} & {
238-
readonly [K in Extract<
239-
keyof IEntityClass,
240-
| 'process'
241-
| 'merge'
242-
| 'expiresAt'
243-
| 'createIfValid'
244-
| 'mergeWithStore'
245-
| 'validate'
246-
| 'shouldReorder'
247-
| 'shouldUpdate'
248-
>]?: IEntityClass<abstract new (...args: any[]) => TInstance>[K];
238+
readonly [
239+
K in Extract<
240+
keyof IEntityClass,
241+
| 'process'
242+
| 'merge'
243+
| 'expiresAt'
244+
| 'createIfValid'
245+
| 'mergeWithStore'
246+
| 'validate'
247+
| 'shouldReorder'
248+
| 'shouldUpdate'
249+
>
250+
]?: IEntityClass<abstract new (...args: any[]) => TInstance>[K];
249251
};
250252

251253
export interface RequiredPKOptions<

packages/endpoint/src/schemas/__tests__/Query.test.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,29 +154,20 @@ describe.each([
154154
},
155155
});
156156
const totalCount:
157-
| DenormalizeNullable<typeof userCountByAdmin>
158-
| symbol = new MemoCache(MyDelegate).query(
159-
userCountByAdmin,
160-
[],
161-
state,
162-
).data;
157+
DenormalizeNullable<typeof userCountByAdmin> | symbol = new MemoCache(
158+
MyDelegate,
159+
).query(userCountByAdmin, [], state).data;
163160

164161
expect(totalCount).toBe(4);
165162
const nonAdminCount:
166-
| DenormalizeNullable<typeof userCountByAdmin>
167-
| symbol = new MemoCache(MyDelegate).query(
168-
userCountByAdmin,
169-
[{ isAdmin: false }],
170-
state,
171-
).data;
163+
DenormalizeNullable<typeof userCountByAdmin> | symbol = new MemoCache(
164+
MyDelegate,
165+
).query(userCountByAdmin, [{ isAdmin: false }], state).data;
172166
expect(nonAdminCount).toBe(3);
173167
const adminCount:
174-
| DenormalizeNullable<typeof userCountByAdmin>
175-
| symbol = new MemoCache(MyDelegate).query(
176-
userCountByAdmin,
177-
[{ isAdmin: true }],
178-
state,
179-
).data;
168+
DenormalizeNullable<typeof userCountByAdmin> | symbol = new MemoCache(
169+
MyDelegate,
170+
).query(userCountByAdmin, [{ isAdmin: true }], state).data;
180171
expect(adminCount).toBe(1);
181172
if (typeof totalCount === 'symbol') return;
182173

packages/img/src/Img.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import getImage from './getImage.js';
66

77
type Props<
88
C extends
9-
| keyof JSX.IntrinsicElements
10-
| React.JSXElementConstructor<{ src: string }> = 'img',
9+
keyof JSX.IntrinsicElements | React.JSXElementConstructor<{ src: string }> =
10+
'img',
1111
> = React.ComponentProps<C> & { component?: C };
1212

1313
export default function Img<

packages/normalizr/src/EntityFields.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/** Attempts to infer reasonable input type to construct an Entity */
22
export type EntityFields<U> = {
3-
readonly [K in keyof U as U[K] extends (...args: any) => any ? never
4-
: K]?: U[K] extends number ? U[K] | string
3+
readonly [
4+
K in keyof U as U[K] extends (...args: any) => any ? never : K
5+
]?: U[K] extends number ? U[K] | string
56
: U[K] extends string ? U[K] | number
67
: U[K];
78
};

0 commit comments

Comments
 (0)