Lint
Check env syntax
lint
Checks your environment files for syntax errors and formatting issues.
Usage
env-mage lint [options]Options
| Option | Description | Default |
|---|---|---|
--file <path> | File to lint | .env |
--fix | Automatically fix issues | false |
--strict | Use stricter rules | false |
--quiet | Show only errors, no warnings | false |
Example
env-mage lint --file .env.production --fixExample Output
✓ Reading file: .env.production
⚠ Line 5: Unquoted value contains spaces: API_URL=http://my api.com
⚠ Line 8: Inconsistent variable name format: api_Secret
⚠ Line 12: Missing value: DEBUG=
⚠ Line 18: Duplicate key: API_URL
✓ Found 4 issues (0 errors, 4 warnings)
✓ Applying fixes...
✓ Fixed 3 issues (1 requires manual fix)
✓ Changes written to fileCommon Issues Detected
- Duplicate keys
- Unquoted values with spaces
- Empty values
- Invalid key names
- Inconsistent formatting
- Missing quotes
Things to Know
- Use
--fixto automatically resolve common issues --strictmode enforces consistent naming (UPPER_SNAKE_CASE)- Can be integrated into CI/CD pipelines
- Helps prevent runtime errors caused by malformed env files