EnvCheck
Local environment checks for VS Code. Find missing variables, duplicate declarations and invalid values before starting your application.
Getting started
- Install
envcheck-1.0.0.vsix using Extensions → … → Install from VSIX.
- Open your project folder.
- Run EnvCheck: Create Validation Rules from the Command Palette.
- Adjust
.envcheck.json to your application's actual requirements.
- Open your
.env file. Diagnostics appear in the editor, Problems panel and EnvCheck section of Explorer.
The extension scans on startup and updates after edits and file changes. Click its status bar item to scan manually. Each workspace folder has its own root .envcheck.json. Nested environment files use that folder's rules and a reference example in their own directory.
Rules
{
"rules": {
"PORT": { "type": "integer", "required": true, "min": 1, "max": 65535 },
"DATABASE_URL": { "type": "string", "required": true, "secret": true },
"NEXT_PUBLIC_API_BASE_URL": { "type": "url", "required": true },
"NODE_ENV": { "type": "string", "enum": ["development", "test", "production"] }
}
}
Types: string, integer, number, boolean (literal true/false), url (HTTP/HTTPS). Use string for PostgreSQL or other non-HTTP connection strings. Numeric min and max constrain numbers. enum accepts a list of strings. required checks presence and non-empty values; allowEmpty permits an empty required value. required: false exempts a key from reference-file presence checks.
Rules are explicit. EnvCheck does not guess requirements from variable names. The generated rules are examples: remove or adapt them before use.
Reference files
By default, .env.example in the same directory supplies required variable names. Values in it are not used to infer types. .example and .sample files are excluded from environment validation. Missing variables have a quick fix to append a blank declaration; fill the value yourself.
Safe example generation
Open a .env file and run EnvCheck: Generate Safe .env.example. Choose the destination. Every value is blank, including non-secret values. Existing output requires confirmation and the source cannot be overwritten. Variable names from rules are included. Unsupported syntax blocks generation so keys are not silently omitted.
Settings
envcheck.enabled: enable diagnostics.
envcheck.exampleFile: reference file name, default .env.example.
envcheck.maxFiles: scan cap per workspace folder, default 200.
Generated/build/dependency folders are excluded. The cap applies to discovered .env* paths, including reference files. Large projects can increase it. No workspace folder means no scan.
Privacy and limitations
No network calls, telemetry, external server or account. File values are never included in diagnostic text or generated examples. secret is descriptive metadata; all values receive the same protection.
Supports standard single-line assignments, export, quoted values, comments and CRLF. Interpolated values are flagged as not statically validated. Multiline quoted values are unsupported and may produce additional syntax diagnostics; use your application's own dotenv parser for those files. This extension does not reproduce every framework's variable expansion or precedence rules, validate server environments, test database connections or enforce secrets policy.
Development
Node.js 20+ recommended. No runtime npm dependencies.
npm test
npm run check
npm run package
Packaging uses official @vscode/vsce. Source is JavaScript and runs in the workspace extension host, including remote workspaces. No web-extension support. Tests cover the core engine; run the manual checks below to verify VS Code UI on your machine.
Manual verification
- Create
.env.example containing PORT= and API_URL=.
- Create
.env containing PORT=abc.
- Configure PORT as integer and API_URL as required URL.
- Verify missing API_URL and invalid PORT in Problems and Explorer.
- Apply the missing-variable quick fix and fill
API_URL=https://example.com.
- Change PORT to 3000; diagnostics should clear.
- Add a duplicate PORT and verify the second declaration is flagged.
- Generate an example from a file containing secrets; check every value is blank.
- Test a workspace with two folders and different rules.
- Disable EnvCheck; diagnostics and status bar should disappear.
MIT license. Publisher: infinityinnovationsdev.