Repository navigation
style: let Oxfmt own import order - #2186
Merged
Merged
Conversation
koistya
force-pushed
the
style/oxfmt-sort-imports
branch
from
September 12, 2026 13:00
d24a7d3 to
4e91c44
Compare
Import order was owned by `source.organizeImports` in `.vscode/settings.json`: applied per developer, only to files someone opened in VS Code, and never checked in CI. `sortImports` in `.oxfmtrc.json` hands it to a tool that already runs over every file in `bun run format`, in CI and in the pre-commit hook. Defaults only. Side-effect imports keep their position, so `db/scripts/seed.ts` still loads `../drizzle.config` last, and `#*` subpath imports stay in their own group instead of merging with `@repo/*` packages. ADR-007 records why. The editor action also deleted unused imports on save, which Oxfmt does not do. `no-unused-vars` still fails CI on one, so it surfaces at commit or CI time instead, with the removal visible in the diff. Everything outside the five config/doc files is `bun run format` output.
koistya
force-pushed
the
style/oxfmt-sort-imports
branch
from
September 12, 2026 13:40
4e91c44 to
4052cc3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Import order was owned by
"source.organizeImports": "explicit"in.vscode/settings.json– applied per developer, only to files someone happened to open in VS Code, never checked in CI. The drift was real rather than stylistic:apps/api/lib/app.tswas sorted because someone edited it, whilepackages/ui/components/button.tsxhadreactout of order because it is shadcn CLI output nobody touched. Oxfmt already formats every file it owns inbun run format, checks them in CI, and checks the staged ones on commit, so moving import order there adds no dependency and no extra pass.Changes
.oxfmtrc.json"sortImports": true– defaults, nothing else.vscode/settings.jsonsource.organizeImports;editor.defaultFormatteris alreadyoxc.oxc-vscode, so format-on-save still sortsAGENTS.mddocs/adr/007-oxfmt-sorts-imports.mddocs/adr/005-oxlint-oxfmt.mdbun run formatoutput, nothing hand-editedTwo defaults are load-bearing and deliberately not overridden:
sortSideEffectsoff –db/scripts/seed.tskeepsimport "../drizzle.config"last, loading env vars before anything readsDATABASE_URL. Checked by hand in all four files where a side-effect import's position matters.internalPatternuntouched (["~/", "@/", "#"]) – keeps@repo/*with the externals and#*in its own group, the distinction ADR-006 draws between another package and this package's own file.Trade-off
source.organizeImportsalso deleted unused imports on save; Oxfmt does not.no-unused-varsstill fails CI on one, so nothing slips through – it surfaces at commit or CI time instead of silently on save, with the removal visible in the diff.Updating a fork
Sync with the
/merge-seedskill as usual. Two things are specific to this change:bun run formatand let Oxfmt settle import order for both sides. Taking either side wholesale to clear import-order noise drops imports the other side added.007.Verification
bun run format:check·bun lint·bun typecheck·bun run test -- --run(93 passed) ·bun run build(4 workspaces) – all clean on the final tree.Risk
A tree-wide reflow conflicts with anything in flight; rebase open branches right after this lands.
Follow-up to #2184 (TypeScript 7 + Oxc), split out because at 74 files it would have buried that PR's substance.