Enforces spacing around commas (comma-spacing)

The --fix option on the command line can automatically fix some of the problems reported by this rule.

Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

varfoo=1,bar=2;varfoo=1,bar=2;

Rule Details

This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases: