- 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.
推薦閱讀
- CentOS 7 Linux Server Cookbook(Second Edition)
- C語言程序設計教程(第2版)
- Java Web基礎與實例教程
- Asynchronous Android Programming(Second Edition)
- Unity 2D Game Development Cookbook
- 西門子S7-200 SMART PLC編程從入門到實踐
- CoffeeScript Application Development Cookbook
- Kotlin開發教程(全2冊)
- SQL Server 2008 R2數據庫技術及應用(第3版)
- .NET 4.5 Parallel Extensions Cookbook
- JBoss:Developer's Guide
- Arduino可穿戴設備開發
- Drupal 8 Development:Beginner's Guide(Second Edition)
- 深度學習入門:基于Python的理論與實現
- Offer來了:Java面試核心知識點精講(框架篇)