如果你直接在vscode里面编辑设置settings.json的话
无论是json写进去,还是设置里面填写进去,都没用!(json其实就是和插件设置项同步的,都没用,估计是bug)
最终解决方案:
直接在项目根目录创建 .prettierrc 文件
我感觉吧,只有在配置文件里面写参数才有用。
然后填写内容如下:
{
"printWidth": 200,
"eslintIntegration": true,
"stylelintIntegration": true,
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"arrowParens": "avoid",
"htmlWhitespaceSensitivity": "ignore",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"files.insertFinalNewline": true,
"useTabs": false,
"endOfLine": "auto",
"ignorePath": ".gnore",
"trailingComma": "none"
}