Implement automatic two-pass linting when both JS plugins and import plugin are enabled #15881
+328
−31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When both JS-based plugins and the import plugin are enabled on large codebases (10k+ files), oxlint exhausts resources due to architectural conflicts between the two plugin types. Previously required users to manually run two separate lint passes.
Changes
Automatic pass detection and orchestration (
apps/oxlint/src/lint.rs):use_cross_module(import plugin) andhas_external_linter(JS plugins) are trueDiagnosticServicecollects and merges results from both passesrun_two_pass_lint_implstatic method to orchestrate passes without self-borrowing issuesType exports (
apps/oxlint/src/command/mod.rs):FixOptionsandInlineConfigOptionsfor internal two-pass implementationBehavior
Users see combined diagnostics from both passes as a single lint run. Single-plugin configurations unchanged.
Remaining Work
Original prompt
Implement automatic two-pass linting in oxlint when both JS-based plugins and the import plugin are enabled, as described in #15863 and the @copilot instructions.
Context from the maintainer's comment:
Required behavior:
Detect when BOTH of the following are true for a given lint run:
external_linteror equivalent configuration flag for JS-based plugins).In that case, perform linting in two internal passes instead of a single pass, without requiring user intervention:
Implementation notes from the maintainer:
external_lintertoNone(or the relevant configuration mechanism that disables JS plugins) while keeping the rest of the configuration the same.Design and implementation constraints:
oxlintinvocation from the user's perspective:CLI / configuration behavior:
--no-split-js-import-passesor--split-js-import-passes), follow that pattern.Tests:
oxc-project/oxc.Documentation:
Please:
external_linterand the import plugin are wired into the runtime.This pull request was created as a result of the following prompt from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.