eslint-plugin-perfectionist icon indicating copy to clipboard operation
eslint-plugin-perfectionist copied to clipboard

Sort optional fields

Open Grawl opened this issue 2 years ago • 3 comments

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.

Grawl avatar Sep 07 '23 11:09 Grawl

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.

jasongitmail avatar Sep 16 '23 22:09 jasongitmail

The same for default values

Actual:

const {
  a,
  b = c, // ??????
  c,
} = test

Expected:

const {
  a,
  c,
  b = c,
} = test

d8corp avatar Sep 19 '23 07:09 d8corp

+1

caioedut avatar Apr 12 '24 16:04 caioedut

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

azat-io avatar Jul 22 '24 12:07 azat-io