VScode eslint 格式化问题

eslint检测开启时会检测行末尾分号等,vscode 自动格式化会自动添加分号,括号,单引号变成双引号等,为了方便编码,需要进行一系列配置

1、vscode插件添加exlint

2、vscode界面菜单: 文件->首选项->设置,进入settings.json,修改配置为:

{

"eslint.autoFixOnSave": true,

"eslint.validate": [

"javascript",

"javascriptreact",

{

"language": "html",

"autoFix": true

},

{

"language": "vue",

"autoFix": true

}

],

"stylusSupremacy.insertColons": true, // 是否插入冒号

"stylusSupremacy.insertSemicolons": false, // 是否插入分号

"stylusSupremacy.insertBraces": false, // 是否插入大括号

"stylusSupremacy.insertNewLineAroundImports": false, // import之后是否换行

"stylusSupremacy.insertNewLineAroundBlocks": false, // 两个选择器中是否换行

"vetur.format.defaultFormatter.js": "vscode-typescript",

"vetur.format.defaultFormatter.ts": "vscode-typescript"

}

猜你喜欢

转载自blog.csdn.net/TIANDI0808/article/details/84568496
今日推荐