quick-lint-js

Find bugs in JavaScript programs.

E0154: unexpected expression; missing key for object entry

Object literals can contain methods, object spreads, shorthand properties, and key-value pairs. It is a syntax error to write a complex value (expression) without a key in an object literal:

async function loadUser(id) {
  let row = await db.selectOne('user', {id});
  return {
    ...row,
    password: null,
    row.firstName + " " + row.lastName,
  };
}

To fix this error, write a key before the value:

async function loadUser(id) {
  let row = await db.selectOne('user', {id});
  return {
    ...row,
    password: null,
    fullName: row.firstName + " " + row.lastName,
  };
}

Introduced in quick-lint-js version 0.3.0.

Documentation for other errors