vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.45k stars 663 forks source link

vue/script-indent 配置问题 #352

Closed ldwqh0 closed 6 years ago

ldwqh0 commented 6 years ago

我尝试 增加如下配置到 rules中

rules:{
  'vue/script-indent': ['error', 2, {'baseIndent': 1}],
  'indent': 'off'
}

在main.js中使用如下代码

new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})

在components行会报如下错误 [eslint] Expected indentation of 4 spaces but found 2 spaces. (vue/script-indent)

如果使用如下缩进就不会出错

new Vue({
  el: '#app',
  router,
    components: {App},
  template: '<App/>'
})

但这跟standard的配置时相悖的

ldwqh0 commented 6 years ago

在我的团队中,一部分人使用webstorm,一部分人使用vscode, 插件的默认配置在vscode中表现良好,但在webstorm中,进行代码格式化时,script内的代码标签会缩进两行。

mysticatea commented 6 years ago

Thank you for this issue.

I can't read Chinese, but I guess this is a duplicate of #344 and #347. PR #346 has fixed it. Please wait for the next release.

dsx42 commented 6 years ago

@ldwqh0 你好,我也遇到了这个问题,请问您解决了这个问题没有?怎么解决的?

ldwqh0 commented 6 years ago

没有解决,我现在临时的做发是让大家不用WebStorm的格式化功能。改用webstorm的eslint自动修复功能来格式化代码,但效果不是很好,但最起码不会报错。 其实这个问题的核心就是 Githubissues.

  • Githubissues is a development platform for aggregating issues.