prettier/prettier

requirePragma doesn't work if @prettier pragma comes after other pragmas like @flow

Aberta

#5.352 aberto em 5 de nov. de 2018

 (4 comentários) (0 reação) (0 responsável)JavaScript (4.983 forks)batch import
help wantedlang:javascript

Métricas do repositório

Stars
 (52.203 estrelas)
Métricas de merge de PR
 (Mesclagem média 6d) (186 fundiu PRs em 30d)

Description

Environments:

  • Prettier Version: 1.14.3
  • Running Prettier via: atom prettier package

Steps to reproduce: (Put "requirePragma": true in .prettierrc)

// @flow
/**
 * @prettier
 */

     const    foo =    bar   +   baz

Expected behavior: Prettier formats the file

Actual behavior: Prettier doesn't format the file, unless I move the @prettier pragma to the top.

The problem

Any tools that require their pragma to be the very first comment will not work together. So to be a good citizen of the ecosystem, prettier must accept its pragma in any position among the file's leading comments.

Guia do colaborador