if (foo === '1') {
// ...
}
if (foo === '2') {
// ...
}
function a() {
if (foo === '1') {
// ...
return;
}
if (foo === '2') {
// ...
return;
}
}
if (foo === '1') {
// ...
} else if (foo === '2') {
// ...
}
if (foo === '1') {
...
}
if (foo === '2') {
...
}
if (foo === '3') {
...
}
if (foo === '4') {
...
}
To fix this case, we can simply only check if foo
is declared as const
.
This come from my work, but real case is more complicated, it's like
if (foo.bar === '1') {
...
}
if (foo.bar === '2') {
...
}
if (foo.bar === '3') {
...
}
if (foo.bar === '4') {
...
}
To fix this case, we need to check foo.bar
and foo
didn't get changed in each if
block, I feel this is hard (even impossible) to do.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too