prettier / prettier/plugin-php

Shebang results in two newlines at the end of file

Ouverte
#2,430 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
PHP
Étoiles
1.9k
Forks
139
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Reproduisez la sortie dans le Playground lié avec @prettier/plugin-php v0.22.4, en comparant l’exemple avec shebang à un fichier équivalent sans shebang. Suivez le chemin du formateur qui gère le shebang et vérifiez que le fichier formaté se termine par un seul saut de ligne final, et non par deux.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
php
Domaine
tooling
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.