Back to all rules / Format and vendor rules

final-newline

File with line breaks does not end with one.

note by default Format and vendor rules Safe fix offered Inline suppression allowed

Source: pubs.opengroup.org (pubs.opengroup.org), read 14 October 2026.

On GitHub: the rule doc and the tests.

Jump to another rule89

What it catches#

File with line breaks does not end with one.

A file that has more than one line but does not end with a line break. It is a note, offered so its safe fix can be applied with the others; no agent misreads the file because of it. With --format github notes are not annotated unless you pass --annotate-notes.

Why it matters#

POSIX defines a line as ending with a newline. Text appended later with echo >> or by an agent joins the last line instead of starting a new one.

Bad example#

$ tail -c 20 CLAUDE.md | od -c | tail -2
... u   s   e       p   n   p   m   .

echo "Run the linter." >> CLAUDE.md now produces use pnpm.Run the linter. on one line, and so does an agent that appends a rule the same way.

Good example#

$ tail -c 1 CLAUDE.md | od -c
0000000  \n

How to fix#

Add a line break at the end, using the same line ending as the rest of the file. asitis lint --fix-preview=safe prints that diff. Most editors have an "insert final newline" setting.

asitis can make this edit for you. asitis lint --fix-preview prints a unified diff that git apply accepts, and the suggest_fixes MCP tool returns the same diff; nothing is written to disk by either. The fix for this rule is marked safe: it does not change what the file says.

Suppress or configure#

For one finding, put a comment on the line above it. The reason after -- is optional but worth writing:

<!-- asitis-disable-next-line final-newline -- why this one is fine -->

For a whole file:

<!-- asitis-disable-file final-newline -- why this file is an exception -->

For every file, turn it off or change its severity in .asitisrc.json:

{ "rules": { "final-newline": "off" } }

A .asitisrc.json overrides entry limits a change to some paths, and a baseline (asitis lint --format json --write-baseline) accepts today's findings so only new ones fail the build.

Source#

pubs.opengroup.org, read on 14 October 2026.

See what an agent changed in your CLAUDE.md. Keep or revert each change.

The linter is free and needs no signup. I'm also building a desktop editor for the markdown your agents write and read. It shows what an agent changed since you last looked, lets you keep or revert each change, and never touches a line you didn't edit. No release date yet. One email to confirm, one when the paid beta opens, one when 1.0 ships. $29 once for a founding licence, with 24 months of updates.

Or add the linter to CI, no email needed.

Your address is stored with Cloudflare, which hosts this site. No IP address is kept. See the privacy policy.

Back to all rules

This page is generated from the plugin's rule registry. Edit it on GitHub. False positive? Open an issue with the line it fired on.