在
.vue
文件中的script
出现缩进问题,报错如下
Expected indentation of 0 spaces but found 2.eslintindent
原因
由于配置eslint
时使用了eslint-plugin-vue
插件,才会出现这个问题。插件也有官方解决方法: 官方解决方法
解决方法
在eslint
的配置文件 .eslintrc.js
加入一下内容
{
overrides: [
{
files: ['*.vue'],
rules: {
indent: 'off',
},
},
],
rules:{
'vue/script-indent': ['error', 2, { baseIndent: 1 }],
}
}