-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Enhancement: member-ordering
default configuration
#5452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The default config us automatically applied if you provide no What is the goal you're trying to achieve? |
I'm trying to apply The only way I was able to achieve this was by using the example in the Pass comment. |
FYI I updated the playground and what I can tell:
Unless I missed something the only way to apply default configuration ordering is to copy/paste it in the configuration, which is also what the documentation is mentionning:
|
Yes you have describe the config working as intended. The default is still setup using the array style config which forces case sensitive alphabetical sorting. Which means if you specify an object for I.e. If you want to change the We could switch it to an object with explicit alphabetical ordering which would enable you to change the ordering and it shouldn't be a breaking change as it is equivalent. |
From the documentation
So basically as soon as you want to use sorting, there is no way right now to re-use the default configuration (without copy/pasting it) which in my opinion should be there by default because it's quite good. I might consider doing a PR on member-ordering but I am not sure what you are proposing exactly. Do you mean changing this line oneOf: [arrayConfig(memberTypes), neverConfig], To this: oneOf: [arrayConfig(memberTypes), defaultConfig, neverConfig], |
No I mean changing the default config from {
default: [ ... ]
} to {
default: {
memberTypes: [ ... ],
order: 'alphabetically'
}
} that way you could specify your config like this: {
rules: {
'@typescript-eslint/member-ordering': [
'error',
{
default: {
order: 'alphabetically-case-insensitive',
},
}
],
},
} and our tooling would merge it in - retaining the defaults whilst changing the ordering config |
Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Link to the rule's documentation
https://typescript-eslint.io/rules/member-ordering
Description
Based on my experimentations and also on the documentation, to apply the "default configuration" you have to copy/paste this list: https://typescript-eslint.io/rules/member-ordering/#default-configuration which contains 88 lines.
Adding this in the ESLint config will make it less maintainable and having an option to omit this list and use the default would be preferable.
One idea would be to add a new option called
memberTypesPreset
where you could pickdefault
- or maybe even its default value would bedefault
and you don't have to specify it.Or another idea would be that if
memberTypes: []
(empty array) or, ifmemberTypes
is simply omitted, the default configuration is applied.Fail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: