Closed romainmenke closed 3 months ago
Honestly, it seems hard to force all Maps or Sets since all of them don't require alphabetical order... 🤔
True, and often the entries aren't string literals, sorting those could have unwanted side effects.
The reason I personally like these to be sorted is to spot duplicates. There seems to have been some progress on a similar request here : https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1559
I am going to close this for now as neither (sorting, or de-duping) actually exists today :) Thank you for your insights :)
Surely, I also want a lint rule to detect duplication in a Map or Set. If it's implemented, let's reconsider to add the rule. 👍🏼
What is the problem you're trying to solve?
There are several list we like to have sorted alphabetically. Mainly for readability and maintainability.
For example : https://github.com/stylelint/stylelint/blob/9897bf1f712a4788fdffad63a023a93ad67845e1/lib/rules/custom-property-no-missing-var-function/index.mjs#L18-L38
What solution would you like to see?
Can we automate and enforce these with an eslint rule?
Then we don't have to document this and it should ease code review.