useSortedAttributes
- grouping options from jsx-sort-props
#6620
jgoz
started this conversation in
Rule suggestion
Replies: 1 comment
-
Hi @jgoz, I'm also looking forward to this feature. I think it would be great to follow the same API pattern as Here's a suggested configuration structure that would provide the flexibility while maintaining familiarity with existing Biome patterns: "useSortedAttributes": {
"level": "error",
"options": {
"type": "alphabetical", /* 'line-length' | 'alphabetical' */
"order": "asc", /* 'asc' | 'desc' */
"groups": [
["id", "key", "ref"],
["dangerouslySetInnerHTML"],
["className", "style"],
":SHORTHAND:",
"is[A-Z]*.*",
"on[A-Z]*.*"
]
}
} |
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.
-
Currently,
useSortedAttributes
is not configurable and attributes are only ever sorted using natural alphabetical order. The source rulereact/jsx-sort-props
, however, supports options for grouping attributes based on their nature. These options seem the most useful to me:callbacksLast
— When true, callbacks must be listed after all other props, even ifshorthandLast
is setshorthandFirst
— When true, short hand props must be listed before all other props, but still respecting the alphabetical ordershorthandLast
— When true, short hand props must be listed after all other props (unlesscallbacksLast
is set), but still respecting the alphabetical orderreservedFirst
— This can be a boolean or an array option. WhenreservedFirst
is defined, React reserved props (children
,dangerouslySetInnerHTML
,key
, andref
) must be listed before all other props, but still respecting the alphabetical order. If given as an array, the array's values will override the default list of reserved props. Note: the values in the array may only be a subset of React reserved props.Beta Was this translation helpful? Give feedback.
All reactions