配置Prettier与Es-lint格式化兼容
Posted 萌萌的DDD
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置Prettier与Es-lint格式化兼容相关的知识,希望对你有一定的参考价值。
-
{
"workbench.iconTheme": "vscode-icons",
"workbench.colorTheme": "Atom One Dark",
"files.eol": "\\n",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 10000,"timeline.pageSize": 0,
"window.zoomLevel": 0,
"http.proxy": "",
"http.proxyAuthorization": null,
// 注意,一定要是false,要不然保持的时候会被格式化2次且因为(editor.codeActionsOnSave)要eslint来修改代码不再用vscode自己来修复代码。
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},// 这块的设置时基础,在项目下的.editorconfig文件中也有设置,该配置会覆盖本文件的配置
// tab锁紧缩进 和 空格变成......
"editor.tabSize": 2,
"editor.renderWhitespace": "all",
"editor.renderControlCharacters": true,// 代码检查Eslint,ESLint插件检测、自动修复机制,依赖当前目录下.eslintignore和.eslintrc.js
// "eslint.enable": true,
"eslint.options": {
"extensions": [".js", ".vue"]
},// vue组件中css提示
"emmet.triggerExpansionOnTab":true,
"emmet.syntaxProfiles":{
"vue-html": "html",
"vue": "html"
},// editor.codeActionsOnSave替代了本功能
// "eslint.autoFixOnSave": true,// 要注释掉,因为要使用prettier来格式化修复
// "eslint.validate": [
// "javascript",
// "javascriptreact",
// {
// "language": "html",
// "autoFix": true
// },
// {
// "language": "vue",
// "autoFix": true
// }
// ],// vetur格式设置
"vetur.validation.template": false,
"vetur.validation.script": false,
"vetur.validation.style": false,
"vetur.format.defaultFormatter.js": "none",
"vetur.format.defaultFormatter.html": "none",// Prettier - Code formatter 代码格式化,详细些的配置在项目文件.prettierrc中设置
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"hediet.vscode-drawio.local-storage": "eyIuZHJhd2lvLWNvbmZpZyI6IntcImxhbmd1YWdlXCI6XCJcIixcImN1c3RvbUZvbnRzXCI6W10sXCJsaWJyYXJpZXNcIjpcImdlbmVyYWxcIixcImN1c3RvbUxpYnJhcmllc1wiOltcIkwuc2NyYXRjaHBhZFwiXSxcInBsdWdpbnNcIjpbXSxcInJlY2VudENvbG9yc1wiOltdLFwiZm9ybWF0V2lkdGhcIjowLFwiY3JlYXRlVGFyZ2V0XCI6ZmFsc2UsXCJwYWdlRm9ybWF0XCI6e1wieFwiOjAsXCJ5XCI6MCxcIndpZHRoXCI6ODI3LFwiaGVpZ2h0XCI6MTE2OX0sXCJzZWFyY2hcIjp0cnVlLFwic2hvd1N0YXJ0U2NyZWVuXCI6dHJ1ZSxcImdyaWRDb2xvclwiOlwiI2QwZDBkMFwiLFwiZGFya0dyaWRDb2xvclwiOlwiIzZlNmU2ZVwiLFwiYXV0b3NhdmVcIjp0cnVlLFwicmVzaXplSW1hZ2VzXCI6bnVsbCxcIm9wZW5Db3VudGVyXCI6MCxcInZlcnNpb25cIjoxOCxcInVuaXRcIjoxLFwiaXNSdWxlck9uXCI6ZmFsc2UsXCJ1aVwiOlwiXCJ9In0=",
"todo-tree.highlights.customHighlight": {
//说明在标识处有功能代码待编写
"TODO": {
// "icon": "check",
"foreground": "red",
"iconColour": "red",
"gutterIcon": true,
"type": "line"
},
//说明标识处代码需要修正
"FIXME": {
"foreground": "yellow",
"iconColour": "yellow",
"gutterIcon": true,
"type": "line"
}
},// path-intellisense插件代码引入路径提示及代码补全提示,配置完该部分后还要创建jsconfig.json并在其中配置
"path-intellisense.extensionOnImport": true,
"javascript.updateImportsOnFileMove.enabled": "never",
"diffEditor.ignoreTrimWhitespace": false,
"vsicons.dontShowNewVersionMessage": true,
"workbench.welcomePage.hiddenCategories": [
"Setup",
"Beginner"
]
}
以上是关于配置Prettier与Es-lint格式化兼容的主要内容,如果未能解决你的问题,请参考以下文章