Package Exports
- eslint-plugin-require-trailing-comma
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-require-trailing-comma) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
eslint-plugin-require-trailing-comma
ESLint rule for enforcing requiring trailing commas
Why Use It
You like consistency
Here is an array and object with consistent lines endings
var array = [
1,
2,
3,
];
var object = {
a: 1,
b: 2,
c: 3,
};
Here is an array and object with inconsistent lines endings
var array = [
1,
2,
3
];
var object = {
a: 1,
b: 2,
c: 3
};
Having consistent line endings means each line is independent. You can sort the lines, cut, copy, and paste the lines, add more lines, all without worrying about one line being different.
Why Not Use It
IE8 and before will barf.
Notes:
The default is to only require trailing comma on multi-line arrays and objects. Single line arrays and
objects are ignored. use all
to enforce even on single line arrays and objects as in
{
"rules: {
"require-trailing-comma/require-trailing-comma": [2, "all"],
}
}