Add the same option group
in useSortedKeys
as in organizeImports
#6892
arthur-pigeon
started this conversation in
Ideas
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 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.
-
Regarding the useSortedKeys actions, there is some case where it a bit too rigid, and it would be nice to get the option to add some kind of exceptions by creating groups and reordering them just like in perfectionist/sort-object#groups and just below perfectionist/sort-object#customGroups
Here is an example of why I think it would be good and how I think this could look like:
If I take this simple object for example:
Biome with
useSortedKeys
on will format to this:Which looses a lot of readability, the
id
is better being on top, andcreatedAt
andupdatedAt
are better at the bottom.Which gives something like this:
This could be solved if the action preserves blank lines (a blank line acting as a 'block separator') like this:
Or by having a
groups
andcustomGroups
options in the config like thisWhich leads to the ideal shown in the 3rd code block
PS: I intentionally left the
groups
andcustomGroups
simple, but we can easily imagine a more complete solution with regex matching, more default groups and so onOther related topics: #5907, #6122, #6620 (not the same scope but it a way it could be solved the same way by having those default groups and the possibility to reorder them)
Beta Was this translation helpful? Give feedback.
All reactions