Closed
Description
Tell us about your environment
- ESLint Version: v7.7.0
- Node Version: v12.14.0
- npm Version: 6.13.4
What parser (default, @babel/eslint-parser
, @typescript-eslint/parser
, etc.) are you using?
default
Please show your full configuration:
Configuration
module.exports = {
parserOptions: {
ecmaVersion: 2020
}
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
(a && b) ?? c;
The rest of the bug report template isn't quite suitable for this issue.
Code path analysis gives the following:
DOT
digraph {
node[shape=box,style="rounded,filled",fillcolor=white];
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
s1_1[label="Program:enter\nExpressionStatement:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (a)"];
s1_2[label="Identifier (b)\nLogicalExpression:exit"];
s1_3[label="Identifier (c)"];
s1_4[label="LogicalExpression:exit\nExpressionStatement:exit\nProgram:exit"];
initial->s1_1->s1_2->s1_3->s1_4;
s1_1->s1_4;
s1_2->s1_4->final;
}
This would be correct for (a || b) ?? c
, but I think it isn't entirely correct for (a && b) ?? c
since there should be a path from a
to c
that doesn't go through b
:
(null && console.log("b")) ?? console.log("c"); // logs only "c"
Metadata
Assignees
Labels
Type
Projects
Status
Complete