Set Up VS Code for JavaScript & TypeScript

Install the essential extensions, enable format-on-save, and wire up the debugger so VS Code is ready for a JS/TS project.

beginner10 minallUpdated August 2026
#vs-code#editor#javascript#typescript

Requirements

0/3 steps · 0%
01

Install the essential extensions

bash
$ code --install-extension dbaeumer.vscode-eslint
$ code --install-extension esbenp.prettier-vscode

Note

The code command needs to be on your PATH — in VS Code, run Shell Command: Install 'code' command in PATH from the Command Palette if it's missing.

02

Enable format-on-save

.vscode/settings.json
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}

Committing this file to the project means every contributor gets the same formatting behavior automatically.

03

Set up the debugger

.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug current file",
"program": "${file}",
"skipFiles": ["<node_internals>/**"]
}
]
}

Success

Open a file and press F5 — execution stops at your breakpoints instead of just printing to a console.

Troubleshooting

Another extension or a user-level setting is overriding the formatter for this language.

Open a file, run Format Document With... from the Command Palette, and check the list — it shows every formatter competing for that language.