I cannot figure out why my tslint
even want to see the trailing comma on the end of the last line in the objects
? How can I set the ignore
rule for the last line of the objects for example? Thanks.
Exemple:
props = {
prop1: 21, // good
prop2: 2, // good
prop3: false // error: [tslint] Missing trailing comma (trailing-comma)
}
Rule for trailing-comma
in my tsconfig.json
:
"trailing-comma": [true, {
"singleline": "never",
"multiline": {
"objects": "always",
"arrays": "always",
"functions": "never",
"typeLiterals": "ignore"
}
}]
You clearly have the rule enabled for multi-line objects:
"trailing-comma": [true, {
"singleline": "never",
"multiline": {
"objects": "always", // <==================
"arrays": "always",
"functions": "never",
"typeLiterals": "ignore"
}
}]
So...disable it by making that "never"
(if you want to disallow commas there) or "ignore"
(if you want to allow commas to be there or not, either way).