Skip to content

tools: lint for object literal spacing#6592

Closed
Trott wants to merge 1 commit intonodejs:masterfrom
Trott:keyspace
Closed

tools: lint for object literal spacing#6592
Trott wants to merge 1 commit intonodejs:masterfrom
Trott:keyspace

Conversation

@Trott
Copy link
Member

@Trott Trott commented May 5, 2016

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' };

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants