-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Rule Proposal: require-array-sort-compare #247
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
Labels
enhancement: new plugin rule
New rule request for eslint-plugin
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Comments
mysticatea
added a commit
that referenced
this issue
Feb 12, 2019
If you have an array of strings is it fine to call |
In the the discussion in the original issue eslint/eslint#10363, there was a consensus: it should report string array as well in favor of |
bradzacher
pushed a commit
that referenced
this issue
Feb 14, 2019
kaicataldo
pushed a commit
to kaicataldo/typescript-eslint
that referenced
this issue
Aug 27, 2019
This PR enables `eslint-plugin/require-meta-type` rule, and adds type field to all existing rules. fixes: typescript-eslint#216
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
enhancement: new plugin rule
New rule request for eslint-plugin
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Please describe what the rule should do:
From eslint/eslint#10363
This rule reports
xs.sort()
calls with no arguments ifxs
is an array.Because the default compare function does compare the array elements as strings then it can cause unexpected behavior. For example:
The language spec describes this matter.
Because the rule doesn't want to warn the
sort()
method of non-array class, I think that this rule fits to this plugin.What category of rule is this? (place an "X" next to just one item)
[ ] Enforces code style
[X] Warns about a potential error
[ ] Suggests an alternate way of doing something
[ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
The text was updated successfully, but these errors were encountered: