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