webstrom 配置eslint 自动修复错误

webstrom 配置eslint 自动修复错误

1、展示效果

如何给vue项目添加eslint呢,如何自动修复呢?

先展示一下效果:

GIF.gif

2、配置步骤

1、安装插件ESLint plugin

webstrom 其实有个非常好用的插件,ESLint plugin(如果在先安装不来可以手动下载,下载地址https://plugins.jetbrains.com/plugin/7494-eslint)

image.png

2、配置插件

安装完毕后在这里几个地方配置一下:

要注意两点

  • 第二个框是你的项目地址/node_modules/.bin/eslint.cmd
  • 第三个框是.eslintrc.js
image.png

如果是linux的话,其实和window类似,参考配置如下:

image.png

配置好后就可以使用了!

image.png

特别是这里面的eslint fix 可以自动修复非常好用!!!

3、参考

如果想了解eslint详细的配置可以参考我的另一篇博文:
http://www.jianshu.com/p/11ef5cf15d90

甚至你可以更方便的配置一个eslint 自动修复的快捷键,我使用的Alt+L

image.png

猜你喜欢

转载自blog.csdn.net/qq_35192741/article/details/79471741
今日推荐