【发布时间】:2020-09-13 03:01:16
【问题描述】:
我刚刚设置了我的开发环境,为 Vue.js 和 NUXTJS 安装了新安装的 linter & prettier 我已经检查了我的配置
npx eslint --print-config ./pages/index.vue | npx eslint-config-prettier-check
和
没有找到不必要或与 Prettier 冲突的规则。
当我写下类似以下内容和 eslint 弹出窗口并说,嘿,更漂亮的不希望你这样做时,有人知道为什么吗?在这种情况下,我不想让 linter 忽略,因为这种风格在我的代码中似乎很常见。任何帮助将不胜感激!
错误:
代码:
<h2 class="subtitle">
123 {{ env }} 123
</h2>
<h2 class="subtitle">
{{ env }}
</h2>
<h1 class="title">
reborn
</h1>
我的 .eslintrc.js 如下所示:
module.exports = {
root: true,
env: {
browser: true,
node: true
},
parserOptions: {
parser: 'babel-eslint'
},
plugins: ['prettier', 'vue'],
rules: {
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debuger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/max-attributes-per-line': 'off',
'nuxt/no-cjs-in-config': 'off'
},
globals: {
$nuxt: true
},
extends: [
'@nuxtjs',
'plugin:prettier/recommended',
'plugin:nuxt/recommended',
'plugin:vue/recommended',
'prettier',
'prettier/babel',
'prettier/vue',
'prettier/unicorn'
]
}
【问题讨论】:
-
在我看来,它在抱怨空格。你确定没有意外的空格吗?
-
漂亮的人已经为我做到了,所以不,在这种情况下不是。无论如何感谢您的回复!
标签: vue.js visual-studio-code eslint prettier eslint-config-vue