quick-lint-js

Find bugs in JavaScript programs.

E0014: expected expression before newline

throw statements cannot have a newline between the throw keyword and the thrown expression:

throw
  new Error(
    "something terrible happened!"
  );

To fix this error, add parentheses:

throw (
  new Error(
    "something terrible happened!"
  )
);

Alternatively, start the expression on the same line as the throw keyword:

throw new Error(
  "something terrible happened!"
);

Documentation for other errors