From 5e9d4a0f19ee8b0846cd25de70b8dc97998f9adc Mon Sep 17 00:00:00 2001 From: Jake Holland Date: Sat, 30 Nov 2024 14:09:45 +0000 Subject: [PATCH] fix: fix linting issues --- .eslintignore | 1 + .github/workflows/test.yml | 2 +- src/apply.test.ts | 4 ++-- src/diff.ts | 14 +++++++------- src/error.ts | 2 +- src/utils/clone.test.ts | 6 +++--- src/utils/types.ts | 4 ++-- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.eslintignore b/.eslintignore index 8503073..8a9ae7d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,3 +4,4 @@ node_modules dist *.json +vite.config.ts diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9579513..e481da9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "20.x" cache: "pnpm" - name: Install dependencies diff --git a/src/apply.test.ts b/src/apply.test.ts index 62db2f4..06cf957 100644 --- a/src/apply.test.ts +++ b/src/apply.test.ts @@ -243,7 +243,7 @@ describe('Extended Spec', () => { apply(a, [ ['+', '/foo', obj], ['~', '/foo/bar', 'qux'], - ]) + ]), ).toEqual({ foo: { bar: 'qux' } }); expect(obj).toEqual({ bar: 'baz' }); @@ -253,7 +253,7 @@ describe('Extended Spec', () => { '%o -> {}', ([a], { expect }) => { expect(apply(a, [['~', '', {}]])).toEqual({}); - } + }, ); }); }); diff --git a/src/diff.ts b/src/diff.ts index 73d8ec0..3082143 100644 --- a/src/diff.ts +++ b/src/diff.ts @@ -31,7 +31,7 @@ export function diff(input: unknown, output: unknown, ptr: Pointer, opts: DiffOp ...opts, skip, }), - opts + opts, ); } catch (e) { if (e !== SKIP) throw e; @@ -45,7 +45,7 @@ export function diff(input: unknown, output: unknown, ptr: Pointer, opts: DiffOp ...opts, skip, }), - opts + opts, ); } catch (e) { if (e !== SKIP) throw e; @@ -60,7 +60,7 @@ export function diff(input: unknown, output: unknown, ptr: Pointer, opts: DiffOp ...opts, skip, }), - opts + opts, ); } catch (e) { if (e !== SKIP) throw e; @@ -128,10 +128,10 @@ function diffArray(input: Array, output: Array, ptr: Pointer, const outputSize = output.length; const dp: number[][] = Array.from({ length: inputSize + 1 }, () => - Array.from({ length: outputSize + 1 }, () => Infinity) + Array.from({ length: outputSize + 1 }, () => Infinity), ); const ops: (Mini.Op | null)[][] = Array.from({ length: inputSize + 1 }, () => - Array.from({ length: outputSize + 1 }, () => null) + Array.from({ length: outputSize + 1 }, () => null), ); // Base cases @@ -254,7 +254,7 @@ function diffMap( input: Map, output: Map, ptr: Pointer, - opts: WithSkip & { [inputSeen]?: any[]; [outputSeen]?: any[] } + opts: WithSkip & { [inputSeen]?: any[]; [outputSeen]?: any[] }, ): Patch { if (eqMap(input, output, opts)) return []; @@ -298,7 +298,7 @@ function diffObject( input: object, output: object, ptr: Pointer, - opts: WithSkip & { [inputSeen]?: any[]; [outputSeen]?: any[] } + opts: WithSkip & { [inputSeen]?: any[]; [outputSeen]?: any[] }, ): Patch { if (eqObject(input, output, opts)) return []; diff --git a/src/error.ts b/src/error.ts index 4ad77d3..523056b 100644 --- a/src/error.ts +++ b/src/error.ts @@ -15,7 +15,7 @@ export class TestError extends Error { constructor( public actual: unknown, - public expected: unknown + public expected: unknown, ) { super(`Test failed: '${actual}' !== '${expected}'`); } diff --git a/src/utils/clone.test.ts b/src/utils/clone.test.ts index 4051ba9..ed5358b 100644 --- a/src/utils/clone.test.ts +++ b/src/utils/clone.test.ts @@ -6,7 +6,7 @@ describe('primitive', () => { '%s', ([value], { expect }) => { expect(clone(value, {})).toEqual(value); - } + }, ); }); @@ -19,7 +19,7 @@ describe('array', () => { expect(cloned).toEqual(value); // But not in reference expect(cloned).not.toBe(value); - } + }, ); }); @@ -97,7 +97,7 @@ describe('object', () => { expect(cloned).toEqual(value); // But not in reference expect(cloned).not.toBe(value); - } + }, ); }); diff --git a/src/utils/types.ts b/src/utils/types.ts index dea6c24..7392c1c 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -39,7 +39,7 @@ export type Differ = ( input: Exclude, output: Exclude, ptr: Pointer, - opts: WithSkip & O + opts: WithSkip & O, ) => Patch; /** @@ -54,7 +54,7 @@ export type Differ = ( export type EqFunc = ( x: Exclude, y: Exclude, - opts: WithSkip & O + opts: WithSkip & O, ) => boolean; export type WithSkip = T & { skip: SkipFunc };