Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 15, 2023
1 parent f9b6296 commit c58699b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/proxy/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function literalToAst(value: any): ESNode {
}
if (value === null) {
// eslint-disable-next-line unicorn/no-null
return recast.types.builders.literal(null) as any;
return recast.types.builders.literal(null) as any;
}
if (Array.isArray(value)) {
return recast.types.builders.arrayExpression(
Expand Down
22 changes: 11 additions & 11 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import { describe, it, expect } from "vitest";
import { print } from "recast";
import { literalToAst } from "../src/proxy/_utils";

describe('literalToAst', () => {
describe("literalToAst", () => {
// eslint-disable-next-line unicorn/consistent-function-scoping
function run(value: any) {
return print(literalToAst(value)).code;
}
it('should work', () => {
expect(run(1)).toMatchInlineSnapshot('"1"')
expect(run(true)).toMatchInlineSnapshot('"true"')
expect(run(undefined)).toMatchInlineSnapshot('"undefined"')

it("should work", () => {
expect(run(1)).toMatchInlineSnapshot('"1"');
expect(run(true)).toMatchInlineSnapshot('"true"');
expect(run(undefined)).toMatchInlineSnapshot('"undefined"');
// eslint-disable-next-line unicorn/no-null
expect(run(null)).toMatchInlineSnapshot('"null"')
expect(run([undefined, 1, { foo:'bar' }])).toMatchInlineSnapshot(`
expect(run(null)).toMatchInlineSnapshot('"null"');
expect(run([undefined, 1, { foo: "bar" }])).toMatchInlineSnapshot(`
"[undefined, 1, {
foo: \\"bar\\"
}]"
`)
})
})
`);
});
});

0 comments on commit c58699b

Please sign in to comment.