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) {
72
72
return [ ...new Set ( intersection ) ] ;
73
73
}
74
74
75
- async function runESLint ( { onlyChanged, ...options } ) {
75
+ async function runESLint ( { onlyChanged, paths , ...options } ) {
76
76
if ( typeof onlyChanged !== 'boolean' ) {
77
77
throw new Error ( 'Pass options.onlyChanged as a boolean.' ) ;
78
78
}
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
+ }
79
85
const { errorCount, warningCount, output} = await runESLintOnFilesWithOptions (
80
- allPaths ,
86
+ paths ,
81
87
onlyChanged ,
82
88
options
83
89
) ;
Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ async function main() {
16
16
console . log ( 'Hint: run `yarn linc` to only lint changed files.' ) ;
17
17
}
18
18
19
- const { _, ...cliOptions } = minimist ( process . argv . slice ( 2 ) ) ;
19
+ const { _ : paths , ...cliOptions } = minimist ( process . argv . slice ( 2 ) ) ;
20
20
21
- if ( await runESLint ( { onlyChanged : false , ...cliOptions } ) ) {
21
+ if ( await runESLint ( { onlyChanged : false , ...cliOptions , paths } ) ) {
22
22
console . log ( 'Lint passed.' ) ;
23
23
} else {
24
24
console . log ( 'Lint failed.' ) ;
You can’t perform that action at this time.
0 commit comments