claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

How to avoid 'no newline at end of file' efficiently?

Open sorah opened this issue 7 months ago • 1 comments

Our code style prohibits no new line at end of file, OTOH, prohibits no leading \n at the end of text files.

I have tried several prompts in CLAUDE.md but it appears to be ignored. When I remind that the prompt has been ignored, Claude Code tries to echo >> ... for every changed file, which is inefficient.

Are there any chance to ensure \n at the end when writing files on tools' end?

sorah avatar Jun 12 '25 11:06 sorah

didn't find any similar issue but the workflow gives me no pointer to it :/

sorah avatar Jun 13 '25 14:06 sorah

Possible duplicate of https://github.com/anthropics/claude-code/issues/2707 which has more discussion and some alleged workarounds.

fsc-eriker avatar Sep 09 '25 11:09 fsc-eriker