# babel-plugin-danger-remove-unused-import (opens new window)

删除文件中未使用的import(有些import除了export,还是有执行一些内容,所以删除存在风险)

  • 定义数据储存对象runtimeData
    • pre定义,在post删除
  • ImportDeclarationpath以变量名为key存储path
  • JSXIdentifier/Identifierpath删除使用的变量path
  • runtimeData中残留的即未使用的import,做删除操作
最后更新: 1/12/2023, 1:44:05 PM