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!");
}

Introduced in quick-lint-js version 0.2.0.

Documentation for other errors