|
|
|
@ -7,10 +7,15 @@ interface LintCommandOptions { |
|
|
|
* Format lint problem. |
|
|
|
*/ |
|
|
|
format?: boolean; |
|
|
|
/** |
|
|
|
* Number of threads for oxlint (default: system CPU count). |
|
|
|
*/ |
|
|
|
threads?: number; |
|
|
|
} |
|
|
|
|
|
|
|
async function runLint({ format }: LintCommandOptions) { |
|
|
|
async function runLint({ format, threads }: LintCommandOptions) { |
|
|
|
// process.env.FORCE_COLOR = '3';
|
|
|
|
const threadsArg = threads ? ` --threads=${threads}` : ''; |
|
|
|
|
|
|
|
if (format) { |
|
|
|
await execaCommand(`stylelint "**/*.{vue,css,less,scss}" --cache --fix`, { |
|
|
|
@ -19,7 +24,7 @@ async function runLint({ format }: LintCommandOptions) { |
|
|
|
await execaCommand(`oxfmt`, { |
|
|
|
stdio: 'inherit', |
|
|
|
}); |
|
|
|
await execaCommand(`oxlint --fix`, { |
|
|
|
await execaCommand(`oxlint --fix${threadsArg}`, { |
|
|
|
stdio: 'inherit', |
|
|
|
}); |
|
|
|
await execaCommand(`eslint . --cache --fix`, { |
|
|
|
@ -31,7 +36,7 @@ async function runLint({ format }: LintCommandOptions) { |
|
|
|
execaCommand(`oxfmt --check`, { |
|
|
|
stdio: 'inherit', |
|
|
|
}), |
|
|
|
execaCommand(`oxlint`, { |
|
|
|
execaCommand(`oxlint${threadsArg}`, { |
|
|
|
stdio: 'inherit', |
|
|
|
}), |
|
|
|
execaCommand(`eslint . --cache`, { |
|
|
|
@ -48,6 +53,7 @@ function defineLintCommand(cac: CAC) { |
|
|
|
.command('lint') |
|
|
|
.usage('Batch execute project lint check.') |
|
|
|
.option('--format', 'Format lint problem.') |
|
|
|
.option('--threads <count>', 'Number of threads for oxlint.') |
|
|
|
.action(runLint); |
|
|
|
} |
|
|
|
|
|
|
|
|