eslint-plugin-perfectionist
eslint-plugin-perfectionist copied to clipboard
Sort optional fields
What rule do you want to change?
Props
Describe the problem
I want to sort optional props to the bottom.
Code example
I mean that required?: boolean is supposed to be after count: number in Props type object.
Additional comments
No response
Validations
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Same. Came here for this too.
Using TypeScript and would like to have required parameters first and optional follow, then apply Perfectionists sorting rules inside of those groups.
The same for default values
Actual:
const {
a,
b = c, // ??????
c,
} = test
Expected:
const {
a,
c,
b = c,
} = test
+1
Thank you for your issue!
This feature was implemented in 96cfcd8be3dee5870a14de1736e76af7632cc8b0 and released in v3.0.0.
If you'd like, you can support the release with a retweet: https://x.com/azat_io_en/status/1815367279191761054