diff --git a/dist/action.mjs b/dist/action.mjs index e98a1ee..e3d167c 100644 --- a/dist/action.mjs +++ b/dist/action.mjs @@ -82,7 +82,7 @@ async function exec(command, args) { resolve(); } else { - reject(new Error(`Command exited with status code ${code}`)); + reject(new Error(`Command exited with status code ${code.toString()}`)); } }); }); @@ -136,7 +136,7 @@ function parse(str) { const args = []; let match; while ((match = regex.exec(str)) !== null) { - args.push(match[1] ?? match[2] ?? match[3] ?? match[4]); + args.push(match[1] || match[2] || match[3] || match[4]); } return args; } diff --git a/eslint.config.js b/eslint.config.js index 3ee43ed..b0ec210 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,9 +1,20 @@ import eslint from "@eslint/js"; +import { globalIgnores } from "eslint/config"; import tseslint from "typescript-eslint"; -export default [ +export default tseslint.config( + globalIgnores(["dist"]), eslint.configs.recommended, - ...tseslint.configs.recommended, - ...tseslint.configs.stylistic, - { ignores: ["dist"] }, -]; + tseslint.configs.strictTypeChecked, + tseslint.configs.stylisticTypeChecked, + { + languageOptions: { + parserOptions: { + projectService: { + allowDefaultProject: ["eslint.config.js", "rollup.config.js"], + }, + tsconfigRootDir: import.meta.dirname, + }, + }, + }, +); diff --git a/src/context.test.ts b/src/context.test.ts index e351818..385c13c 100644 --- a/src/context.test.ts +++ b/src/context.test.ts @@ -183,7 +183,7 @@ describe("get action context", () => { const { getInput } = await import("gha-utils"); const { getContext } = await import("./context.js"); - const inputs = testCase.inputs || {}; + const inputs = testCase.inputs ?? {}; vi.mocked(getInput).mockImplementation((name) => inputs[name] ?? ""); expect(getContext()).toStrictEqual({ diff --git a/src/exec.ts b/src/exec.ts index 2e3e00b..4bb188b 100644 --- a/src/exec.ts +++ b/src/exec.ts @@ -17,11 +17,11 @@ export async function exec(command: string, args: string[]): Promise { }); logCommand(proc.spawnfile, ...proc.spawnargs.splice(1)); proc.on("error", reject); - proc.on("close", (code) => { + proc.on("close", (code: number) => { if (code === 0) { resolve(); } else { - reject(new Error(`Command exited with status code ${code}`)); + reject(new Error(`Command exited with status code ${code.toString()}`)); } }); }); diff --git a/src/utils.ts b/src/utils.ts index efa4463..1e6001a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -12,7 +12,7 @@ export function parse(str: string): string[] { const args: string[] = []; let match: RegExpExecArray | null; while ((match = regex.exec(str)) !== null) { - args.push(match[1] ?? match[2] ?? match[3] ?? match[4]); + args.push(match[1] || match[2] || match[3] || match[4]); } return args; }