-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support allow
option in no-unassigned-import
, fix #671
#737
Conversation
docs/rules/no-unassigned-import.md
Outdated
|
||
This rule supports the following option: | ||
|
||
`allow`: An Array of globs. The files that match any of these patterns would be ignored/allowed by the linter. This can be usefull for some build environment (e.g. css-loader in webpack). |
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.
s/usefull/useful
, s/environment/environments
src/rules/no-unassigned-import.js
Outdated
@@ -7,15 +9,40 @@ function report(context, node) { | |||
}) | |||
} | |||
|
|||
function testIsAllow(globs, filename, source) { | |||
if (!Array.isArray(globs)) { | |||
return false // default doens't allow any pattern |
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.
s/doens't/doesn't
, s/pattern/patterns
src/rules/no-unassigned-import.js
Outdated
@@ -33,6 +60,7 @@ module.exports = { | |||
'devDependencies': { 'type': ['boolean', 'array'] }, | |||
'optionalDependencies': { 'type': ['boolean', 'array'] }, | |||
'peerDependencies': { 'type': ['boolean', 'array'] }, | |||
'allow': { 'type': '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.
should this require that it be an array of strings specifically?
Sorry for the typos, will change it next commit! Yes, I think it should. |
Hey guys! Are we close to this being resolved? It looks like the only PR conflict is the |
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.
LGTM pending a rebase
@kevin940726 please rebase on the command line so as to avoid merge commits; if you have trouble, i can do it for you. |
(also; tests are failing) |
My bad, didn't notice that. I'll try my best. 😔 |
Is the tests failing on |
@kevin940726 sorry for the delay here. I've rebased your branch for you and resolved the conflicts. Tests seem to pass locally, so let's see if this will get them to pass. |
Add
allow
option tono-unassigned-import
to fix #671.I basically follow the same logic from
no-extraneous-dependencies
. With the glob matching start fromprocess.cwd()
. I'm not sure that this is the best solution (maybe use regexp like webpack do?), but it works. Please let me know if there is something need to be improved. Big thanks!