Skip to content

Commit

Permalink
Run eslint from node_modules/.bin rather than node_modules/eslint/bin
Browse files Browse the repository at this point in the history
Rationale:
- `npm install`, `yarn` and `lerna` all fill out `node_modules/.bin`
- But `node_modules/eslint` isn't necessarily present.
- This should fix issue google#490.
  • Loading branch information
richardbarrell-calvium committed Jul 16, 2021
1 parent aa6329b commit c2a5da7
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export async function run(verb: string, files: string[]): Promise<boolean> {
case 'lint':
case 'check': {
try {
await execa('node', ['./node_modules/eslint/bin/eslint', ...flags], {
await execa('node_modules/.bin/eslint', flags, {
stdio: 'inherit',
});
return true;
Expand All @@ -156,13 +156,9 @@ export async function run(verb: string, files: string[]): Promise<boolean> {
case 'fix': {
const fixFlag = options.dryRun ? '--fix-dry-run' : '--fix';
try {
await execa(
'node',
['./node_modules/eslint/bin/eslint', fixFlag, ...flags],
{
stdio: 'inherit',
}
);
await execa('node_modules/.bin/eslint', [fixFlag, ...flags], {
stdio: 'inherit',
});
return true;
} catch (e) {
console.error(e);
Expand Down

0 comments on commit c2a5da7

Please sign in to comment.