WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Shebang results in two newlines at the end of file #2430

@Spice-King

Description

@Spice-King

@prettier/plugin-php v0.22.4
Playground link

Input:

#! /usr/bin/env php
<?php
$status = 0; exit($status);

Output:

#! /usr/bin/env php
<?php
$status = 0;
exit($status);

The Markdown render is not showing the newlines, so check the Playground.

Gut instinct is that it might be triggering the code path for inline code, but not sure, so letting you tag it if it is (not that I can even add labels). I'm mulling over how minor or petty this is, but I think the inconsistency between files with & without a shebang and how no other formatter for Prettier has a double newline at the end of a file is enough of a reason.

Feel free to shoot this down if you have a reason to do so. If for nothing else, someone might stumble across this issue and not feel like they are going crazy as to why they get double newlines at the end of the file. If you want someone to blame, it's Laravel's artisan stub they put into your repo that got me going.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions