Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💡 Add option to ignore export names using a pattern #763

Open
eugene-mohc opened this issue Aug 21, 2024 · 1 comment
Open

💡 Add option to ignore export names using a pattern #763

eugene-mohc opened this issue Aug 21, 2024 · 1 comment
Labels
feature request Feature request

Comments

@eugene-mohc
Copy link

Suggest an idea for this project

It would be useful to be able to ignore certain exports by pattern or regex matching. For example I like to always export the props type of a React component in its file. It may not be used anywhere else yet, but is conveniently there for the future and reduces git diffs.

This can somewhat be achieved using these settings:

{
  "ignoreExportsUsedInFile": {
    "type": true
  }
}

However this prevents all other type exports from being reported as well, which is not ideal. The config could accept an array of patterns to ignore instead:

{
  "ignoreExportsUsedInFile": {
    "type": [".*Props"]
  }
}

This would ignore only type exports which end with "Props", for example:

              // Matches, OK      // Not used, reported
export type { ComponentNameProps, SomeOtherType }

export { ComponentName }
@eugene-mohc eugene-mohc added the feature request Feature request label Aug 21, 2024
@webpro
Copy link
Collaborator

webpro commented Aug 21, 2024

Valid RFC. Would likely becomes regexes for ignoreExports or ignoreExportTypes (like ignoreBinaries etc already do).

For now, you could add a simple preprocessor function to strip out anything unwanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request
Projects
None yet
Development

No branches or pull requests

2 participants