Skip to content

Commit

Permalink
fix: fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hollandjake committed Nov 30, 2024
1 parent d9fc2a4 commit 5e9d4a0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
dist

*.json
vite.config.ts
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/apply.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ describe('Extended Spec', () => {
apply(a, [
['+', '/foo', obj],
['~', '/foo/bar', 'qux'],
])
]),
).toEqual({ foo: { bar: 'qux' } });

expect(obj).toEqual({ bar: 'baz' });
Expand All @@ -253,7 +253,7 @@ describe('Extended Spec', () => {
'%o -> {}',
([a], { expect }) => {
expect(apply(a, [['~', '', {}]])).toEqual({});
}
},
);
});
});
14 changes: 7 additions & 7 deletions src/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -128,10 +128,10 @@ function diffArray(input: Array<unknown>, output: Array<unknown>, 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
Expand Down Expand Up @@ -254,7 +254,7 @@ function diffMap(
input: Map<any, any>,
output: Map<any, any>,
ptr: Pointer,
opts: WithSkip<DiffOpts> & { [inputSeen]?: any[]; [outputSeen]?: any[] }
opts: WithSkip<DiffOpts> & { [inputSeen]?: any[]; [outputSeen]?: any[] },
): Patch {
if (eqMap(input, output, opts)) return [];

Expand Down Expand Up @@ -298,7 +298,7 @@ function diffObject(
input: object,
output: object,
ptr: Pointer,
opts: WithSkip<DiffOpts> & { [inputSeen]?: any[]; [outputSeen]?: any[] }
opts: WithSkip<DiffOpts> & { [inputSeen]?: any[]; [outputSeen]?: any[] },
): Patch {
if (eqObject(input, output, opts)) return [];

Expand Down
2 changes: 1 addition & 1 deletion src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class TestError extends Error {

constructor(
public actual: unknown,
public expected: unknown
public expected: unknown,
) {
super(`Test failed: '${actual}' !== '${expected}'`);
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/clone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('primitive', () => {
'%s',
([value], { expect }) => {
expect(clone(value, {})).toEqual(value);
}
},
);
});

Expand All @@ -19,7 +19,7 @@ describe('array', () => {
expect(cloned).toEqual(value);
// But not in reference
expect(cloned).not.toBe(value);
}
},
);
});

Expand Down Expand Up @@ -97,7 +97,7 @@ describe('object', () => {
expect(cloned).toEqual(value);
// But not in reference
expect(cloned).not.toBe(value);
}
},
);
});

Expand Down
4 changes: 2 additions & 2 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type Differ<O extends object = {}> = (
input: Exclude<any, null | undefined>,
output: Exclude<any, null | undefined>,
ptr: Pointer,
opts: WithSkip<DiffOpts> & O
opts: WithSkip<DiffOpts> & O,
) => Patch;

/**
Expand All @@ -54,7 +54,7 @@ export type Differ<O extends object = {}> = (
export type EqFunc<O extends object = {}> = (
x: Exclude<any, null | undefined>,
y: Exclude<any, null | undefined>,
opts: WithSkip<EqOpts> & O
opts: WithSkip<EqOpts> & O,
) => boolean;

export type WithSkip<T> = T & { skip: SkipFunc };

0 comments on commit 5e9d4a0

Please sign in to comment.