Catch missing and unused environment variables before they catch you.

vscode-dotenv-diff is a lightweight VS Code extension that warns you when your .ts or .js files reference environment variables that aren't defined in your .env file — and when your .env file has variables that are never used in your codebase.
Features
Missing variables in code

If your .ts or .js file references process.env.MY_KEY and MY_KEY is not defined in the nearest .env file, you'll see a warning underline directly in the editor.
Environment variable "MY_KEY" is not defined in .env
Unused variables in .env

If a key in your .env file is never referenced, the line is flagged with a warning.
Environment variable "MY_KEY" is defined in .env but never used
Monorepo support
The extension automatically finds the nearest .env file by walking up the directory tree from your source file. This means you can have multiple .env files in a monorepo and the extension will always compare against the correct one.
apps/
├── frontend/
│ ├── .env ← used for files inside frontend/
│ └── src/
│ └── app.ts
└── backend/
├── .env ← used for files inside backend/
└── src/
└── server.ts
Requirements
- VS Code
1.109.0 or higher
- A
.env file somewhere in your project tree
Extension settings
This extension has no configuration. It works out of the box.
Documentation
Full documentation is available in the docs/ folder:
Feedback & contributions
Issues and pull requests are welcome.
→ See CONTRIBUTING for details.
License
Licensed under the MIT license.
Created by chrilleweb