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.66k stars 30 forks source link

fix: use alphabetical as the default sort type in schemas #41

Closed haocheng6 closed 11 months ago

haocheng6 commented 11 months ago

Description

Currently, the default type specified in the schema of every rule is SortType.natural. This will cause inconsistent behavior. For example, "perfectionist/sort-array-includes": "error" and "perfectionist/sort-array-includes": ["error", {}] don't work in the same way. The first one uses alphabetical sorting while the second uses natural sorting.

This PR fixes the default type for all rules.

Additional context

N/A


What is the purpose of this pull request?

Before submitting the PR, please make sure you do the following

azat-io commented 11 months ago

Nice catch! Do you mind if I merge this but create a new release a little later?

haocheng6 commented 11 months ago

@azat-io No, not at all. I don't think this bug will affect too many users if they just use the config on the documentation site. Also, alphabetical sorting and natural sorting produce the same result in most real-world use cases. So it is ok to release the fix later.

Also, thanks for taking the time to review the PR.

azat-io commented 10 months ago

Released in v1.5.1.

Thank you!