Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for using npx instead of hardlinked eslint command #15

Merged
merged 6 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ inputs:
description: Run eslint on all files.
required: false
default: false
use-npx:
description: Enable or disable using npx instead of node node_modules/.bin/eslint
required: false
default: false
5 changes: 3 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const runEslint = async (): Promise<void> => {
const eslintArgs = getEslintArgs();

const execOptions = [
path.resolve(inputs.workingDirectory, 'node_modules/.bin/eslint'),
inputs.useNpx ? 'eslint' : path.resolve(inputs.workingDirectory, 'node_modules/.bin/eslint'),
...files,
...eslintArgs,
].filter(Boolean);

await exec('node', execOptions);
await exec(inputs.useNpx ? 'npx' : 'node', execOptions);
};
1 change: 1 addition & 0 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const inputs: Inputs = {
ignorePath: getInput('ignore-path'),
ignorePatterns: getMultilineInput('ignore-patterns'),
allFiles: getBooleanInput('all-files'),
useNpx: getBooleanInput('use-npx'),
};

export default inputs;
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface Inputs {
ignorePath: string;
ignorePatterns: string[];
allFiles: boolean;
useNpx: boolean;
}

export type FileNamesList = string[];
Expand Down