Skip to content

Feature Request: Add report Function for Import Analysis Output #449

Description

@daiyanze

Describe the feature

Summary

Currently the unimport package provides powerful importing matchings, however lacks a builtin way to output or persist results of the matched imports. This sometimes makes it difficult for devs to review / audit or integrate the imports into their workflows or CICD.

Originally, I hope such function should exist in our CICD pipeline to leave a trace relating to auto-imports.
Meanwhile, I think it could be a good method for devs to be aware of the imported modules during development to help quickly address the issues with the verbose printouts.

How should it work?

  • The report function should accept the matched imports and options for output.
  • It should support:
    • Printing to the console in various formats.
    • Writing the output to a file in a chosen format.
    • Customizable formatting and output handlers.
  • The function should be easy to use and integrate into existing unimport workflows, with sensible defaults and clear error handling.

Example Usage:

Unimport.vite({
  dirs: ['./composables/**/*'],
  reportMatchedOptions: {
    enable: true,
    format: 'json'
    ...
  }
})

Additional information

  • Would you be willing to help implement this feature?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions