先看看结果
有毛病提醒和快捷键自动修复。
我装置的插件
1.预备 在node环境装置eslint等插件
注重: 需提早装置好node环境
// 除了eslint是必需的,能够按需装置
npm i -g eslint eslint-config-standard eslint-plugin-html eslint-plugin-import eslint-plugin-node eslint-plugin-promise
2. 在webstorm设置
node和eslint的途径是软件自动猎取的,记得选中enable;去设置内里设置你的自动修复快捷键
3. 末了一步,在项目中设置.eslintrc.js或.eslintrc, webstorm会自动挪用。
// https://eslint.org/docs/user-guide/configuring
// 本身按需设置咯
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true
},
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}