quick-lint-js

Find bugs in JavaScript programs.

E0158: unexpected '=>'; expected parameter for arrow function, but got a literal instead

An arrow function has a parameter list followed by => followed by a body. It is a syntax error to write an arrow function with a literal instead of a parameter list:

let fs = require("fs");
let path = process.argv[2];
fs.readFile(path, "utf-8" => {
});

const queryUser = userID, groupID = 0 => {
  /* ... */
};

To fix this error, write a parameter list before =>:

let fs = require("fs");
let path = process.argv[2];
fs.readFile(path, "utf-8", (err, data) => {
});

Alternatively, write ( ) around the parameter list:

const queryUser = (userID, groupID = 0) => {
  /* ... */
};

Introduced in quick-lint-js version 0.3.0.

Documentation for other errors