-
Notifications
You must be signed in to change notification settings - Fork 6
ensure inline requires are searched local dependencies are ignored #45
Conversation
Hi, thanks for the PR! But I can't get this working, I'm still getting a dependency as unused:
I used this [Foo] project to do the test: https://github.com/panther-js/lbe The The usage: https://github.com/panther-js/lbe/blob/master/server.js#L3-L12 The for me to be sure I'm using your PR branch:
|
@helio-frota will take a look sometime today 👍 |
@helio-frota, just had a quick look and found that the search for unused was also checking for "=", updated with the new logic. Thanks for testing! |
@evanshortiss thanks! But something happened with
I'm not sure if this change discovered a hidden bug or added a new one. |
@evanshortiss also for unit tests you can add a dependency on this file: Then you can add the usage |
@helio-frota sure thing, will update shortly. |
cb1a7e8
to
3551578
Compare
Thanks! |
Awesome, thanks! Yeah, I think I saw what you mentioned, but think it always existed? |
Oh wait. Not sure on this. Can try take a look. |
@evanshortiss this was a hidden existing bug.
-- > In the same file. ^ < --- |
Great module, and something I found the need for just the other day during a PR review! I've found a small bug and patched it. Here's an overview:
My project had a file with these lines:
The above caused an issue in the searcher logic since it relied on a require being assigned a variable (checking for an "=" symbol). It now no longer expects a require to be assigned.
Another minor issue I found was the
missing.includes('./')
piece insearcher.js
. When usingNODE_PATH=.
we can perform local requires like sorequire('lib/a/b.js')
without the need for a leading./
. This PR should address this also.I will try add some tests for the
searchDependencies
function that might catch these cases to prevent regression.