org.sonar.l10n.javascript.rules.javascript.S3723.html Maven / Gradle / Ivy
This rule is deprecated, and will eventually be removed.
Why is this an issue?
Modern browsers ignore unneeded, trailing commas, so there are no negatives to having them unless you’re supporting an IE 8 application. Since they
make adding new properties simpler, their use is preferred. This rule raises an issue when the last item in a multiline construct (array or object
literal, import or export statement, function declaration or call) does not end with a trailing comma and does not lie on the same line as the closing
curly brace, bracket or parenthesis.
Noncompliant code example
var joe = {
fname: "Joe",
lname: "Smith" // Noncompliant
};
Compliant solution
var joe = {
fname: "Joe",
lname: "Smith", // OK
};
var joe = {
fname: "Joe",
lname: "Smith"}; // OK