duniul / clean-modules

🧹 Clean up/prune unnecessary files and reduce the size of your node_modules directory.
ISC License
107 stars 5 forks source link

Some false positives: mongoose ChangeStream, lab .eslintrc #6

Closed icetbr closed 3 years ago

icetbr commented 3 years ago

Hi there, thanks for your work on this project! Here is some money user demand for your efforts.

"filePath": "/home/ddv/projects/ahg/ahpi/node_modules/mongoose/lib/cursor/ChangeStream.js",
"includedByDefault": true,
"includedByGlobs": [
  {
    "original": "changes*",
    "derived": ".../node_modules/**/changes*"
  }

Also node_modules/lab/lib/linter/.eslintrc is required.

I'm doing fine with this command, but you might want to do something about those.

clean-modules node_modules -y -e "**/lab/lib/linter/.eslintrc*" -e "**/ChangeStream.js"

duniul commented 3 years ago

Hey, thanks for reporting this! 🙏 The ChangeStream.js being included by the changes* glob is obviously incorrect. In v2.0.3 I've updated the default patterns to more properly match files with optional extensions, so you won't have to exclude ChangeStream.js yourself anymore. Instead of changes* it's now changes*(.*), so it will only match e.g. changes or changes.extension

As for the .eslintrc from @hapi/lab I'm a bit hesitant to include package-specific excludes into the default globs. Every extra glob adds a slight bit of overhead, including for those who don't use the package. Might be worth compiling a list of known false positives in the readme tho!

icetbr commented 3 years ago

"Every extra glob adds a slight bit of overhead, including for those who don't use the package. Might be worth compiling a list of known false positives in the readme tho!"

Agreed! Thank you for the fix!