How to use files with multiple extensions with Prettier? How to use files with multiple extensions with Prettier? node.js node.js

How to use files with multiple extensions with Prettier?


Just found solution. Following command will target both ts and tsx:

prettier --write "./src/**/*.{ts,tsx}"

Prettier is using Glob syntax which is syntax similar to Regex, used in shell.

See GLOB syntax details: https://github.com/isaacs/node-glob/blob/master/README.md#glob-primer


If you want to run prettier command on multiple paths with multiple extensions use the following command:

prettier --write "src/**/*.{ts,tsx,js,jsx}" "pages/**/*.{ts,tsx,js,jsx}" "server/**/*.js"