Add sort order option for sorted imports#6665
Conversation
Generated by 🚫 Danger |
SimplyDanny
left a comment
There was a problem hiding this comment.
Thank you for the contribution, @ayushnagpal570-ai!
I wonder if case_insensitive and lexicographic are the clearest pair of names here. lexicographic is technically accurate, but it doesn’t feel parallel with case_insensitive, so the distinction may be a little harder to grasp from the config alone. If the practical difference is just whether case affects ordering, would case_insensitive/case_sensitive be clearer and more consistent?
| let offset: Int | ||
| let attributes: String | ||
| let modifier: UInt8 | ||
| let sortOrder: SortedImportsConfiguration.SortOrder |
There was a problem hiding this comment.
I don't think this should be a property of an import, but of the comparison. What if I set one style for one import and another one for the other? That doesn't happen here, but the API would suggest that it would work ...
Summary
sort_orderoption tosorted_importswithcase_insensitiveas the existing default andlexicographicas the new alternativeCloses #4810.
Tests
swift test --filter SortedImportsRuleGeneratedTestsswift test --filter RuleConfigurationTestsswift test --filter IntegrationTestsgit diff --check