ts+vue项目中,使用双引号提示黄色博览线警告,需要改为单引号,请问tslint中配置什么可以忽略这个双引号的警告呢
{
// 重新设定tabsize
"editor.tabSize": 4,
"prettier.tabWidth": 4, // 缩进字节数
// #每次保存的时候自动格式化
"editor.formatOnSave": true,
// #每次保存的时候将代码按eslint格式进行修复 ,"eslint.autoFixOnSave": true 这个已经过时了
"editor.codeActionsOnSave": {
"source.fixAll": true
},
// 添加 vue,ts 支持,官方是不推荐用这个,但是你为了是ts文件在vscode自动提示而不是文件编译才提示就必须加这个
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript"
{
"language": "vue",
"autoFix": true
}
],
// #默认是true加上分号,false是在有些容易出问题的地方(ASI failures)首部加分号
// 详细请看https://prettier.io/docs/en/rationale.html#semicolons
"prettier.semi": false,
// #使用单引号替代双引号,不生效就是eslint做了限制
"prettier.singleQuote": false,
// #让函数(名)和后面的括号之间加个空格
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"javascript.format.enable": false,
// #这个按用户自身习惯选择
"vetur.format.defaultFormatter.html": "js-beautify-html",
// #让vue中的js按编辑器自带的ts格式进行格式化
// 如果是ts就使用prettier-eslint ,这个需要cpm
// 这里提示ts没有eslint这个值。但是实测是生效的
"vetur.format.defaultFormatter.ts": "prettier-eslint",
"vetur.format.defaultFormatter.js": "prettier-eslint",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "force-expand-multiline",
"end_with_newline": false
// #vue组件中html代码格式化样式
}
},
"editor.fontSize": 16,
"terminal.integrated.rendererType": "dom",
"window.zoomLevel": 0,
"vscode_vibrancy.opacity": -1,
"vscode_vibrancy.theme": "Default Dark",
"glassit.alpha": 220,
"vscode_vibrancy.type": "acrylic",
"search.followSymlinks": false,
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"editor.detectIndentation": false,
"vetur.format.options.tabSize": 4,
}
quotes
建议vscode安装一个 eslint插件,鼠标移上去会提示你具体哪一个eslint规则