Skip to content

MD047 - single-trailing-newline

Description

This rule is triggered when there is no newline character at the end of a file. The file should end with exactly one newline character.

Rationale

Some programs have trouble with files that do not end with a newline. POSIX defines a line as a sequence of characters followed by a newline, so the final line without a newline is technically not a complete line. Additionally, when viewing files in a terminal or concatenating them, missing trailing newlines can cause unexpected formatting issues.