Object literal syntax, which initializes an object's properties inside the object declaration is cleaner and clearer than the alternative: creating an empty object, and then giving it properties one by one.

An issue is raised when the following pattern is met:

Note that this rule requires Node.js to be available during analysis.

Noncompliant Code Example

let person = {};  // Noncompliant
person.firstName = "John";
person.middleInitial = "Q";
person.lastName = "Public";

Compliant Solution

let person = {
  firstName: "John",
  middleInitial: "Q",
  lastName: "Public",
}