-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(no-extraneous-dependencies): add exclude option to rule #3198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(no-extraneous-dependencies): add exclude option to rule #3198
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3198 +/- ##
==========================================
+ Coverage 82.25% 92.18% +9.92%
==========================================
Files 94 83 -11
Lines 4283 3696 -587
Branches 1478 1334 -144
==========================================
- Hits 3523 3407 -116
+ Misses 760 289 -471 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused what you mean by "nested dependencies". If you're using @redux-ui/react-<component>
, then it should be in your package.json, no?
if (!exclude) { | ||
return false; | ||
} | ||
|
||
if (Array.isArray(exclude)) { | ||
return exclude.some((pattern) => minimatch(packageName, pattern)); | ||
} | ||
return minimatch(packageName, exclude); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!exclude) { | |
return false; | |
} | |
if (Array.isArray(exclude)) { | |
return exclude.some((pattern) => minimatch(packageName, pattern)); | |
} | |
return minimatch(packageName, exclude); | |
return [].concat(exclude || []).some((pattern) => minimatch(packageName, pattern)); |
@@ -277,6 +292,7 @@ module.exports = { | |||
packageDir: { type: ['string', 'array'] }, | |||
includeInternal: { type: ['boolean'] }, | |||
includeTypes: { type: ['boolean'] }, | |||
exclude: { type: ['string', 'array'] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the array, let's ensure it's unique, and that the items can only be of type string
Encountered an issue when using
redux-ui
and importing the nested dependencies@redux-ui/react-<component>
and wanted a way to exclude anything like@redux-ui/react-*
without having to do it per line or per file which would have other side effects.Implemented an
exclude
option to theno-extraneous-dependencies
rule.