ggascoigne/prettier-plugin-import-sort

Unable to use with TypeScript and custom Babel config

mattwcole opened this issue · 1 comments

Prettier fails to recognise TypeScript when this plugin is installed and a custom Babel config is used.

Steps to reproduce

npx create-react-app my-app --template typescript
cd my-app
yarn add prettier prettier-plugin-import-sort import-sort-style-module -D

package.json:

"importSort": {
  ".js, jsx, .ts, tsx": {
    "style": "module"
  }
}
yarn prettier --write .			# works great, imports sorted
echo {} > .babelrc
yarn prettier --write .			# typescript no longer recognised
yarn remove prettier-plugin-import-sort
yarn prettier --write .			# back to working

My mistake, I was missing "parser": "typescript" in the package.json!