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

Commit

Permalink
chore(deps): update dependency @pocket-tools/eslint-config to v2.1.7 (#…
Browse files Browse the repository at this point in the history
…248)

* chore(deps): update dependency @pocket-tools/eslint-config to v2.1.7

* Fix linting errors

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nina Pypchenko <[email protected]>
  • Loading branch information
renovate[bot] and nina-py authored Jul 20, 2023
1 parent e4daa3d commit 9282782
Show file tree
Hide file tree
Showing 14 changed files with 1,322 additions and 652 deletions.
1,851 changes: 1,259 additions & 592 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@pocket-tools/eslint-config": "2.0.0",
"@pocket-tools/eslint-config": "2.1.7",
"@pocket-tools/tsconfig": "2.0.1",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
Expand Down
8 changes: 4 additions & 4 deletions src/cache/ElasticacheRedis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('ElasticacheRedis', () => {
const readerData = { test: '1' };
const cache = new ElasticacheRedis(
new Redis(),
new Redis({ data: readerData })
new Redis({ data: readerData }),
);

const readerGetSpy = jest.spyOn((cache as any).readerClient, 'get');
Expand All @@ -41,7 +41,7 @@ describe('ElasticacheRedis', () => {
const readerData = { test1: '1', test2: '2' };
const cache = new ElasticacheRedis(
new Redis(),
new Redis({ data: readerData })
new Redis({ data: readerData }),
);

const readerMgetSpy = jest.spyOn((cache as any).readerClient, 'mget');
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('ElasticacheRedis', () => {
const readerFlushdbSpy = jest.spyOn((cache as any).readerClient, 'flushdb');
const primaryFlushdbSpy = jest.spyOn(
(cache as any).primaryClient,
'flushdb'
'flushdb',
);

await cache.flush();
Expand All @@ -135,7 +135,7 @@ describe('ElasticacheRedis', () => {
const readerFlushdbSpy = jest.spyOn((cache as any).readerClient, 'flushdb');
const primaryFlushdbSpy = jest.spyOn(
(cache as any).primaryClient,
'flushdb'
'flushdb',
);

await cache.clear();
Expand Down
7 changes: 5 additions & 2 deletions src/cache/ElasticacheRedis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export class ElasticacheRedis implements CacheInterface {
* @param primaryClient
* @param readerClient
*/
constructor(private primaryClient: Redis, private readerClient: Redis) {}
constructor(
private primaryClient: Redis,
private readerClient: Redis,
) {}

/**
* Generates an md5 hashed cache key from key input
Expand All @@ -42,7 +45,7 @@ export class ElasticacheRedis implements CacheInterface {
async set(
key: string,
value: string,
options?: KeyValueCacheSetOptions
options?: KeyValueCacheSetOptions,
): Promise<void> {
// this default replicates the behavior of the deprecated
// RedisClient from 'apollo-server-cache-redis'
Expand Down
2 changes: 1 addition & 1 deletion src/cache/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface CacheInterface extends KeyValueCache {
set(
key: string,
value: string,
options?: KeyValueCacheSetOptions
options?: KeyValueCacheSetOptions,
): Promise<void>;

/**
Expand Down
8 changes: 4 additions & 4 deletions src/dataloader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('dataloader', () => {
mget = FakeCache.prototype.mget = jest
.fn()
.mockResolvedValue(
batchFnProps.values.map((value) => JSON.stringify(value))
batchFnProps.values.map((value) => JSON.stringify(value)),
);

const result = await dataloader.multiGetCachedValues(batchFnProps);
Expand All @@ -70,7 +70,7 @@ describe('dataloader', () => {
[batchFnProps.cacheKeyPrefix + value.val]: JSON.stringify(value),
};
}, {}),
batchFnProps.maxAge
batchFnProps.maxAge,
);
});

Expand All @@ -90,7 +90,7 @@ describe('dataloader', () => {
.mockResolvedValue([]);
const mockMultiSetCacheValues = jest.spyOn(
dataloader,
'multiSetCacheValues'
'multiSetCacheValues',
);

const result = await dataloader.batchCacheFn(batchFnProps);
Expand All @@ -107,7 +107,7 @@ describe('dataloader', () => {
.mockResolvedValue(batchFnProps.values);
const mockMultiSetCacheValues = jest.spyOn(
dataloader,
'multiSetCacheValues'
'multiSetCacheValues',
);

const result = await dataloader.batchCacheFn(batchFnProps);
Expand Down
14 changes: 7 additions & 7 deletions src/dataloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ export type BatchFnProps<T, U> = {
* @param props
*/
export const multiGetCachedValues = async <T, U>(
props: Omit<BatchFnProps<T, U>, 'callback' | 'maxAge' | 'returnTypeKeyFn'>
props: Omit<BatchFnProps<T, U>, 'callback' | 'maxAge' | 'returnTypeKeyFn'>,
): Promise<U[]> => {
const keys = props.values.map(
(value) => props.cacheKeyPrefix + props.valueKeyFn(value)
(value) => props.cacheKeyPrefix + props.valueKeyFn(value),
);
const cacheValues = await props.cache.mget(keys.map(props.cache.getKey));
return cacheValues.map((value) => JSON.parse(value)).filter(Boolean);
Expand All @@ -78,14 +78,14 @@ export const multiGetCachedValues = async <T, U>(
*/
export const multiSetCacheValues = async <U>(
values: U[],
props: Omit<BatchFnProps<any, U>, 'values' | 'valueKeyFn' | 'callback'>
props: Omit<BatchFnProps<any, U>, 'values' | 'valueKeyFn' | 'callback'>,
): Promise<void> => {
const cacheValues = values.reduce((acc, value) => {
if (value) {
return {
...acc,
[props.cache.getKey(
(props.cacheKeyPrefix ?? '') + props.returnTypeKeyFn(value)
(props.cacheKeyPrefix ?? '') + props.returnTypeKeyFn(value),
)]: JSON.stringify(value),
};
}
Expand All @@ -108,7 +108,7 @@ export const multiSetCacheValues = async <U>(
*/
export const reorderData = <T, U>(
data: U[],
props: Omit<BatchFnProps<T, U>, 'maxAge' | 'callback'>
props: Omit<BatchFnProps<T, U>, 'maxAge' | 'callback'>,
): U[] => {
props.cacheKeyPrefix = props.cacheKeyPrefix ?? '';

Expand All @@ -117,7 +117,7 @@ export const reorderData = <T, U>(
return {
...acc,
[props.cache.getKey(
props.cacheKeyPrefix + props.returnTypeKeyFn(value)
props.cacheKeyPrefix + props.returnTypeKeyFn(value),
)]: value,
};
}
Expand All @@ -142,7 +142,7 @@ export const reorderData = <T, U>(
* @deprecated
*/
export const batchCacheFn = async <valueType, returnType>(
props: BatchFnProps<valueType, returnType>
props: BatchFnProps<valueType, returnType>,
): Promise<returnType[]> => {
// set the cache key prefix to empty string as default
props.cacheKeyPrefix = props.cacheKeyPrefix ?? '';
Expand Down
2 changes: 1 addition & 1 deletion src/errorHandler/errorHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('Server error handling: ', () => {
[logErrorSpy, sentrySpy].forEach((spy) => {
expect(spy.calledOnce).to.be.true;
expect(spy.getCall(0).args[0].message).to.contain(
"Cannot read properties of null (reading 'data')"
"Cannot read properties of null (reading 'data')",
);
expect(logErrorSpy.getCall(0).args[0].stack).to.not.be.undefined;
});
Expand Down
2 changes: 1 addition & 1 deletion src/errorHandler/errorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export enum InternalErrorCode {
*/
export function errorHandler(
formattedError: GraphQLFormattedError,
error: unknown
error: unknown,
): GraphQLFormattedError {
if (unwrapResolverError(error) instanceof GraphQLError) {
// Keep GraphQL errors intact
Expand Down
26 changes: 13 additions & 13 deletions src/isoStringScalar/isoStringScalar.integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function getSomethingDeleted(_parent, args, _contextValue, _info) {
}
return fakeData.find(
(something) =>
something.deletedAt?.toISOString() === args.date.toISOString()
something.deletedAt?.toISOString() === args.date.toISOString(),
);
}

Expand Down Expand Up @@ -139,7 +139,7 @@ describe('isoStringScalar ApolloServer usage', () => {
line: 5,
});
expect(result.errors[0].message).toBe(
'Invalid Data Store Response: invalid Date object'
'Invalid Data Store Response: invalid Date object',
);
expect(result.errors[0].path).toStrictEqual(['something', 'deletedAt']);
});
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('isoStringScalar ApolloServer usage', () => {
expect(result.errors.length).toBe(1);
expect(result.errors[0].extensions.code).toBe('BAD_USER_INPUT');
expect(result.errors[0].message).toBe(
'Variable "$date" got invalid value "10/21/2008"; Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Variable "$date" got invalid value "10/21/2008"; Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid MySQL date in, error out', async () => {
Expand All @@ -188,7 +188,7 @@ describe('isoStringScalar ApolloServer usage', () => {
expect(result.errors.length).toBe(1);
expect(result.errors[0].extensions.code).toBe('BAD_USER_INPUT');
expect(result.errors[0].message).toBe(
'Variable "$date" got invalid value "2008-10-21 13:57:01"; Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Variable "$date" got invalid value "2008-10-21 13:57:01"; Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid type in, error out', async () => {
Expand All @@ -200,7 +200,7 @@ describe('isoStringScalar ApolloServer usage', () => {
expect(result.errors.length).toBe(1);
expect(result.errors[0].extensions.code).toBe('BAD_USER_INPUT');
expect(result.errors[0].message).toBe(
'Variable "$date" got invalid value 2023; Invalid User Input: ISOString Scalar parse expected a value of type string or null'
'Variable "$date" got invalid value 2023; Invalid User Input: ISOString Scalar parse expected a value of type string or null',
);
});
});
Expand Down Expand Up @@ -256,10 +256,10 @@ describe('isoStringScalar ApolloServer usage', () => {
const result = response.body['singleResult'];
expect(result.errors.length).toBe(1);
expect(result.errors[0].extensions.code).toBe(
'GRAPHQL_VALIDATION_FAILED'
'GRAPHQL_VALIDATION_FAILED',
);
expect(result.errors[0].message).toBe(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid MySQL date in, error out', async () => {
Expand All @@ -277,10 +277,10 @@ describe('isoStringScalar ApolloServer usage', () => {
const result = response.body['singleResult'];
expect(result.errors.length).toBe(1);
expect(result.errors[0].extensions.code).toBe(
'GRAPHQL_VALIDATION_FAILED'
'GRAPHQL_VALIDATION_FAILED',
);
expect(result.errors[0].message).toBe(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid type in, error out', async () => {
Expand All @@ -298,10 +298,10 @@ describe('isoStringScalar ApolloServer usage', () => {
const result = response.body['singleResult'];
expect(result.errors.length).toBe(1);
expect(result.errors[0].extensions.code).toBe(
'GRAPHQL_VALIDATION_FAILED'
'GRAPHQL_VALIDATION_FAILED',
);
expect(result.errors[0].message).toBe(
'Invalid User Input: ISOString Scalar parse expected a value of type string or null'
'Invalid User Input: ISOString Scalar parse expected a value of type string or null',
);
});
it('invalid 0000-00-00 date format in, error out', async () => {
Expand All @@ -319,10 +319,10 @@ describe('isoStringScalar ApolloServer usage', () => {
const result = response.body['singleResult'];
expect(result.errors.length).toBe(1);
expect(result.errors[0].extensions.code).toBe(
'GRAPHQL_VALIDATION_FAILED'
'GRAPHQL_VALIDATION_FAILED',
);
expect(result.errors[0].message).toBe(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
});
Expand Down
24 changes: 12 additions & 12 deletions src/isoStringScalar/isoStringScalar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('isoStringScalar', () => {
expect(() => {
isoStringScalar.serialize(otherDateStr);
}).toThrow(
'GraphQL ISOString Scalar serializer expected a `Date` object or null'
'GraphQL ISOString Scalar serializer expected a `Date` object or null',
);
});
});
Expand All @@ -62,42 +62,42 @@ describe('isoStringScalar', () => {
expect(() => {
isoStringScalar.parseValue(mysqlNullDateStr);
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid EST-explicit String in, error out', async () => {
expect(() => {
isoStringScalar.parseValue(isoESTDateStr);
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid ISO with no TZ String in, error out', async () => {
expect(() => {
isoStringScalar.parseValue(isoNoTzDateStr);
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid MySQL String in, error out', async () => {
expect(() => {
isoStringScalar.parseValue(mysqlDateStr);
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid other string in, error out', async () => {
expect(() => {
isoStringScalar.parseValue(otherDateStr);
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid other data type in, error out', async () => {
expect(() => {
isoStringScalar.parseValue(1234);
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a value of type string or null'
'Invalid User Input: ISOString Scalar parse expected a value of type string or null',
);
});
});
Expand All @@ -124,7 +124,7 @@ describe('isoStringScalar', () => {
value: mysqlNullDateStr,
});
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('valid EST-explicit AST String in, TS Date object out', async () => {
Expand All @@ -134,7 +134,7 @@ describe('isoStringScalar', () => {
value: isoESTDateStr,
});
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid ISO no TZ String in, error out', async () => {
Expand All @@ -144,7 +144,7 @@ describe('isoStringScalar', () => {
value: isoNoTzDateStr,
});
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid MySQL AST String in, error out', async () => {
Expand All @@ -154,7 +154,7 @@ describe('isoStringScalar', () => {
value: mysqlDateStr,
});
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
it('invalid other AST String in, error out', async () => {
Expand All @@ -164,7 +164,7 @@ describe('isoStringScalar', () => {
value: otherDateStr,
});
}).toThrow(
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string'
'Invalid User Input: ISOString Scalar parse expected a UTC-based, ISO-8601-compliant string',
);
});
});
Expand Down
Loading

0 comments on commit 9282782

Please sign in to comment.