- Learn React with TypeScript 3
- Carl Rippon
- 174字
- 2021-06-10 19:16:40
Code formatting
In this section, we are going to install another extension in Visual Studio Code, called Prettier, which will automatically format our code. As well as putting a stop to all the ongoing debates over styles, it will help us adhere to some of the TSLint rules:
- Let's open Visual Studio Code, go to the Extensions area, and type prettier in the search box. The extension is called Prettier - Code formatter and was published by Esben Petersen:
- We need to click the Install option to install the extension.
- After it has been installed, we'll need to reload Visual Studio Code for the extension to become enabled.
- The last step is to make sure the Format on Save option is ticked in User Settings. Press Ctrl +, (comma) to open the settings screen and type Format On Save in the search box to find the setting. If the setting isn't ticked, then tick it:
Now that this extension is installed, when we save our TypeScript code, it will automatically be formatted nicely for us.
推薦閱讀
- Java程序設計與開發
- Advanced Machine Learning with Python
- 測試驅動開發:入門、實戰與進階
- 垃圾回收的算法與實現
- 摩登創客:與智能手機和平板電腦共舞
- Python深度學習
- JS全書:JavaScript Web前端開發指南
- Learning ELK Stack
- Learn React with TypeScript 3
- Integrating Facebook iOS SDK with Your Application
- Android群英傳
- JavaScript動態網頁編程
- Tableau Desktop可視化高級應用
- Python全棧開發:基礎入門
- Learning iOS Penetration Testing