Skip to content

Instantly share code, notes, and snippets.

@magicianShiro
Created January 12, 2019 12:27
Show Gist options
  • Save magicianShiro/bd331d36320f2860d76dfc7faa1ab9eb to your computer and use it in GitHub Desktop.
Save magicianShiro/bd331d36320f2860d76dfc7faa1ab9eb to your computer and use it in GitHub Desktop.
vue-cli3.0 eslint配置(主要是eslint-plugin-vue插件)
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'@vue/standard',
'@vue/typescript'
],
rules: {
'no-console': 'off',
'no-debugger': 'off',
// 闭合标签换行
'vue/html-closing-bracket-newline': [
'error',
{
singleline: 'never',
multiline: 'never'
}
],
// 闭合标签的空格数(>和属性之间的空格)
'vue/html-closing-bracket-spacing': [
'error',
{
startTag: 'never',
endTag: 'never',
selfClosingTag: 'always'
}
],
// 闭合标签配置
'vue/html-self-closing': [
'error',
{
html: {
'void': 'always',
normal: 'always',
component: 'always'
},
svg: 'always',
math: 'always'
}
],
'vue/html-indent': 'error',
// 标签里面的内容独占一行
'vue/multiline-html-element-content-newline': 'error',
// 属性换行配置
"vue/max-attributes-per-line": ["error", {
"singleline": 1,
"multiline": {
"max": 1,
"allowFirstLine": true
}
}],
// 格式对齐配置
"vue/html-indent": ["error", 2, {
"attribute": 1,
"baseIndent": 1,
"closeBracket": 0,
"alignAttributesVertically": false,
"ignores": []
}],
// 双花括号和内容之间需要有空格
'vue/mustache-interpolation-spacing': 'error',
// 空格不允许有多个
'vue/no-multi-spaces': 'error'
},
parserOptions: {
parser: 'typescript-eslint-parser'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment