env-lint-cli
v1.0.0
Published
Lint and validate your .env files against .env.example. Find missing vars, extra vars, and type mismatches instantly.
Maintainers
Readme
env-lint-cli 🔍
Lint and validate your
.envfiles against.env.example. Find missing vars, extra vars, empty values, and type mismatches instantly.
Why?
Ever deployed and realized you forgot to set DATABASE_URL? Or had a teammate onboard with a stale .env? env-lint catches these issues before they become runtime errors.
Install
npm install -g env-lint-cliUsage
# Compare .env with .env.example (default)
env-lint
# Compare specific files
env-lint .env.staging .env.example
# Full audit with type checking
env-lint --types --verbose
# Use in CI (fails on any issue)
env-lint --strictWhat it checks
| Check | Flag | Description |
|-------|------|-------------|
| Missing vars | always | Variables in .env.example but not in .env |
| Extra vars | always | Variables in .env but not in .env.example |
| Empty values | always | Vars that are empty but have example values |
| Type mismatches | --types | Different types between files (url vs string, boolean vs integer, etc.) |
Example Output
🔍 env-lint: comparing .env against .env.example
✗ 2 missing variable(s):
MISSING DATABASE_URL (example: postgresql://localhost:5432/mydb)
MISSING REDIS_URL (example: redis://localhost:6379)
⚠ 1 extra variable(s) not in example:
EXTRA DEBUG_MODE
⚠ 1 empty variable(s) that should have values:
EMPTY API_KEY (example: your-api-key-here)
2 error(s) | 2 warning(s) | 3/5 variables matchedOptions
-t, --types Check type consistency between files
-v, --verbose Show detailed variable listing
-s, --strict Treat warnings as errors (for CI)
-h, --help Show help
--version Show versionCI Integration
# GitHub Actions
- run: npx env-lint-cli --strict// package.json
{
"scripts": {
"env:check": "env-lint --strict"
}
}License
MIT © kszongic
Support
If this tool saved you from a deployment disaster, consider sponsoring! ❤️
