Skip to content

Commit

Permalink
pkg: Update validation packages (#3295)
Browse files Browse the repository at this point in the history
* pkg: Update validation packages

* internal: Formatting

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nathaniel Tucker <[email protected]>
  • Loading branch information
renovate[bot] and ntucker authored Dec 1, 2024
1 parent febac62 commit 1d4e12c
Show file tree
Hide file tree
Showing 48 changed files with 131 additions and 150 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"devDependencies": {
"@anansi/babel-preset": "6.0.9",
"@anansi/browserslist-config": "1.5.1",
"@anansi/eslint-plugin": "1.0.17",
"@anansi/eslint-plugin": "1.0.18",
"@anansi/jest-preset": "0.11.8",
"@babel/cli": "7.25.9",
"@babel/core": "7.26.0",
Expand All @@ -62,7 +62,7 @@
"@react-navigation/native-stack": "^7.0.0",
"@testing-library/react": "16.0.1",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/react-native": "12.8.1",
"@testing-library/react-native": "12.9.0",
"@types/jest": "29.5.14",
"@types/node": "22.10.1",
"@types/react": "npm:[email protected]",
Expand All @@ -77,7 +77,7 @@
"cpy-cli": "5.0.0",
"cross-fetch": "^4.0.0",
"downlevel-dts": "^0.10.0",
"eslint": "9.15.0",
"eslint": "9.16.0",
"globals": "^15.9.0",
"ignore-styles": "^5.0.1",
"jest": "29.7.0",
Expand All @@ -86,7 +86,7 @@
"nock": "13.3.1",
"node-fetch": "^3.3.0",
"npm-run-all": "^4.1.5",
"prettier": "3.3.3",
"prettier": "3.4.1",
"react": "^19.0.0-rc.1",
"react-dom": "^19.0.0-rc.1",
"react-native": "0.76.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/controller/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ export default class Controller<
}

// second argument is false if any entities are missing
// eslint-disable-next-line prefer-const

const { data, paths } = this.memo.denormalize(
schema,
input,
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/manager/DevtoolsManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-inner-declarations */
import type { DevToolsConfig } from './devtoolsTypes.js';
import type { Controller, EndpointInterface } from '../index.js';
import type { Middleware } from '../middlewareTypes.js';
Expand Down Expand Up @@ -90,10 +89,10 @@ if (process.env.NODE_ENV !== 'production') {
*/
export default class DevToolsManager implements Manager {
declare middleware: Middleware;
protected declare devTools: undefined | any;
declare protected devTools: undefined | any;
protected started = false;
protected actions: [ActionTypes, State<unknown>][] = [];
protected declare controller: Controller;
declare protected controller: Controller;
declare skipLogging?: (action: ActionTypes) => boolean;
maxBufferLength = 100;

Expand Down
18 changes: 9 additions & 9 deletions packages/core/src/manager/PollingSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import type { SubscribeAction } from '../types.js';
* @see https://dataclient.io/docs/api/PollingSubscription
*/
export default class PollingSubscription implements Subscription {
protected declare readonly endpoint: EndpointInterface;
protected declare readonly args: readonly any[];
protected declare readonly key: string;
protected declare frequency: number;
declare protected readonly endpoint: EndpointInterface;
declare protected readonly args: readonly any[];
declare protected readonly key: string;
declare protected frequency: number;
protected frequencyHistogram: Map<number, number> = new Map();
protected declare controller: Controller;
protected declare intervalId?: ReturnType<typeof setInterval>;
protected declare lastIntervalId?: ReturnType<typeof setInterval>;
protected declare startId?: ReturnType<typeof setTimeout>;
private declare connectionListener: ConnectionListener;
declare protected controller: Controller;
declare protected intervalId?: ReturnType<typeof setInterval>;
declare protected lastIntervalId?: ReturnType<typeof setInterval>;
declare protected startId?: ReturnType<typeof setTimeout>;
declare private connectionListener: ConnectionListener;

constructor(
action: Omit<SubscribeAction, 'type'>,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/manager/SubscriptionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class SubscriptionManager<
[key: string]: InstanceType<S>;
} = {};

protected declare readonly Subscription: S;
declare protected readonly Subscription: S;
protected controller: Controller = new Controller();

constructor(Subscription: S) {
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/__tests__/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Entity from '../schemas/Entity';
describe.each([true, false])(`Endpoint (CSP %s)`, mockCSP => {
jest.resetModules();
jest.mock('../CSP', () => ({ CSP: mockCSP }));
// eslint-disable-next-line @typescript-eslint/no-var-requires

const Endpoint: typeof TEndpoint = require('../endpoint').default;
afterAll(() => {
jest.clearAllMocks();
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/__tests__/validateRequired.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import validateRequired from '../validateRequired';
let dateSpy: jest.SpyInstance;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
4 changes: 2 additions & 2 deletions packages/endpoint/src/schemas/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export default class CollectionSchema<
Args extends any[] = DefaultArgs,
Parent = any,
> {
protected declare nestKey: (parent: any, key: string) => Record<string, any>;
declare protected nestKey: (parent: any, key: string) => Record<string, any>;

protected declare argsKey?: (...args: any) => Record<string, any>;
declare protected argsKey?: (...args: any) => Record<string, any>;

declare readonly schema: S;

Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default abstract class Entity extends EntityMixin(EmptyBase) {
*
* Note: this only applies to non-nested members.
*/
protected declare static automaticValidation?: 'warn' | 'silent';
declare protected static automaticValidation?: 'warn' | 'silent';

/** Factory method to convert from Plain JS Objects.
*
Expand Down
3 changes: 1 addition & 2 deletions packages/endpoint/src/schemas/Invalidate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import type { EntityInterface, SchemaSimple } from '../interface.js';
import type { AbstractInstanceType } from '../normal.js';
import { INVALID } from '../special.js';
Expand All @@ -16,7 +15,7 @@ export default class Invalidate<
},
> implements SchemaSimple
{
protected declare _entity: E;
declare protected _entity: E;

/**
* Marks entity as Invalid.
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/Polymorphic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isImmutable } from './ImmutableUtils.js';
import { Visit } from '../interface.js';

export default class PolymorphicSchema {
private declare _schemaAttribute: any;
declare private _schemaAttribute: any;
protected schema: any;

constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/__tests__/All.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { INVALID } from '../../special';
let dateSpy: jest.SpyInstance<number, []>;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/__tests__/Array.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { schema } from '../../';
let dateSpy;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/__tests__/Entity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Entity from '../Entity';
let dateSpy: jest.SpyInstance;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/__tests__/Invalidate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Entity from '../Entity';
let dateSpy: jest.SpyInstance;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/__tests__/Object.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Entity from '../Entity';
let dateSpy;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/__tests__/Query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { schema, DenormalizeNullable } from '../..';
let dateSpy: jest.SpyInstance<number, []>;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SimpleMemoCache from './denormalize';
let dateSpy;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/__tests__/Union.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { schema } from '../../';
let dateSpy;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/__tests__/Values.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Entity from '../Entity';
let dateSpy;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
1 change: 0 additions & 1 deletion packages/graphql/src/__tests__/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ describe('GQLEndpoint', () => {
expect(error).toBeDefined();
expect(error.status).toBe(400);

// eslint-disable-next-line require-atomic-updates
console.error = oldError;
});
});
2 changes: 1 addition & 1 deletion packages/normalizr/src/__tests__/MemoCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Tacos extends IDEntity {
let dateSpy;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
2 changes: 1 addition & 1 deletion packages/normalizr/src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Tacos extends IDEntity {
let dateSpy;
beforeAll(() => {
dateSpy = jest
// eslint-disable-next-line no-undef

.spyOn(global.Date, 'now')
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
});
Expand Down
6 changes: 3 additions & 3 deletions packages/normalizr/src/memo/globalCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export default class GlobalCache implements Cache {
private cycleIndex = -1;
private localCache: Record<string, Record<string, any>> = {};

private declare getCache: (
declare private getCache: (
pk: string,
schema: EntityInterface,
) => WeakDependencyMap<EntityPath, object, any>;

private declare _getEntity: GetEntity;
private declare resultCache: EndpointsCache;
declare private _getEntity: GetEntity;
declare private resultCache: EndpointsCache;

constructor(
getEntity: GetEntity,
Expand Down
1 change: 0 additions & 1 deletion packages/normalizr/src/normalizr/addEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ function handleIndexes(
if (index in entity) {
indexMap[entity[index]] = id;
} /* istanbul ignore next */ else if (
// eslint-disable-next-line no-undef
process.env.NODE_ENV !== 'production'
) {
console.warn(`Index not found in entity. Indexes must be top-level members of your entity.
Expand Down
1 change: 0 additions & 1 deletion packages/normalizr/src/normalizr/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
StoreData,
} from '../types.js';

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const normalize = <
S extends Schema = Schema,
E extends Record<string, Record<string, any> | undefined> = Record<
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/components/BackupLoading.native.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/prop-types */
import React, { useEffect } from 'react';
import { Text, Linking, View } from 'react-native';

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class ErrorBoundary<E extends Error> extends React.Component<
return { error };
}

private declare unsubscribe: undefined | (() => void);
declare private unsubscribe: undefined | (() => void);
state: ErrorState<E> = {};

componentDidMount() {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/__tests__/useDLE.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe('useDLE', () => {
rerender();
await result.current;
expect(fetchMock).toHaveBeenCalledTimes(0);
// eslint-disable-next-line require-atomic-updates

time += 610000000;
rerender();
await result.current;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/__tests__/useFetch.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('useFetch', () => {
rerender();
await result.current;
expect(fetchMock).toHaveBeenCalledTimes(0);
// eslint-disable-next-line require-atomic-updates

time += 610000000;
rerender();
await result.current;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/__tests__/useFetch.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('useFetch', () => {
rerender();
await result.current;
expect(fetchMock).toHaveBeenCalledTimes(0);
// eslint-disable-next-line require-atomic-updates

time += 610000000;
rerender();
await result.current;
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/hooks/useCache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import type {
EndpointInterface,
DenormalizeNullable,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/hooks/useDLE.native.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import type {
Denormalize,
DenormalizeNullable,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/hooks/useDLE.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import type {
Denormalize,
DenormalizeNullable,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/hooks/useError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import type { NetworkError, UnknownError } from '@data-client/core';
import { EndpointInterface } from '@data-client/core';

Expand Down
1 change: 0 additions & 1 deletion packages/react/src/hooks/useFetch.native.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { DenormalizeNullable, ExpiryStatus, NI } from '@data-client/core';
import {
EndpointInterface,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/hooks/useFetch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { DenormalizeNullable, ExpiryStatus, NI } from '@data-client/core';
import {
EndpointInterface,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useLive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use client';
/* eslint-disable @typescript-eslint/ban-ts-comment */

import {
EndpointInterface,
Denormalize,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/hooks/useQuery.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import type {
DenormalizeNullable,
NI,
Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/hooks/useSubscription.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export default function useSubscription<
return () => {
controller.unsubscribe(endpoint, ...cleanedArgs);
};

// eslint-disable-next-line react-hooks/exhaustive-deps
},
[controller, key],
true,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/hooks/useSuspense.native.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { ExpiryStatus } from '@data-client/core';
import type {
EndpointInterface,
Expand Down
Loading

0 comments on commit 1d4e12c

Please sign in to comment.