-
-
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
Add relaxed option for no-relative-parent-imports #1243
Comments
Indeed; I think that rule you actually want is a different one - more like enforcing import boundaries on specific directories. |
That might become a rule as well, and that will give users fine-grained control over how to enforce imports. This proposal is far simpler than that rule in term of configuration and enforcement, yet opens flexibility. |
Any information on this? |
Bumping up. |
This was referenced Sep 16, 2021
This was referenced Nov 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the proposal for
no-relative-parent-imports
rule improvement.Context
When
no-relative-parent-imports
rule is enabled, it doesn't allow to import from relative parents at all, for example:However, it's sometimes acceptable and reasonable to import from the immediate parent as depicted above.
Proposal
Give
no-relative-parent-imports
the option of eitherstrict
orrelaxed
.strict
is used, nothing will change, the current behavior stays intact.strict
is by default if not specifying the option.relaxed
is used, the rule will pass on immediate parent imports, and still catch the rest.Effect
By using
strict
by default, this proposal doesn't affect any existing users. However, it gives users more options to tweak the rule if needed.Alternatives
Give the option to specify how depth of relative parent imports is allowed.
However, I think this isn't a preferred option since it goes against the purpose of
no-relative-parent-imports
rule.The text was updated successfully, but these errors were encountered: