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.
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.
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.
删除 tslint 配置中的“尾随逗号”。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.