Skip to content

Commit 8a6d72a

Browse files
committed
chore: resolve lint issues
1 parent e56943e commit 8a6d72a

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

lib/index.spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe("TypeScriptLoader", () => {
4040
try {
4141
cfg.load(path.resolve(fixturesPath, "invalid.fixture.ts"));
4242
fail("Should fail to load invalid TS");
43+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4344
} catch (error: any) {
4445
expect(error?.name).toStrictEqual("TypeScriptCompileError");
4546
}
@@ -72,6 +73,7 @@ describe("TypeScriptLoader", () => {
7273
try {
7374
await cfg.load(path.resolve(fixturesPath, "invalid.fixture.ts"));
7475
fail("Should fail to load invalid TS");
76+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7577
} catch (error: any) {
7678
expect(error?.name).toStrictEqual("TypeScriptCompileError");
7779
}
@@ -104,7 +106,7 @@ describe("TypeScriptLoader", () => {
104106

105107
expect(() =>
106108
cfg.load(path.resolve(fixturesPath, "invalid.fixture.ts")),
107-
).toThrowError();
109+
).toThrow();
108110
});
109111
});
110112
});

lib/loader.spec.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ describe("TypeScriptLoader", () => {
3737

3838
it("should fail on parsing an invalid TS file", () => {
3939
const filePath = path.resolve(fixturesPath, "invalid.fixture.ts");
40-
expect(() => loader(filePath, readFixtureContent(filePath))).toThrowError();
40+
expect((): unknown =>
41+
loader(filePath, readFixtureContent(filePath)),
42+
).toThrow();
4143
});
4244

4345
it("should use the same instance of jiti across multiple calls", () => {
@@ -66,9 +68,9 @@ describe("TypeScriptLoader", () => {
6668

6769
beforeEach(() => {
6870
stub = jest.spyOn(jiti, "default").mockImplementation((() => () => {
69-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
71+
// eslint-disable-next-line @typescript-eslint/only-throw-error
7072
throw unknownError;
71-
}) as any);
73+
}) as never);
7274

7375
loader = TypeScriptLoader();
7476
});

lib/loader.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { TypeScriptCompileError } from "./typescript-compile-error.js";
55

66
export function TypeScriptLoader(options?: JITIOptions): Loader {
77
const loader = jiti("", { interopDefault: true, ...options });
8-
return (path: string) => {
8+
return (path: string): unknown => {
99
try {
10-
const result = loader(path);
10+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11+
const result: { default?: unknown } = loader(path);
1112

1213
// `default` is used when exporting using export default, some modules
1314
// may still use `module.exports` or if in TS `export = `

0 commit comments

Comments
 (0)