mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Pass extra CLI args through to ESLint (#20250)
These now work: ``` yarn run lint --fix yarn run linc --fix ```
This commit is contained in:
@@ -64,13 +64,14 @@ function intersect(files, patterns) {
|
||||
return [...new Set(intersection)];
|
||||
}
|
||||
|
||||
function runESLint({onlyChanged}) {
|
||||
function runESLint({onlyChanged, ...options}) {
|
||||
if (typeof onlyChanged !== 'boolean') {
|
||||
throw new Error('Pass options.onlyChanged as a boolean.');
|
||||
}
|
||||
const {errorCount, warningCount, output} = runESLintOnFilesWithOptions(
|
||||
allPaths,
|
||||
onlyChanged
|
||||
onlyChanged,
|
||||
options
|
||||
);
|
||||
console.log(output);
|
||||
return errorCount === 0 && warningCount === 0;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const minimist = require('minimist');
|
||||
const runESLint = require('../eslint');
|
||||
|
||||
console.log('Linting all files...');
|
||||
@@ -15,7 +16,8 @@ if (!process.env.CI) {
|
||||
console.log('Hint: run `yarn linc` to only lint changed files.');
|
||||
}
|
||||
|
||||
if (runESLint({onlyChanged: false})) {
|
||||
const cliOptions = minimist(process.argv.slice(2));
|
||||
if (runESLint({onlyChanged: false, ...cliOptions})) {
|
||||
console.log('Lint passed.');
|
||||
} else {
|
||||
console.log('Lint failed.');
|
||||
|
||||
@@ -7,11 +7,13 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const minimist = require('minimist');
|
||||
const runESLint = require('../eslint');
|
||||
|
||||
console.log('Linting changed files...');
|
||||
|
||||
if (runESLint({onlyChanged: true})) {
|
||||
const cliOptions = minimist(process.argv.slice(2));
|
||||
if (runESLint({onlyChanged: true, ...cliOptions})) {
|
||||
console.log('Lint passed for changed files.');
|
||||
} else {
|
||||
console.log('Lint failed for changed files.');
|
||||
|
||||
Reference in New Issue
Block a user