- 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.
推薦閱讀
- JSP網絡編程(學習筆記)
- Getting started with Google Guava
- Mastering Ember.js
- .NET 4.0面向對象編程漫談:基礎篇
- Web開發的貴族:ASP.NET 3.5+SQL Server 2008
- JavaScript+jQuery開發實戰
- Learning ArcGIS Pro
- Microsoft System Center Orchestrator 2012 R2 Essentials
- C#開發案例精粹
- Hands-On Nuxt.js Web Development
- 3ds Max印象 電視欄目包裝動畫與特效制作
- Learning Ionic
- jQuery技術內幕:深入解析jQuery架構設計與實現原理
- After Effects CC技術大全
- Developing Java Applications with Spring and Spring Boot