vscode 红线爆红问题
作者:互联网
首先,安装插件:Vetur,ESLint,Prettier
然后,打开设置文件:settings.json
设置完后,ctrl+s 自动格式化去掉红线
{ "sync.gist": "7f58d878baccb6292df82aaacbe07902", "sync.autoDownload": true, "sync.quietSync": true, "sync.forceUpload": true, "sync.forceDownload": true, "sync.autoUpload": true, "workbench.colorTheme": "Monokai", "[json]": { "editor.quickSuggestions": { "strings": true }, "editor.suggest.insertMode": "replace" }, "[vue]": { "editor.defaultFormatter": "octref.vetur" }, "beautify.language": { "js": { "type": [ "javascript", "json", "jsonc" ], "filename": [ ".jshintrc", ".jsbeautifyrc" ] }, "css": [ "css", "less", "scss" ], "html": [ "htm", "html", "vue" ] }, "js/ts.implicitProjectConfig.experimentalDecorators": true, // vscode默认启用了根据文件类型自动设置tabsize的选项 "editor.detectIndentation": false, // 重新设定tabsize "editor.tabSize": 2, // 每次保存的时候自动格式化 "editor.formatOnSave": true, // 每次保存的时候将代码按eslint格式进行修复 "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, // 在函数名和后面的括号之间加个空格 "javascript.format.insertSpaceBeforeFunctionParenthesis": true, // 每次保存的时候将代码按eslint格式进行修复,新版用editor.codeActionsOnSave "eslint.autoFixOnSave": true, // 添加vue支持 "eslint.validate": [ "html", "javascript", "javascriptreact", "language": "vue" ], // 让prettier使用eslint的代码格式进行校验(新版缺少该属性) "prettier.eslintIntegration": true, // 使用单引号替代双引号 "prettier.singleQuote": true, // 去掉代码结尾的分号 "prettier.semi": false, // 按用户习惯填写(这里举例用js-beautify-html) "vetur.format.defaultFormatter.html": "js-beautify-html", // 让vue中的js按编辑器自带的ts格式进行格式化 "vetur.format.defaultFormatter.js": "vscode-typescript", "vetur.format.defaultFormatterOptions": { "js-beautify-html": { "wrap_attributes": "force-aligned" } }, // [选填]用于格式化stylus的选项, 需要先安装Manta's Stylus Supremacy插件 /* "stylusSupremacy.insertColons": false, //是否插入冒号 "stylusSupremacy.insertSemicolons": false, //是否插入分号 "stylusSupremacy.insertBraces": false, //是否插入大括号 "stylusSupremacy.insertNewLineAroundImports": false, //import之后是否换行 "stylusSupremacy.insertNewLineAroundBlocks": false //两个选择器中是否换行 */ }
标签:false,vscode,sync,js,爆红,html,editor,红线,true 来源: https://www.cnblogs.com/bearSky/p/14902050.html