mirror of
https://github.com/threeal/cmake-action.git
synced 2025-07-25 15:24:22 +00:00
test: enable strict TypeScript ESLint configuration
Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
This commit is contained in:
parent
54f1f8eb66
commit
09c0693d6c
4
dist/action.mjs
generated
vendored
4
dist/action.mjs
generated
vendored
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
@ -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({
|
||||
|
@ -17,11 +17,11 @@ export async function exec(command: string, args: string[]): Promise<void> {
|
||||
});
|
||||
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()}`));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user