Home >Development Tools >sublime >How does sublime automatically fix eslint errors?

How does sublime automatically fix eslint errors?

藏色散人
藏色散人forward
2020-03-21 14:56:034401browse

下面由sublime教程栏目给大家介绍sublime自动修复eslint报错的方法,希望对需要的朋友有所帮助!

1.安装全局安装eslint

npm install eslint -g

全局安装eslint插件

npm install eslint-plugin-html -g
npm install babel-eslint -g

在需要用到eslint的项目生成eslint文件

eslint --init

2、在sublime编辑器上安装插件ESLint-Formatter

菜单栏找到 Tools > Build System > New Build System,新建一个 eslint-fix.sublime-build 文件,然后里面内容如下:

{
    "shell_cmd": "eslint --fix $file" 
}

或者

{
    "cmd": "D:\\dev\\nvm\\npm\\eslint.cmd --fix $file" 
}

3、用快捷键 ctrl+b 运行刚刚创建的 build 文件

How does sublime automatically fix eslint errors?

推荐教程:《sublime text

The above is the detailed content of How does sublime automatically fix eslint errors?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete