当前位置:网站首页>vscode保存代碼時自動eslint格式化
vscode保存代碼時自動eslint格式化
2022-06-11 17:08:00 【Boale_H】
背景
我們期望使用vscode編碼時,可以依據eslint規則,自動格式化我們的代碼。那麼可以通過設置vscode的自動格式化,來實現這一需求。
實現方式
安裝vscode插件Eslint

修改vscode設置
文件-首選項-設置,或通過ctrl + shift + p => 首選項:打開工作區設置,打開vscode設置界面
打開settings.json,添加下面的配置

{ "search.followSymlinks": false, "editor.tabSize": 2, //配置eslint "eslint.validate": [ "javascript", // 用eslint的規則檢測js文件 "javascriptreact", "vue", "html", ], // 啟用保存時自動修複eslint,默認只支持.js文件 "editor.codeActionsOnSave": { "source.fixAll.eslint": true } }
之後寫代碼的時候,保存代碼,vscode即可自動依據eslint規則對代碼格式化
文章參考:https://blog.csdn.net/halo1416/article/details/120945975
边栏推荐
- 做跨境电商卖什么产品好?热销类目有哪些?
- C language: use H and C. summary of problems encountered in documents
- Report on the operation situation and future prospects of China's gear oil industry (2022-2028)
- (验证文件)validateJarFile...报错
- seed-emulator下进行sql注入攻击(含sql环境配置)
- LeetCode-384. Scramble array
- Analyze which should be tested in PMP and ACP with actual cases? Which is more useful?
- C语言:使用.h和.c文件遇到的问题总结
- RSP: An Empirical Study of remote sensing pre training
- Leetcode 1974. Minimum time to type words using a special typewriter (yes, once)
猜你喜欢

^31 prototype interview questions

Global and Chinese molten carbonate fuel cell industry outlook and market panoramic Research Report 2022-2028

Elasitcsearch基础学习笔记(1)

Haas, which integrates relevant technologies of Alibaba cloud, Dharma Institute and pingtouge, has officially announced the book

Docker安装mysql5.7(开启binlog功能、修改字符)

Connection and difference of network streaming media protocol (RTP RTCP RTMP HLS)

Global and China Mobile Network Optimization (MnO) industry development panoramic survey and Investment Strategy Research Report 2022-2028

Pychart tips - how to set up a background picture

LeetCode——42. 接雨水(双指针)
![[pytest learning] after the pytest case fails to execute, the others will not be executed](/img/c7/52ae88cde65bdd12ae8b86df5c477f.png)
[pytest learning] after the pytest case fails to execute, the others will not be executed
随机推荐
MATLAB中histogram函数的使用
Cs0006 C failed to find metadata file "c:\users\... Problem
Oracle analysis function over and MySQL achieve similar effects
2022 molten welding and thermal cutting work license and simulation examination
我的CのERROR们
7 life tools: SWOT, PDCA, 6w2h, smart, WBS, time management, and the 28 principles
Leetcode-- array
Axi protocol Basics
[opencvsharp] spot detection barcode decoding image operation image rotation / flip / Zoom perspective transformation image display control demo notes
Rdkit installation
10 times faster than 5g. Are you ready for 10 Gigabit communication?
字符串转数值
solr(二)solr添加core以及依赖包路径
Database backup (MySQL)
Using MATLAB and dcraw to process digital camera raw files
Analysis report on sales status and supply and demand prospects of phosphoric acid fuel cell industry in the world and China 2022-2028 Edition
Leetcode 450. 删除二叉搜索树中的节点
Science popularization genius on the left, madman on the right
LeetCode-859. Intimate string
DFS and BFS notes (I) breadth first search based on C language