使用单引号,然后不用分号
1、.eslintrc.js
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
'plugin:vue/essential',
'standard'
],
// required to lint *.vue files
plugins: [
'vue'
],
// add your custom rules here
rules: {
'no-multiple-empty-lines': 0,
'no-new':0,
indent: [1,"tab"],
'no-tabs': 0,
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 1,
// 禁止重复 import
"space-before-function-paren": ["off", "always"]
}
}
2、webpack.config加入如下代码
{
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test'), resolve('module')],
exclude: /node_modules/,
options: {
formatter: require('eslint-friendly-formatter'),
//不符合Eslint规则时只警告(默认运行出错)
emitWarning: true
}
}
3、.editorconfig
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
4、配置不希望eslint监测的文件.eslintignore
# /node_modules/* and /bower_components/* in the project root are ignored by default
# Ignore built files except build/index.js
dist/*
!dist/index.js
module/*/vendor.js
README.md
如果还报错的话就下载editorconfig插件(直接在vscode里搜索安装就好)