azat-io / eslint-plugin-perfectionist

🦄 ESLint plugin for sorting various data such as objects, imports, types, enums, JSX props, etc.
https://eslint-plugin-perfectionist.azat.io
MIT License
1.67k stars 30 forks source link

Sort optional fields #66

Open Grawl opened 9 months ago

Grawl commented 9 months ago

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

jasongitmail commented 9 months ago

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.

d8corp commented 9 months ago

The same for default values

Actual:

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

Expected:

const {
  a,
  c,
  b = c,
} = test
caioedut commented 2 months ago

+1