From 7c943cc06bbd60cf2034d24f05c02dcb87ab58d8 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Mon, 18 May 2026 18:46:13 +0800 Subject: [PATCH] chore: disable oxc typeAware and add --threads option for oxlint Type-aware linting was consuming excessive memory with nearly all type-aware rules turned off. Add --threads CLI option to control oxlint parallelism. --- .vscode/settings.json | 2 +- scripts/vsh/src/lint/index.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 993b52039..ff13cfa9c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,7 +38,7 @@ // lint && format "oxc.enable": true, - "oxc.typeAware": true, + "oxc.typeAware": false, "oxc.configPath": "oxlint.config.ts", "oxc.fmt.configPath": "oxfmt.config.ts", "eslint.useFlatConfig": true, diff --git a/scripts/vsh/src/lint/index.ts b/scripts/vsh/src/lint/index.ts index 4fc165c95..e79ff87a4 100644 --- a/scripts/vsh/src/lint/index.ts +++ b/scripts/vsh/src/lint/index.ts @@ -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 ', 'Number of threads for oxlint.') .action(runLint); }