Avoid trailing commas in object or array literals

Impact area

Manageability

Severity

High

Affected element

Lightning

Rule ID

SF-0069

Impact

Using trailing commas in object or array literals reduces code portability due to differences in how different browsers interpret these trailing commas.

Remediation

Remove any trailing commas from object or array literal definitions.

Explanation

When an array is defined with a trailing , for some browsers this is ok, but others could fail to process it. The solution is simply to remove the trailing (last) comma from the array definition.

Time to fix

30 min

Original reference

PMD: AvoidTrailingComma




Last modified on Jun 10, 2020