简体   繁体   English

是否可以使用 Prettier 删除未使用的导入?

[英]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.我有一个 Expo React Native 应用程序,它在组件中有大量未使用的导入。

I have Prettier setup for code formatting, is it possible to configure Prettier to also remove any unused imports across the project?我为代码格式化设置了 Prettier,是否可以配置 Prettier 以删除项目中任何未使用的导入?

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.我在文档中看不到任何内容,也不知道是否有办法向 Prettier 添加额外的 eslint 插件。

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但是你可以使用这个更漂亮的插件https://www.npmjs.com/package/prettier-plugin-organize-imports

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM