You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR addresses the import ordering violations identified in #12723 by
fixing import ordering across key files in the codebase to follow the
updated Oxc convention.
## Import Ordering Convention
The correct order is:
1. `std` imports
2. External crates
3. Oxc crates (starting with `oxc_`)
4. Local crate (`crate`)
5. `super`
6. `mod`
With line breaks between each category.
## Key Principle: Source Priority
Imports should be imported from the closest available source:
- Prefer to `use` from a local `mod` over `super` or `crate`
- Prefer to `use` from `super` over `crate`
This ensures we don't lose information about module structure and
maintain the most direct import paths.
## Changes Made
Fixed import ordering violations in 11 files based on comprehensive code
review feedback, ensuring all rules from #12723 are properly applied:
### Core Applications
- `apps/oxlint/src/lib.rs` - Fixed pub use positioning and
mod-before-use rule compliance
- `apps/oxlint/src/tester.rs` - Added required line break after imports
### Core Crates
- `crates/oxc_language_server/src/main.rs` - Moved mod statements before
related use statements
- `crates/oxc_transformer/src/options/es_features.rs` - Added required
line break after imports
- Additional fixes in codegen, formatter, linter, and minifier crates
## Repository-Wide Analysis
Comprehensive analysis revealed 890+ additional files with import
ordering violations. However, automated fixing proved challenging due
to:
- Complex multi-line `use` statements with braces
- Relative imports within crate modules requiring careful handling
- Risk of breaking builds with overly aggressive automation
## Verification
- All changes maintain proper `rustfmt` compatibility
- Comprehensive build verification confirms all packages compile
successfully
- Source priority preserved - local module imports maintained over crate
imports where appropriate
- All tests pass with the updated import ordering
This represents the first phase of addressing #12723, with remaining
violations requiring careful manual review or enhanced tooling.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com>
0 commit comments