javascriptreact-nativeeslintprettier

Is it possible to remove unused imports with Prettier?


I have an Expo React Native app that has a ton of unused imports in components.

I have Prettier setup for code formatting, is it possible to configure Prettier to also remove any unused imports across the project?

I can't see anything in the docs and I don't know if there is a way to add extra eslint plugins to Prettier.


Solution

  • I don't think this is supported by default.

    But you can use this prettier-plugin https://www.npmjs.com/package/prettier-plugin-organize-imports