Comment spacing#

Comments must have no leading whitespace and exactly one space after #.

Before ❌

 # You are reading a comment
#You are reading a comment

After ✅

# You are reading a comment

Comment style#

Use # for comments.

Before ❌

! You are reading a comment

After ✅

# You are reading a comment

Comment trimming#

Empty comments at the beginning or end of a comment block with content must be removed. Empty comments between non-empty comments are allowed as separators. A block containing only empty comments is handled by no-empty-comment.

Before ❌

#
# one
#

After ✅

# one

No empty comment#

Comment blocks must have content. A block containing only empty comments is invalid. If a block contains at least one non-empty comment, leading or trailing empty comments are handled by comment-trimming, and interior empty comments are allowed as separators.

Before ❌

#
#

After ✅

No dangling continuation#

Files cannot end with a dangling line continuation. A backslash (\) at the end of a line continues the entry onto the next line, so it must be followed by one.

Before ❌

multiline=line1\

escape=this is backslash \

After ✅

multiline=line1\
line2

escape=this is backslash \\

Separator style#

Entries must use = as the key/value separator.

Before ❌

key:value

After ✅

key=value

Valid escape#

Entries must have valid escape sequences. For example, unicode escapes must include four hexadecimal digits (\u1234, not \u123).

Before ❌

unicode=\u123

After ✅

unicode=\u1234

Key name#

Keys can follow snake_case, camelCase or kebab-case, but not UPPERCASE.

Before ❌

ITEM=value

DATABASE_USER=admin

After ✅

item=value

database.user=admin

Key order#

Keys must be in alphabetical order, case-insensitively.

Before ❌

item2=value
item1=value

After ✅

item1=value
item2=value

No duplicate key#

Duplicate keys are not allowed.

Before ❌

item=value
item=other

After ✅

item1=value
item2=other

No empty key#

Keys cannot be empty.

Before ❌

=value

After ✅

item=value

No empty value#

Values cannot be empty.

Before ❌

item=

After ✅

item=value

Entry trimming#

Keys and values cannot have leading or trailing whitespace.

Before ❌

 item = value

After ✅

item=value

No duplicate blank line#

Consecutive blank lines are not allowed.

Before ❌

item1=value


item2=other

After ✅

item1=value

item2=other

No leading blank line#

File cannot start with a blank line.

Before ❌


item=value

After ✅

item=value

Trailing newline#

File must end with a newline character.

Before ❌

item=value

After ✅

item=value
↵