File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -72,12 +72,18 @@ function intersect(files, patterns) {
7272 return [ ...new Set ( intersection ) ] ;
7373}
7474
75- async function runESLint ( { onlyChanged, ...options } ) {
75+ async function runESLint ( { onlyChanged, paths , ...options } ) {
7676 if ( typeof onlyChanged !== 'boolean' ) {
7777 throw new Error ( 'Pass options.onlyChanged as a boolean.' ) ;
7878 }
79+ if ( onlyChanged && paths !== undefined ) {
80+ throw new Error ( 'Cannot specify paths when onlyChanged is true.' ) ;
81+ }
82+ if ( paths === undefined || paths . length === 0 ) {
83+ paths = allPaths ;
84+ }
7985 const { errorCount, warningCount, output} = await runESLintOnFilesWithOptions (
80- allPaths ,
86+ paths ,
8187 onlyChanged ,
8288 options
8389 ) ;
Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ async function main() {
1616 console . log ( 'Hint: run `yarn linc` to only lint changed files.' ) ;
1717 }
1818
19- const { _, ...cliOptions } = minimist ( process . argv . slice ( 2 ) ) ;
19+ const { _ : paths , ...cliOptions } = minimist ( process . argv . slice ( 2 ) ) ;
2020
21- if ( await runESLint ( { onlyChanged : false , ...cliOptions } ) ) {
21+ if ( await runESLint ( { onlyChanged : false , ...cliOptions , paths } ) ) {
2222 console . log ( 'Lint passed.' ) ;
2323 } else {
2424 console . log ( 'Lint failed.' ) ;
You can’t perform that action at this time.
0 commit comments