Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Shebang results in two newlines at the end of file

Aperta
#2,430 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php
Ambito
tooling

Direzione di ricerca

Riproduci l’output nel Playground collegato usando @prettier/plugin-php v0.22.4, confrontando l’esempio con shebang con un file equivalente senza shebang. Segui il percorso del formatter che gestisce lo shebang e verifica che il file formattato termini con un solo newline finale anziché con due.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

@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.

Lingua principale
PHP
Stelle
1.9k
Fork
139
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di prettier/plugin-php

Tutte le issue di prettier/plugin-php

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.