-
-
Notifications
You must be signed in to change notification settings - Fork 228
chore: setup oxfmt for formatting #997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: hi-ogawa <4232207+hi-ogawa@users.noreply.github.com>
Co-authored-by: hi-ogawa <4232207+hi-ogawa@users.noreply.github.com>
Co-authored-by: hi-ogawa <4232207+hi-ogawa@users.noreply.github.com>
ArnaudBarre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import sorting is way better, but still a lot of diff that could be avoided by keeping node builtins first
| import { readFileSync } from 'node:fs' | ||
| import { dirname, join } from 'node:path' | ||
| import { fileURLToPath } from 'node:url' | ||
| import { createFilter } from 'vite' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of having all type import before runtime ones, it create more diffing when switching from type import to runtime or the other way around and when importing both types and import (I personally like them to be merged) it's cleaner to have them next to each other IMO if not merged
|
Maybe @leaysgur can help set up import sorting properly |
I think what you guys are looking for is basically what I asked in this last comment of the same issue you referenced and for that you should just add this group to your config, which first sorts (1) I'm not sure if this will ever be the default in the future (I think not), but for now the group needs be to added separately and that is what I started to use in Lerna-Lite and it's pretty much equivalent to what the plugin Also please note that you should make sure to use v0.16.0 or higher since there was a fix, that was released in v0.16, for internal import detection with |
|
It turned out we use glob overrides for json5 and yaml, but it's not supported yet oxc-project/oxc#17585 (Vite repo also has the same setup https://github.com/vitejs/vite/). Does anyone know the rational behind this? For json5, I see unquoted vite-plugin-react/.prettierrc.json Lines 1 to 19 in 3b87f5a
|
|
This is not a fundamental solution, but I'll share what I researched previously. Regarding Furthermore, the renovate docs doesn't seem to recommend using
https://docs.renovatebot.com/configuration-options/ Regarding Therefore, since the format is inconsistent, there may be little point in deliberately overwriting only (And fundamentally, YAML is a syntax that rarely requires quotes in most cases.) |
|
I think it was a preference: vitejs/vite#4132 (comment) I guess the main reason of using json5 was to write comments in it. It seems renovate allows comments in Regarding the yaml override, I think there's little downside of removing it. |

Description
Replaces Prettier with oxfmt (Oxc formatter) based on oxfmt alpha release and previous attempt #945.
Changes:
oxfmt@^0.23.0as dev dependency, removedprettier.oxfmtrc.jsonwith settings matching previous Prettier config:semi: false,singleQuote: true,printWidth: 80experimentalSortImportswithpartitionByNewline: trueandgroups: [["builtin"], ["external"]]for import orderingformatscript:prettier --write --cache .→oxfmtlint-stagedto useoxfmtfor JS/TS/JSON files (with explicit extensions instead of*)import-x/orderandsort-importsrules since oxfmt handles import ordering nowOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.