Closed jehy closed 6 years ago
Even specifying --ignore="smth.sh"
does not work :(
Environment: Ubuntu 17.10, node v8.9.1, using last version of modclean
Specifying --ignore="***/*.sh"
works but that's very strange. Seems like an issue with node-glob package.
Thanks for reporting, you're right about this one. I dove back through the code and it appears I never actually merged the provided ignore list from the ignorePatterns
configuration property into the list that is pulled in the from patterns, so no matter what you provide, it shouldn't work.
I'm going through some of my open source modules and upgrading them and doing some refactoring. This is on my list and should get it fixed soon.
Thanks for reporting!
@jehy I think I figured out what may be causing this issue. Since the patterns already has a *.sh
pattern to match, node-glob gets into a race condition where it is not sure whether it should match or not match that pattern. In this case, the match takes precedence over the ignore pattern. When you specify ***/*.sh
, it will work because this pattern is more "global" than the default *.sh
pattern.
The only way I can think about fixing this without impacting performance would be to compare any passed in ignore patterns with the match patterns and remove those from the match patterns if they exist.
I'm going to see if there is any better way of handling this, but for right now, that seems like the best solution.
Added functionality that will remove passed in ignore patterns from the matching patterns if it exists in the matching patterns list. This will prevent the race condition you were seeing here. This has been release in version 3.0.0-beta.1.
I'm working on writing tests now and once that is complete, 3.0.0 will be released.
Thanks again for reporting this!
--ignore option does not work, at least for "*.sh" pattern.
Reproduce:
Expected not to remove smth.sh, actual result: