Skip to content

tools: lint for object literal spacing

Rodrigo Muino Tomonari requested to merge github/fork/Trott/keyspace into master
Checklist
  • tests and code linting passes
  • the commit message follows commit guidelines
Affected core subsystem(s)

tools lib test

Description of change

There have been occasional nits for spacing in object literals in PRs but the project does not lint for it and it is not always handled consistently in the existing code, even on adjacent lines of a file.

This change enables a linting rule requiring no space between the key and the colon, and requiring at least one space (but allowing for more so property values can be lined up if desired) between the colon and the value. This appears to be the most common style used in the current code base.

Example code the complies with lint rule:

myObj = { foo: 'bar' };

Examples that do not comply with the lint rule:

myObj = { foo : 'bar' };
myObj = { foo:'bar' };

Merge request reports

Loading