You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,6 +148,7 @@ The rules with the following star :star: are included in the `plugin:regexp/reco
148
148
|[regexp/prefer-range](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-range.html)| enforce using character class range |:wrench:|
149
149
|[regexp/prefer-regexp-exec](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-regexp-exec.html)| enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided ||
150
150
|[regexp/prefer-regexp-test](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-regexp-test.html)| enforce that `RegExp#test` is used instead of `String#match` and `RegExp#exec`|:wrench:|
151
+
|[regexp/sort-alternatives](https://ota-meshi.github.io/eslint-plugin-regexp/rules/sort-alternatives.html)| sort alternatives if order doesn't matter |:wrench:|
description: "sort alternatives if order doesn't matter"
6
+
---
7
+
# regexp/sort-alternatives
8
+
9
+
> sort alternatives if order doesn't matter
10
+
11
+
-:exclamation: <badgetext="This rule has not been released yet."vertical="middle"type="error"> ***This rule has not been released yet.*** </badge>
12
+
-:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
13
+
14
+
## :book: Rule Details
15
+
16
+
This rule will sort alternatives to improve readability and maintainability.
17
+
18
+
The primary target of this rule are lists of words and/or numbers. These lists are somewhat common and sorting them makes it easy for readers to check whether a particular word or number is included.
19
+
20
+
This rule will only sort alternatives if reordering the alternatives doesn't affect the pattern.
0 commit comments