fix: avoid warning when not needed, fix #314 #368
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Hi,
First of all, I wanted to thank you for creating and maintaining
unplugin-auto-import
. I recently started using it in my project after it was recommended by Posva, and I have found it to be very helpful.However, I ran into a tiny issue with the warning message that is displayed when no imports are defined. After investigating the issue, I realized that the warning message is not necessary in all cases, especially when the "dirs" option is specified.
To fix this issue, I modified the source code to check for the "dirs" option and skip the warning message if it is specified. Here is an example of how I use this package in my project:
I do not need to define any imports explicitly. However, the warning message is displayed because no imports are defined.
With my modification, the warning message will not be displayed when the "dirs" option is specified, and the package will work as expected for my use case. This modification was partially requested in issue #314.
Thank you again for your contribution to the community, and I hope you find this modification useful. Please let me know if you have any questions or suggestions for improvement.
Linked Issues
#314