-
-
Notifications
You must be signed in to change notification settings - Fork 888
feat: support configureable sorting mode for imports, keys and attributes #6506
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
957a9d4
Update utils to accept custom comparator
nazarhussain afc8b9d
Update string_case crate to have flexible sorting methods
nazarhussain 7138649
Add sortMode to useSortedKeys rule
nazarhussain 5f1e195
Add sortMode to useSortedAttributes rule
nazarhussain 8c06689
Add sortMode to organizeImports rule
nazarhussain a8b8a7d
Update the configuration schema
nazarhussain e2d95a8
Rename sort_mode to sort_order
nazarhussain aa4f143
Update sortOrder to identifierOrder for organizeImports
nazarhussain fd898bb
Remove files accidently committed
nazarhussain 05d7301
Update the code as per feedback
nazarhussain 2cc1c76
Fix the sorting comaprision
nazarhussain 842ebb9
Update the constraint from Key
nazarhussain 785ce1a
Remove unintended snapshot
nazarhussain ec37c2a
Update comaparision of None vs Some
nazarhussain 9725c0f
Cleanup the comments
nazarhussain 1cacd43
Clean up some duplicate code
nazarhussain 24399e6
Fix formatting
nazarhussain 3001a47
Fix linting
nazarhussain b177951
Add a changeset file
nazarhussain b97422b
Add link for the rules in changeset
nazarhussain 9934529
Apply suggestions from code review
nazarhussain f6a1102
Update the docs for update options
nazarhussain ddc4455
Merge branch 'nh/import-sort-config' of github.com:nazarhussain/biome…
nazarhussain b9d4e0a
Fix codegen and rules check issue
nazarhussain 213ba0d
Fix config schema linting
nazarhussain 55b5730
Update the docs and added exampels for ne rule options
nazarhussain 0ba0eba
Update auto-generated code
nazarhussain b4fb73d
Merge branch 'next' into nh/import-sort-config
nazarhussain e2e4556
Update the lint rules
nazarhussain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Allow customization of the sort order for different sorting actions. These actions now support a sort option: | ||
|
|
||
| - [`assist/source/useSortedKeys`](https://biomejs.dev/assist/actions/use-sorted-keys/) now has a `sortOrder` option | ||
| - [`assist/source/useSortedAttributes`](https://biomejs.dev/assist/actions/use-sorted-attributes/) now has a `sortOrder` option | ||
| - [`assist/source/organizeImports`](https://biomejs.dev/assist/actions/organize-imports/) now has an `identifierOrder` option | ||
|
|
||
| For each of these options, the supported values are the same: | ||
|
|
||
| 1. **`natural`**. Compares two strings using a natural ASCII order. Uppercase letters come first (e.g. `A` < `a` < `B` < `b`) and number are compared in a human way (e.g. `9` < `10`). This is the default value. | ||
| 2. **`lexicographic`**. Strings are ordered lexicographically by their byte values. This orders Unicode code points based on their positions in the code charts. This is not necessarily the same as “alphabetical” order, which varies by language and locale. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, you want to add a snippet that uses the options you defined at line 631. Create a
jscode block:Of course, you want to use a code that shows how the natural order is applied