- 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.
推薦閱讀
- Microsoft Dynamics 365 Extensions Cookbook
- Web交互界面設計與制作(微課版)
- aelf區塊鏈應用架構指南
- Mastering Ubuntu Server
- C語言課程設計
- Getting Started with Gulp
- 零基礎入門學習Python(第2版)
- JavaScript腳本特效編程給力起飛
- C++ Fundamentals
- Microsoft HoloLens By Example
- XML程序設計(第二版)
- Learn Linux Quickly
- Access 2016數據庫應用與開發:實戰從入門到精通(視頻教學版)
- Java EE框架開發技術與案例教程
- Java Web程序開發參考手冊