-
Notifications
You must be signed in to change notification settings - Fork 886
Add object literal sort option to account for special characters #4193
Conversation
) { | ||
const key = ignoreCase | ||
? property.name.text.toLowerCase() | ||
: property.name.text; | ||
// comparison with undefined is expected |
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 is where the logic change starts for this PR. The preview doesn't really frame the changes well. The actual change I want to highlight is below this comment.
|
|
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.
Please update the tests to have something that would fail against master but work in your branch.
Also please rename your directory under test from local-compare
to locale-compare
Apologies for the delay in getting to this PR. |
Thank you for your feedback. I made all requested changes:
|
PR checklist
Overview of change:
The current behavior of the
object-literal-sort-keys
rule is to sort any accented characters after the non-accented "z" character, which is undesirable in accent-heavy languages like Spanish, French, and German. This change gives users of this rule the option to sort accented characters next to their non-accented counterpart.Is there anything you'd like reviewers to focus on?
localeCompare()
function is to make a "best fit" guess at which locale to use.Reference links:
CHANGELOG.md entry:
[new-rule-option]
object-literal-sort-keys
:locale-compare