ESLint 配置保存 自动格式化代码 vscode

在.eslintrc.js 添加 vscode 终端启动服务

 2、在同级目录新建.prettierrc

{
  "printWidth": 120,
  "semi": false,
  "singleQuote": true,
  "prettier.spaceBeforeFunctionParen": true
}

3、打开VS code 文件》首选项》设置》扩展》ESLint》 请先安装ESLint扩展工具

    // eslint格式化字符串
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },

原文地址:https://www.cnblogs.com/huoshengmiao/p/14903313.html