vue3项目的配置文件
工作区插件
- 工作区插件:
.vscode\extensions.json
{
"recommendations": [
"vue.volar",
"vue.vscode-typescript-vue-plugin",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"usernamehw.errorlens",
"editorconfig.editorconfig"
]
}
工作区设置
-
工作区设置:
.vscode\settings.json
-
指定格式化程序
-
eslint
配置 -
行尾配置
-
空格缩进个数
-
等...
-
{
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.enable": true,
"eslint.run": "onType",
"eslint.options": {
"extensions": [
".js",
".ts",
".vue",
".jsx",
".tsx"
]
},
// 操作时作为单词分隔符的字符
"editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?",
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.fixAll.eslint": true
},
// 一个制表符等于的空格数
"editor.tabSize": 2,
"files.eol": "\n",
"explorer.compactFolders": false
}
格式化配置
根目录下新建文件: .prettierrc
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"printWidth": 80
}
根目录下新建文件:.gitattributes
* text eol=lf
*.txt text eol=lf
根目录下新建文件:.editorconfig
# editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
quote_type = single