You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code中如何阻止Prettier在JS文件末尾添加新行?

解决Prettier自动添加文件末尾新行的问题
  • 找到项目中的Prettier配置文件(常见的有.prettierrc、.prettierrc.json、prettier.config.js)
  • 根据配置文件格式添加对应配置:
    • JSON格式配置文件:
      {
        "endOfLine": "none"
      }
      
    • JS格式配置文件:
      module.exports = {
        endOfLine: "none"
      };
      
  • 保存配置后,重新触发文件自动格式化(比如按Ctrl+S),此时Prettier会保留文件原本的末尾换行状态,不会自动添加新行
  • 重新执行firebase deploy,验证eol-last错误是否消失

如果项目同时使用ESLint,可同步将ESLint的eol-last规则设为"off",避免规则冲突。

内容的提问来源于stack exchange,提问作者whatwhatwhat

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 13:15:23