When using lerna with sub-packages, node_modules is not being ignored
geoffdutton opened this issue · comments
laconiajs uses lerna with the individual packages in the packages/
sub-directory.
The following command will causes npm-package-json-lint
to lint packages/some-package/node_modules/some-dependency/package.json
:
lerna exec npmPkgJsonLint -- -c \$LERNA_ROOT_PATH/.npmpackagejsonlintrc.json .
The temporary fix is to specific a .npmpackagejsonlintignore
file with the contents node_modules
like so:
lerna exec npmPkgJsonLint -- --quiet -c \$LERNA_ROOT_PATH/.npmpackagejsonlintrc.json -i \$LERNA_ROOT_PATH/.npmpackagejsonlintignore .
I would expect it to ignore all node_modules
directories rather than just at the project root.
One idea would be to negate node_modules
in the globPatterns: https://github.com/tclindner/npm-package-json-lint/blob/master/src/utils/getFileList.js#L26
const globPatterns = filteredPatterns.map(pattern => {
return pattern.endsWith(`/package.json`) ? pattern : `${pattern}/**/package.json`;
});
globPatterns.push('!node_modules');
debug('globPatterns');
debug(globPatterns);
Thoughts?
Thank you for logging this issue! I wanted to let you know that I won’t be able to look at this for the next week. I’m looking forward to reviewing.
@geoffdutton makes total sense. I'll get a fix in this weekend. Thank you for logging the issue 🎉
@geoffdutton let me know if v4.5.2
clears up your issue! Thanks.