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
yoda rule exceptRange false positives #12883
Comments
These both looks like bugs to me 👍 Can we split this into two issues (or at least implement them in separate PRs)? |
for this example /* eslint yoda: ["error", "always", { exceptRange: true }] */
if (something < x && x < 100 ) {} // error on x < 100
|
That's indeed what documentation says:
However, that text was added later in #5596. By the original issue #1561 and PR #1570 it doesn't seem that the Also, the same sentence in documentation is incorrect for the /*eslint yoda: ["error", "always", { "onlyEquality": true }]*/
if (x < 1) {} // no error |
thanks for the info. I will try to fix the 2nd issue ( |
* Fix: yoda left string fix for exceptRange * Chore: aded string check for isOutsideTest yoda * Fix: removed inconsistency btn never and always * Chore: fixed false negatives * Chore: fixed false negative string <= number * Chore: simplify range checks (yoda) * Chore: fixed false negative and added test * Chore: removed un-neccesary comment for defaultValue * Chore: removed un-neccesary checks * Chore: added removed tests * Chore: linting fixes
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
These are two different issues.
"never"
and"always"
.Demo
Demo
Demo
What did you expect to happen?
Maybe no errors.
What actually happened? Please include the actual, raw output from ESLint.
Two errors noted in the comments.
Are you willing to submit a pull request to fix this bug?
Yes.
The text was updated successfully, but these errors were encountered: