False negatives in 3 rules when right side of && expression is a literal #13634
Labels
archived due to age
This issue has been archived; please open a new issue for any further discussion
bug
ESLint is working incorrectly
core
Relates to ESLint's core APIs and features
evaluating
The team will evaluate this issue to decide whether it meets the criteria for inclusion
rule
Relates to ESLint's core rules
Tell us about your environment
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, 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.
Demo
What did you expect to happen?
We should report errors in each of the above cases. All three are looking for a specific type of truthy value from the expression. Because the expression uses
&&
, any possibly-valid value would evaluate to the right side of the expression, which would not be a valid value in these examples.This was originally discovered in #13618 (comment). Because it relates to existing behavior that existed prior to that pull request, we decided to split it into its own issue that can be fixed after the pull request is merged. This bug is a false negative in the 3 rules above, and fixing it would cause them to report more errors. Does anyone object to fixing this in a semver-minor change as allowed by our semver policy?
The fix would update both
astUtils.couldBeError()
andconstructor-super
'sisPossibleConstructor()
to only check the right side of&&
LogicalExpression
s.What actually happened? Please include the actual, raw output from ESLint.
No errors are reported.
Are you willing to submit a pull request to fix this bug?
Yes, if @mdjermanovic doesn't get to it first.
The text was updated successfully, but these errors were encountered: