.vue无法更好地使用VS Code扩展名。我的意思是如何设置漂亮的文件,使其与eslint集成并格式化Cmd+Shift+P -> Format Document
上的.vue文件。 .eslintrc.js
:
module.exports = {
root: true,
env: {
browser: true,
},
extends: [
'plugin:vue/essential',
'standard'
],
plugins: [
'vue'
]
}
答案 0 :(得分:1)
您需要像这样在.eslintrc.js
文件中定义这些规则:
module.exports = {
root: true,
env: {
node: true
},
extends: ["plugin:vue/essential", "@vue/prettier"],
rules: {
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
"prettier/prettier": [
"warn",
{
"singleQuote": true,
"semi": false,
"trailingComma": "none"
}
]
},
parserOptions: {
parser: "babel-eslint"
}
};
答案 1 :(得分:0)
您可以在根目录中添加.prettierrc.json文件,然后
{
"singleQuote": true,
"tabWidth": 2,
"semi": false
}
答案 2 :(得分:0)