Env-mage Docs

Lint

Check env syntax

lint

Checks your environment files for syntax errors and formatting issues.

Usage

env-mage lint [options]

Options

OptionDescriptionDefault
--file <path>File to lint.env
--fixAutomatically fix issuesfalse
--strictUse stricter rulesfalse
--quietShow only errors, no warningsfalse

Example

env-mage lint --file .env.production --fix

Example 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 file

Common Issues Detected

  • Duplicate keys
  • Unquoted values with spaces
  • Empty values
  • Invalid key names
  • Inconsistent formatting
  • Missing quotes

Things to Know

  • Use --fix to automatically resolve common issues
  • --strict mode enforces consistent naming (UPPER_SNAKE_CASE)
  • Can be integrated into CI/CD pipelines
  • Helps prevent runtime errors caused by malformed env files