- 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.
推薦閱讀
- 手機(jī)安全和可信應(yīng)用開發(fā)指南:TrustZone與OP-TEE技術(shù)詳解
- Node.js+Webpack開發(fā)實(shí)戰(zhàn)
- Delphi程序設(shè)計(jì)基礎(chǔ):教程、實(shí)驗(yàn)、習(xí)題
- 無代碼編程:用云表搭建企業(yè)數(shù)字化管理平臺(tái)
- Rust編程從入門到實(shí)戰(zhàn)
- Python語言程序設(shè)計(jì)
- Java Web應(yīng)用開發(fā)技術(shù)與案例教程(第2版)
- 名師講壇:Java微服務(wù)架構(gòu)實(shí)戰(zhàn)(SpringBoot+SpringCloud+Docker+RabbitMQ)
- C程序設(shè)計(jì)案例教程
- 大模型RAG實(shí)戰(zhàn):RAG原理、應(yīng)用與系統(tǒng)構(gòu)建
- ExtJS高級(jí)程序設(shè)計(jì)
- 后臺(tái)開發(fā):核心技術(shù)與應(yīng)用實(shí)踐
- Clojure High Performance Programming(Second Edition)
- MongoDB Administrator’s Guide
- Building Apple Watch Projects