Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Discussion options

You must be logged in to vote

Yes, filenames is the right mechanism, and it does beat extension inference. When Prettier infers a language for a file it matches in two passes: first it checks every language's filenames for an exact basename match, and only if nothing matched does it fall back to matching extensions. So a plugin language with filenames: ["something.js"] wins over the built-in JavaScript language for a file named something.js, even though .js would otherwise match babel. Plugin languages also take priority over the core ones (the search list is built with the plugins reversed, so later-loaded plugins win over earlier ones and over the defaults).

A few things to check if it's not kicking in:

  • The match i…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@fisker
Comment options

@fisker
Comment options

Answer selected by fisker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants