Comment Warnings
Comment warnings flag .env.example keys that lack a documenting comment. A well
documented .env.example is the fastest onboarding for a new contributor. This check
is opt-in and off by default.
What Counts as Documented
A key is documented when either:
- it has an inline
#comment after the value, or - a real
#comment sits in the run of comment lines directly above it.
Rules
- The comment must be directly above the key, or inline after the value.
- A blank line ends the run — a comment above a blank line does not document the key below it.
@expireannotation lines are transparent: a bare# @expire 2026-12-31is not documentation on its own, but a real comment above it still documents the key.- A shared section header such as
# === Database ===counts only for the first key directly beneath it — keys further down are still reported.
Enable / Disable
Off by default. Enable it via CLI:
Or in dotenv-diff.config.json:
See also
- Writing a Good .env.example — a full example file that passes this check.
- Expiration Warnings — why
--comment-warningspairs well with@expire. - Optional Keys — the
@optionalannotation.