quick-lint-js

Find bugs in JavaScript programs.

E0018: if statement is missing '(' or ')' around condition

An if statement is missing either ( before the condition or ) after the condition:

if (2 + 2 == 4 {
  console.log("Math works!");
}
if 4 == 2 + 2) {
  console.log("Jedi math works!");
}

To fix this error, add the missing ( or ):

if (2 + 2 == 4) {
  console.log("Math works!");
}
if (4 == 2 + 2) {
  console.log("Jedi math works!");
}

Documentation for other errors