prettier/prettier

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

Aperta

#5352 aperta il 5 nov 2018

 (4 commenti) (0 reazioni) (0 assegnatari)JavaScript (4983 fork)batch import
help wantedlang:javascript

Metriche repository

Star
 (52.203 stelle)
Metriche merge PR
 (Merge medio 6g) (186 PR mergiate in 30 g)

Descrizione

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.

Guida contributor