Skip to content

Commit

Permalink
Add root-dir option
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Jul 16, 2023
1 parent c1e8620 commit 3cb3ba9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ inputs:
description: Enable or disable annotations
required: false
default: true
bin-path:
description: Path to eslint installation directory. Defaults to `node_modules/eslint/bin`
root-dir:
description: Path to project containing npm/yarn installation
required: false
default: node_modules/eslint/bin
default: ''
6 changes: 3 additions & 3 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.

7 changes: 4 additions & 3 deletions src/eslint.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import fs from 'node:fs';
import path from 'node:path';
import ignore from 'ignore';

import { notice, startGroup, endGroup, info } from '@actions/core';
import { exec } from '@actions/exec';
import ignore from 'ignore';

import { disableAnnotations } from './annotations';
import getChangedFiles from './get-changed-files';
Expand All @@ -11,7 +12,7 @@ export interface Inputs {
token: string;
annotations: boolean;
eslintArgs: string[];
binPath: string;
rootDir: string;
extensions: string[];
}

Expand Down Expand Up @@ -49,7 +50,7 @@ export const runEslint = async (inputs: Inputs): Promise<void> => {
endGroup();

const execOptions = [
path.resolve(inputs.binPath, 'eslint'),
path.resolve(inputs.rootDir, 'node_modules/.bin/eslint'),
...files,
...inputs.eslintArgs,
].filter(Boolean);
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const run = async ():Promise<void> => {
token: getInput('github-token', { required: true }),
annotations: getBooleanInput('annotations'),
eslintArgs: getInput('eslint-args').split(' '),
binPath: getInput('bin-path'),
rootDir: getInput('root-dir'),
extensions: getInput('extensions').split(',').map((ext) => ext.trim()),
};

Expand Down

0 comments on commit 3cb3ba9

Please sign in to comment.