1. Navigate to the Settings page of VS Code:
- Windows: File > Preferences > Settings (hotkeys: Ctrl + ,)
- Mac: Code > Preferences > Settings (hotkeys: Command + ,)
3. Do the same thing in the “TypeScript > Preference: Quote Style” section. Choose “single” or “double” from the dropdown menu:
4. If you’re using Prettier, check/uncheck the checkboxes in the “Prettier: Jsx Single Quote” and “Prettier: Single Quote” sections. I prefer single quotes to double quotes so that I will check these checkboxes:
From this time forward, you can change all double quotes to single quotes automatically in the blink of an eye by using the following shortcuts:
- Mac: Option + Shift + F
- Windows: Alt + Shift + F
import axios from "axios"
import axios from 'axios'
If you aren’t familiar with auto-formatting code in VS Code, see this article: How to Format Code in VS Code (Visual Studio Code).
That’s it. Further reading:
- VS Code: How to Position/Align the Bottom Panel
- VS Code: Quickly Move Focus between Code File and Terminal
- VS Code: How to Collapse/Expand Blocks of Code
- VS Code: How to Pin/Unpin a File (2 Approaches)
- React + TypeScript: Making a Reading Progress Indicator
You can also check out our Visual Studio Code topic page for more tips and tricks to improve your producibility and coding experience.