prettier / prettier/plugin-php

Shebang results in two newlines at the end of file

Abierto
#2,430 0 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
PHP
Estrellas
1.9k
Forks
139
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce la salida en el Playground enlazado usando @prettier/plugin-php v0.22.4, comparando el ejemplo con shebang con un archivo equivalente sin shebang. Sigue la ruta del formateador que gestiona el shebang y verifica que el archivo formateado termine con un salto de línea final, no con dos.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
php
Área
tooling
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.