Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update eslint packages #726

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default [
...withStyles(),
...configs.license['MPL-2.0'](),
{
ignores: ['node_modules', 'dist', 'reports', 'eslint.config.js', 'generic-type-guard.*'],
ignores: ['node_modules', 'dist', 'reports', 'eslint.config.js', 'generic-type-guard.*', '.stryker-tmp'],
},
{
files: ['*.config.js'],
Expand Down
14 changes: 4 additions & 10 deletions etc/generic-type-guard.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const hasOnlyProperties: <V extends object>(props: MappedTypeGuard<V>) =>
export const hasOptionalProperties: <V extends object>(props: MappedTypeGuard<V>) => PartialTypeGuard<object, Partial<V>>;

// @public
export const hasOptionalProperty: <K extends string, V>(property: K, value: TypeGuard<V>) => PartialTypeGuard<object, { [prop in K]?: V; }>;
export const hasOptionalProperty: <K extends string, V>(property: K, value: TypeGuard<V>) => PartialTypeGuard<object, Partial<Record<K, V>>>;

// @public
export const hasProperties: <V extends object>(props: MappedTypeGuard<V>) => PartialTypeGuard<object, V>;
Expand All @@ -55,13 +55,9 @@ export interface InterfaceBuilder<T extends object> {
with: <V extends object>(ptv: PartialTypeGuard<object, V>) => InterfaceBuilder<T & V>;
withNumericIndexSignature: <V>(value: TypeGuard<V>, enforce?: boolean) => InterfaceBuilder<T & Record<number, V>>;
withOptionalProperties: <V extends object>(props: MappedTypeGuard<V>) => InterfaceBuilder<T & Partial<V>>;
withOptionalProperty: <K extends string, V>(key: K, ptv: TypeGuard<V>) => InterfaceBuilder<T & {
[prop in K]?: V;
}>;
withOptionalProperty: <K extends string, V>(key: K, ptv: TypeGuard<V>) => InterfaceBuilder<T & Partial<Record<K, V>>>;
withProperties: <V extends object>(props: MappedTypeGuard<V>) => InterfaceBuilder<T & V>;
withProperty: <K extends string, V>(key: K, ptv: TypeGuard<V>) => InterfaceBuilder<T & {
[prop in K]: V;
}>;
withProperty: <K extends string, V>(key: K, ptv: TypeGuard<V>) => InterfaceBuilder<T & Record<K, V>>;
withStringIndexSignature: <V>(value: TypeGuard<V>, enforce?: boolean) => InterfaceBuilder<T & Record<string, V>>;
}

Expand Down Expand Up @@ -116,9 +112,7 @@ export class IsInterface implements InterfaceBuilder<object> {
// (undocumented)
withOptionalProperties<V extends object>(props: MappedTypeGuard<V>): InterfaceBuilder<object & Partial<V>>;
// (undocumented)
withOptionalProperty<K extends string, V>(key: K, ptv: TypeGuard<V>): InterfaceBuilder<object & {
[prop in K]?: V;
}>;
withOptionalProperty<K extends string, V>(key: K, ptv: TypeGuard<V>): InterfaceBuilder<object & Partial<Record<K, V>>>;
// (undocumented)
withProperties<V extends object>(props: MappedTypeGuard<V>): InterfaceBuilder<object & V>;
// (undocumented)
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default {
// ],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/__utils__/', '/examples/'],
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/__utils__/', '/examples/', `${process.cwd()}/.stryker-tmp/`],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"@changesets/cli": "2.27.9",
"@jest/globals": "29.7.0",
"@microsoft/api-extractor": "7.47.11",
"@mscharley/eslint-config": "4.0.7",
"@mscharley/prettier-config": "3.0.7",
"@mscharley/eslint-config": "4.1.0",
"@mscharley/prettier-config": "3.1.0",
"@stryker-mutator/core": "8.6.0",
"@stryker-mutator/jest-runner": "8.6.0",
"@stryker-mutator/typescript-checker": "8.6.0",
Expand Down
334 changes: 211 additions & 123 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/combinators/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ export interface InterfaceBuilder<T extends object> {
* @param key - The string key of the property.
* @param ptv - The type guard for this property.
*/
withProperty: <K extends string, V>(key: K, ptv: TypeGuard<V>) => InterfaceBuilder<T & { [prop in K]: V }>;
withProperty: <K extends string, V>(key: K, ptv: TypeGuard<V>) => InterfaceBuilder<T & Record<K, V>>;

/**
* Add a single optional property to the interface.
*
* @param key - The string key of the property.
* @param ptv - The type guard for this property.
*/
withOptionalProperty: <K extends string, V>(key: K, ptv: TypeGuard<V>) => InterfaceBuilder<T & { [prop in K]?: V }>;
withOptionalProperty: <K extends string, V>(key: K, ptv: TypeGuard<V>) => InterfaceBuilder<T & Partial<Record<K, V>>>;

/**
* Add a string index signature to the interface.
Expand Down Expand Up @@ -101,7 +101,7 @@ class InterfaceStep<T extends object> implements InterfaceBuilder<T> {
public withOptionalProperty<K extends string, V>(
key: K,
ptv: TypeGuard<V>,
): InterfaceBuilder<T & { [prop in K]?: V }> {
): InterfaceBuilder<T & Partial<Record<K, V>>> {
return new InterfaceStep(isIntersection(this.ptt, o.hasOptionalProperty(key, ptv)));
}

Expand Down Expand Up @@ -143,7 +143,7 @@ export class IsInterface implements InterfaceBuilder<object> {
public withOptionalProperty<K extends string, V>(
key: K,
ptv: TypeGuard<V>,
): InterfaceBuilder<object & { [prop in K]?: V }> {
): InterfaceBuilder<object & Partial<Record<K, V>>> {
return new InterfaceStep(o.hasOptionalProperty(key, ptv));
}

Expand Down
8 changes: 4 additions & 4 deletions src/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { isObject } from './primitives.js';
*/
export const hasProperty
= <K extends string, V>(property: K, value: TypeGuard<V>): PartialTypeGuard<object, Record<K, V>> =>
(o: object): o is { [prop in K]: V } =>
(o: object): o is Record<K, V> =>
// If the property exists and conforms to the value type guard.
value((o as Record<string, unknown>)[property]);

Expand All @@ -25,8 +25,8 @@ export const hasProperty
* @public
*/
export const hasOptionalProperty
= <K extends string, V>(property: K, value: TypeGuard<V>): PartialTypeGuard<object, { [prop in K]?: V }> =>
(o: object): o is { [prop in K]: V } =>
= <K extends string, V>(property: K, value: TypeGuard<V>): PartialTypeGuard<object, Partial<Record<K, V>>> =>
(o: object): o is Partial<Record<K, V>> =>
!(property in o)
// If the property exists and conforms to the value type guard.
|| value((o as Record<string, unknown>)[property]);
Expand All @@ -40,7 +40,7 @@ export const hasOptionalProperty
*/
export const isRecord
= <K extends string, V>(property: K, value: TypeGuard<V>): TypeGuard<Record<K, V>> =>
(o: unknown): o is { [prop in K]: V } =>
(o: unknown): o is Record<K, V> =>
isObject(o) && hasProperty(property, value)(o);

/**
Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://turbo.build/schema.json",
"globalPassThroughEnv": ["ASDF_*"],
"daemon": false,
"tasks": {
"build": {
"dependsOn": ["build:tsc", "build:api", "build:esbuild:cjs", "build:esbuild:esm"]
Expand Down