mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-03 21:33:42 +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();
 | 
					                resolve();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else {
 | 
					            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 = [];
 | 
					    const args = [];
 | 
				
			||||||
    let match;
 | 
					    let match;
 | 
				
			||||||
    while ((match = regex.exec(str)) !== 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;
 | 
					    return args;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,9 +1,20 @@
 | 
				
			|||||||
import eslint from "@eslint/js";
 | 
					import eslint from "@eslint/js";
 | 
				
			||||||
 | 
					import { globalIgnores } from "eslint/config";
 | 
				
			||||||
import tseslint from "typescript-eslint";
 | 
					import tseslint from "typescript-eslint";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default [
 | 
					export default tseslint.config(
 | 
				
			||||||
 | 
					  globalIgnores(["dist"]),
 | 
				
			||||||
  eslint.configs.recommended,
 | 
					  eslint.configs.recommended,
 | 
				
			||||||
  ...tseslint.configs.recommended,
 | 
					  tseslint.configs.strictTypeChecked,
 | 
				
			||||||
  ...tseslint.configs.stylistic,
 | 
					  tseslint.configs.stylisticTypeChecked,
 | 
				
			||||||
  { ignores: ["dist"] },
 | 
					  {
 | 
				
			||||||
];
 | 
					    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 { getInput } = await import("gha-utils");
 | 
				
			||||||
      const { getContext } = await import("./context.js");
 | 
					      const { getContext } = await import("./context.js");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const inputs = testCase.inputs || {};
 | 
					      const inputs = testCase.inputs ?? {};
 | 
				
			||||||
      vi.mocked(getInput).mockImplementation((name) => inputs[name] ?? "");
 | 
					      vi.mocked(getInput).mockImplementation((name) => inputs[name] ?? "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(getContext()).toStrictEqual({
 | 
					      expect(getContext()).toStrictEqual({
 | 
				
			||||||
 | 
				
			|||||||
@ -17,11 +17,11 @@ export async function exec(command: string, args: string[]): Promise<void> {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
    logCommand(proc.spawnfile, ...proc.spawnargs.splice(1));
 | 
					    logCommand(proc.spawnfile, ...proc.spawnargs.splice(1));
 | 
				
			||||||
    proc.on("error", reject);
 | 
					    proc.on("error", reject);
 | 
				
			||||||
    proc.on("close", (code) => {
 | 
					    proc.on("close", (code: number) => {
 | 
				
			||||||
      if (code === 0) {
 | 
					      if (code === 0) {
 | 
				
			||||||
        resolve();
 | 
					        resolve();
 | 
				
			||||||
      } else {
 | 
					      } 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[] = [];
 | 
					  const args: string[] = [];
 | 
				
			||||||
  let match: RegExpExecArray | null;
 | 
					  let match: RegExpExecArray | null;
 | 
				
			||||||
  while ((match = regex.exec(str)) !== 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;
 | 
					  return args;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user