当前位置:网站首页>vscode 根据 ESLint 规范自动格式化代码
vscode 根据 ESLint 规范自动格式化代码
2022-07-01 07:11:00 【柯晓楠】
在项目根目录新建一个名为 .vscode 文件夹,在该文件夹中新建 settings.json 配置文件,具体配置如下:
{
"eslint.validate": [
"javascript",
{
"language": "html",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
}
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": true
},
"eslint.format.enable": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.fixAll.eslint": true
}
}
配置完成后,在编辑器中直接保存代码就可以实现代码格式化,或者是按钮 shift + alt + F 格式化代码快捷键。
如果vscode本地配置不需要上传到代码库,还需要在项目根目录的
.gitignore文件中添加上.vscode
边栏推荐
- 北漂程序员深夜emo发帖求助:女朋友走了我很孤独 ......
- Reply and explanation on issues related to "online training of network security education in 2022"
- 【Tikhonov】基于Tikhonov正则化的图像超分辨率重建
- 关于“2022年度网络安全教育线上培训”相关问题的复盘和说明
- Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)
- AI视频智能平台EasyCVR设备录像出现无法播放现象的问题修复
- Ctfhub port scan (SSRF)
- Solve the problem of "unexpected status code 503 service unavailable" when kaniko pushes the image to harbor
- Insufficient free space after clearing expired cache entries - consider increasing the maximum cache space
- ctfshow-web351(SSRF)
猜你喜欢

C语言实现【三子棋游戏】(步骤分析和实现源码)

Système de gestion de l'exploitation et de l'entretien, expérience d'exploitation humanisée

ctfshow-web351(SSRF)

C语言实现【扫雷游戏】完整版(实现源码)

Problem: officeexception: failed to start and connect (III)

Illusory and simple screen raindrop post-processing effect

Dirty reading, unreal reading and unrepeatable reading

电脑有网络,但所有浏览器网页都打不开,是怎么回事?

Spark入门(一篇就够了)

【图像处理】图像直方图均衡化系统含GUI界面
随机推荐
如何进入互联网行业,成为产品经理?没有项目经验如何转行当上产品经理?
buildroot override 机制
STM32F1与STM32CubeIDE编程实例-NEC协议红外接收与解码
ctfshow-web354(SSRF)
Cadence OrCAD Capture “网络名”相同,但是未连接或连接错误的解放方案之nodename的用法
记一次线上接口慢查询问题排查
Webapck packaging principle -- Analysis of startup process
[Electrical dielectric number] electrical dielectric number and calculation considering HVDC and facts components
DC-4 target
[recommendation technology] matlab simulation of network information recommendation technology based on collaborative filtering
运维管理系统,人性化操作体验
JSP - paging
Summary of the concept and advantages of 5g massive MIMO
Spark入门(一篇就够了)
广发证券开户是安全可靠的么?怎么开广发证券账户
【剑指offer&牛客101】中那些高频笔试,面试题——链表篇
Product learning (I) - structure diagram
为什么这么多人转行产品经理?产品经理发展前景如何?
在长城证券上做基金定投安全吗?
Docker installation and deployment redis