【发布时间】:2019-07-25 22:24:32
【问题描述】:
我正在使用 Visual Studio Code 和更漂亮的 vue,它弄乱了我的插值。每次我保存它时,都会在将花括号与内容放在新行之间切换,或者将它们与标签放在同一行上,并且只将内容放在新行上。
有一段时间他们会一致交换,所以我只需要在提交版本控制之前确保它处于正确的状态。现在,这两个处于相反的周期,因此其中一个总是错误的。
(我正在使用 Bootstrap-Vue 和 i18n 本地化)
保存 1
<b-col>
<b-button type="button" v-on:click="done()">
{{ $t('Done') }}
</b-button>
</b-col>
<b-col>
<b-button type="button" v-on:click="cannotComplete()">{{
$t('CannotComplete')
}}</b-button>
</b-col>
保存 2
<b-row>
<b-col>
<b-button type="button" v-on:click="done()">{{
$t('Done')
}}</b-button>
</b-col>
<b-col>
<b-button type="button" v-on:click="cannotComplete()">
{{ $t('CannotComplete') }}
</b-button>
</b-col>
</b-row>
更漂亮的配置
module.exports = {
singleQuote: true,
semi: false
}
eslintConfig
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'plugin:prettier/recommended',
'@vue/prettier',
'prettier'
],
plugins: ['prettier'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'off' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'prettier/prettier': ['error']
},
parserOptions: {
parser: 'babel-eslint'
}
}
【问题讨论】:
标签: vue.js visual-studio-code eslint vscode-settings prettier