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.
master^2
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
"oxc.enable": true,
"oxc.typeAware": true,
"oxc.typeAware": false,
"oxc.configPath": "oxlint.config.ts",
"oxc.fmt.configPath": "oxfmt.config.ts",
"eslint.useFlatConfig": true,

View File

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