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.
pull/348/MERGE
xingyu4j 2026-05-18 18:46:13 +08:00
parent 5c8dd1a6da
commit 7c943cc06b
2 changed files with 10 additions and 4 deletions

View File

@ -38,7 +38,7 @@
// lint && format // lint && format
"oxc.enable": true, "oxc.enable": true,
"oxc.typeAware": true, "oxc.typeAware": false,
"oxc.configPath": "oxlint.config.ts", "oxc.configPath": "oxlint.config.ts",
"oxc.fmt.configPath": "oxfmt.config.ts", "oxc.fmt.configPath": "oxfmt.config.ts",
"eslint.useFlatConfig": true, "eslint.useFlatConfig": true,

View File

@ -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);
} }