webstrom+eslint 配置在vue项目中自动保存修复

1,987 阅读1分钟

安装webstrom

  • WebStorm配置eslint时报错:this.cliEngine is not a constructor'

    • 解决办法:

      • 1 npm install --save-dev eslint@5
      • 2 升级webstorm版本到2019.03
        1. 修改webstrom安装eslint文件
          1. 找到/Applications/WebStorm.app/Contents/plugins/JavaScriptLanguage/languageService/eslint/bin/eslint-plugin.js,
        • 2.修改 this.cliEngine = require(packagePath + "lib/cli-engine"); 修改为 this.cliEngine = require(packagePath + "lib/cli-engine").CLIEngine; 重启。

eslint 配置

    1. 安装 setting下配置eslint插件
    1. 配置后配置erlint的配置命令

    1. 找到Keymap选项 勾选javascript support / fix Eslint Problems

  • 在编译器中编译测试一下 应该就可以了