是否有可能以更漂亮的方式删除未使用的进口?
我有一个Expo React Antive应用程序,该应用程序中有大量未使用的进口量。
我对代码格式的设置更漂亮,是否可以配置更漂亮的还可以删除整个项目中的任何未使用的导入?
我看不到文档中的任何东西,我不知道是否有一种方法可以在更漂亮的地方添加额外的Eslint插件。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用VS Code
.vscode/settings.json
来组织导入。You can use VS Code
.vscode/settings.json
to organize imports.我认为默认情况下没有支持。
但是您可以使用此Prettier-Plugin
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
您需要在设置中添加这些行。
You need to add these lines in your settings.json
在上面提到的@quicksort构建方面,这是我们使用Prettier SDK所做的:
Building off what @QuickSort mentioned above, this is what we did using the Prettier sdk:
可以与Yarn 一起使用
正如@quicksort所述, ,您可以使用 Prettier-Plugin-Organize-Imports 。
安装插件,将其添加到您的.prettierrc.cjs文件中:
并运行更漂亮。
works with yarn
As @QuickSort mentioned, you can use prettier-plugin-organize-imports.
Install plugin, add this to your .prettierrc.cjs file:
and run prettier.