Reputation: 1830
I have a standard Angular app and am trying to disable trailing commas in Prettier. So I go into vscode settings (both user and workspace) and set trailing commas to none:
I also have an .editorconfig file and tslint.json files. The tslint.json file has trailing commas set to false. Lastly, I am using the Prettier Formatter for VSCode extension. Anyway, the trailing commas still appear unless I put this in package.json:
"prettier": {
"bracketSpacing": true,
"singleQuote": true,
"trailingComma": "none"
}
How come if my preferences are set in VSCode settings that I then have to add this snippet of redundant code in the package.json file?
Thanks for any helpful tips.
Upvotes: 0
Views: 1523
Reputation: 151
Is your default formatter set to prettier? Or the default Typescript and Javascript language features?
You can check this by opening a typescript file and pressing ctrl + shift + p
(for windows)
and looking for format document with
and looking which is the default.
Upvotes: 1
Reputation: 305
Maybe you have to set "trailing-comma": true
in tslint.json. Anyway good practice is to install https://github.com/prettier/tslint-config-prettier so you don't get conflicts.
Upvotes: 1