quick-lint-js
quick-lint-js copied to clipboard
20$: Warn on missing parentheses in 'if' statement
function f() {
return true;
}
if (f) {
}
The above code should warn on the call to f
, stating "missing '()' in function call".
We'd need to do two things in variable_analyzer
:
- track the type of declared identifiers (we already sorta do this with
variable_init_kind
), and - track the usage style of variables (we already sorta do this with
used_variable_kind
).
At first I thought this would be complicated, but because we have similar features already, maybe this'll be relatively straightforward.
We can do something similar with code like if (f == 42) {}
.