Skip to content
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

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

Merged
merged 2 commits into from
Jul 21, 2023

Conversation

haocheng6
Copy link
Contributor

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?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

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

  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.
  • Read contribution guidelines.

@azat-io
Copy link
Owner

azat-io commented Jul 21, 2023

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

@azat-io azat-io merged commit 3b9366e into azat-io:main Jul 21, 2023
1 check passed
@haocheng6
Copy link
Contributor Author

@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.

@haocheng6 haocheng6 deleted the fix-default-sort-type branch July 22, 2023 21:27
@azat-io azat-io added the bug Something isn't working label Jul 25, 2023
@azat-io
Copy link
Owner

azat-io commented Jul 25, 2023

Released in v1.5.1.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants