depcheck / depcheck

Check your npm module for unused dependencies
MIT License
4.74k stars 226 forks source link

gitignore #870

Open stephen-willoughby opened 11 months ago

stephen-willoughby commented 11 months ago

Bug Description

A description of the bug We have some gitignore files which add a * to ignore everything and then add back in explicitly what they need with e.g. ! README.md. depcheck doesn't seem to honour these nots and so complains of unused dependencies despite being used

e.g.

# Start by disallowing everything
*
# Now allowlist what we actually want
!thing/
!stuff/
!config/

Code snippets

Where the dependency is used:

code snippet here

Where the dependency is listed in package.json:

package.json snippet here
please include the section name (e.g. devDependencies, dependencies)

Versions

Extra info

Any extra info you want to include. Thank you for the bug report!

BONUS POINTS: If you wish to help us debug further, the depcheck --json option will show more information. Check here in the README for documentation on json output.

stephen-willoughby commented 11 months ago

have found can work around with the creation of an empty .depcheckignore

znarf commented 11 months ago

depcheck use the npm package ignore which implements the .gitignore spec fully.

I guess there is something else going on, please give a full reproduction so someone can have a look.