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

How does sublime automatically fix eslint errors?

藏色散人
Release: 2020-03-21 14:56:03
forward
4380 people have browsed it

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

1.安装全局安装eslint

npm install eslint -g
Copy after login

全局安装eslint插件

npm install eslint-plugin-html -g
npm install babel-eslint -g
Copy after login

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

eslint --init
Copy after login

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

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

{
    "shell_cmd": "eslint --fix $file" 
}
Copy after login

或者

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

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template