我在 VS Code 中使用 Prettier。我注意到在保存时使用格式时,Prettier 每次都会在对象的最后一行添加尾随逗号。
例如,假设我有一个这样的 JS 对象:
obj = {
hello: 'hello',
world: 'world'
}
Run Code Online (Sandbox Code Playgroud)
Prettier 把它变成了这样:
obj = {
hello: 'hello',
world: 'world',
}
Run Code Online (Sandbox Code Playgroud)
注意后面的额外逗号
'world'
在设置中没有找到解决此问题的选项。