-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Added allow and forbid options to no-namespace rule #1679
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
Conversation
2 similar comments
|
||
This rule takes the following options: | ||
|
||
`allow`: an array of namespaces the rule allows |
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 assume this should cover specifiers, not the binding names?
(having the binding name and the specifier be the same in most of the examples make it unclear to which this applies)
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.
the allow option works as follows:
// { allow: ['myModule', 'React'] }
import * as React from 'react';
import * as myModule from '../module/randomFile.js';
Also, can you elaborate on the use case here? |
Use cases would be there you want to force certain namespaces, and forbid others. This rule would make it very easy to force consistency and allow:
while it would disallow: Also you could make it possible to only disallow:
while allowing all other namespace imports |
I'm not clear tho on why you'd want any path to be imported as It seems more like what you want is to point to a specific file, and allow that one to be imported as a namespace with a specific name? |
I've added
allow
andforbid
options, so this rule can be used for certain namespaces, instead for all