ESlint作为前端开发的有力格式修改工具,配置规则还是很重要的,记录一下我的配置规则,防止某天换电脑找不到。
{
"eslint.codeAction.showDocumentation": {
"#ff0000"
"enable": true
}
"editor.renderIndentGuides": false,
"path-intellisense.mappings": {
"@": "${workspaceRoot}/src"
},
"autoprefixer.ignoreFiles": [
"ie >= 6", //ie6以上
"firefox >= 8",
"chrome >= 24",
"Opera>=10"
],
"workbench.tree.indent": 4,
"git.path": "C:\\Program Files\\Git\\cmd\\git.exe",
"git.enableSmartCommit": true,
"editor.tabSize": 2,
// 100 列后换行git.exe
"editor.wordWrapColumn": 100,
// 保存时格式化
"editor.formatOnSave": true,
// #每次保存的时候将代码按eslint格式进行修复
"editor.codeActionsOnSave": { "source.fixAll.eslint": false },
// 开启 vscode 文件路径导航
"breadcrumbs.enabled": true,
// prettier 设置语句末尾不加分号
"prettier.semi": false,
// prettier 设置强制单引号
"prettier.singleQuote": true,
// 去掉对象最后的逗号
"prettier.trailingComma": "none",
// 选择 vue 文件中 template 的格式化工具
"vetur.format.defaultFormatter.html": "prettyhtml",
// 显示 markdown 中英文切换时产生的特殊字符
"editor.renderControlCharacters": true,
// eslint 检测文件类型
"eslint.validate": [
"vue",
"html",
"javascript",
"typescript",
"javascriptreact",
"typescriptreact"
],
// vetur 的自定义设置
"vetur.format.defaultFormatterOptions": {
"prettier": {
"singleQuote": true,
"semi": false
}
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace",
"gitlens.codeLens.scopes": [
"document"
]
}
}