在项目的根目录加一个配置文件.prettierrc 里面输入: { "semi": false, "singleQuote": true, "printWidth": 150 } 这样,就不会在格式化时出现换行的情况了