Repository navigation
Vite+ with .oxlintrc.json / .oxfmtrc.json: keeping the CLI and the editor in sync
#3120
Closed
dorukozerr
started this conversation in
Ideas
Replies: 1 comment 4 replies
|
If I recall correctly, even in coc-oxc version 0.0.4 and later, it was changed to run https://github.com/oxc-project/coc-oxc/releases#release-v0.4.0 |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
A workaround for a Vite+ project where
vp lint/vp fmtread their config fromvite.config.ts, while an editor integration (here: Vim +coc-oxc) runs the Oxc language server and finds the config through the standalone Oxc config files.Vite+ wants lint and format config inside
vite.config.ts:As mentioned in other places
vp lint/fmtcommands skips the config files and uses eithervite.config.tslint/fmt configuration blocks or default settings. I found the vscode configuration for makin oxfmt usevite.config.tsfmt settings but I'm using coc-oxc and there was no option for this, also its likely that I couldn't translate that configurationI saw multiple issues mentioning oxc config file skipping problem directly or indirectly
#2698
#826
PR #2483 for #2430
#3065
#3089
PR #2995
The workaround
This is just my temporary workaround for the
vpr fmt/lintand editor auto format + lint mismatches, I'm not even exactly sure about is this issue already solved or not, I mean I saw the .vscode configuration for using vite.config.ts for oxc.fmt.configPath.Keep
.oxlintrc.jsonand.oxfmtrc.jsonas the only source of truth, then read and parse them insidevite.config.tsand pass the result to thelintandfmtblocks.coc-oxc/ Oxc language server) finds.oxlintrc.json/.oxfmtrc.jsonthrough normal discovery. These files win overvite.config.tsin the editor anyway.vp lint/vp fmt/vp check/vp stagedreadvite.config.ts, which now holds the same objects.Files
vite.config.tspackage.jsonscriptsThe scripts keep using the Vite+ commands. They pick the config up through
vite.config.ts:{ "scripts": { "fmt": "vp fmt --check", "fmt:fix": "vp fmt", "lint": "vp lint", "lint:fix": "vp lint --fix", "type-check": "tsc --noEmit", "pre-commit": "vpr fmt && vpr fix && vpr type-check" } }All reactions