Skip to content
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
10 changes: 8 additions & 2 deletions scripts/eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,18 @@ function intersect(files, patterns) {
return [...new Set(intersection)];
}

async function runESLint({onlyChanged, ...options}) {
async function runESLint({onlyChanged, paths, ...options}) {
if (typeof onlyChanged !== 'boolean') {
throw new Error('Pass options.onlyChanged as a boolean.');
}
if (onlyChanged && paths !== undefined) {
throw new Error('Cannot specify paths when onlyChanged is true.');
}
if (paths === undefined || paths.length === 0) {
paths = allPaths;
}
const {errorCount, warningCount, output} = await runESLintOnFilesWithOptions(
allPaths,
paths,
onlyChanged,
options
);
Expand Down
4 changes: 2 additions & 2 deletions scripts/tasks/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ async function main() {
console.log('Hint: run `yarn linc` to only lint changed files.');
}

const {_, ...cliOptions} = minimist(process.argv.slice(2));
const {_: paths, ...cliOptions} = minimist(process.argv.slice(2));

if (await runESLint({onlyChanged: false, ...cliOptions})) {
if (await runESLint({onlyChanged: false, ...cliOptions, paths})) {
console.log('Lint passed.');
} else {
console.log('Lint failed.');
Expand Down
Loading