Add support for Nx-style "enforce module boundaries" rule #6245
toasty-kj
started this conversation in
Rule suggestion
Replies: 2 comments 2 replies
-
@toasty-kj many users might not know (I'm one) what rule you're talking about. I would suggest expanding your suggestion with few links and snippets, so we can understand better what you're suggesting. In V2 we're about to ship this rule, but I'm not sure if it's related: https://next.biomejs.dev/linter/rules/no-private-imports/ |
Beta Was this translation helpful? Give feedback.
2 replies
-
+1 here. I am also looking for this rule to be added soon. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to request a new lint rule similar to Nx's enforce module boundaries for Biome.
🚧 Limitations of noRestrictedImports
The current noRestrictedImports rule operates on a blacklist approach, specifying modules that should not be imported. However, in monorepo environments, it's often more effective to define and enforce allowed import paths (a whitelist approach) to maintain clear boundaries between modules.
For instance, Nx's enforce-module-boundaries rule allows developers to:
Define tags for projects and specify allowed dependencies between them.
Restrict imports based on these tags, effectively creating a whitelist of permissible dependencies.
Prevent circular dependencies and enforce architectural constraints.
fs.usda.gov
These capabilities are crucial for maintaining scalable and maintainable codebases, especially as projects grow in complexity.
✅ Proposal
I propose introducing a new rule in Biome that mirrors the functionality of Nx's enforce-module-boundaries. This rule would:
timdeschryver.dev
Allow defining project tags or identifiers.
Enable specifying allowed import paths based on these tags.
Provide mechanisms to prevent undesired dependencies and enforce module boundaries.
Implementing such a rule would empower developers to maintain clear architectural boundaries within their codebases, leading to better scalability and maintainability.
🔗 References
Nx: Enforce Module Boundaries
Biome: noRestrictedImports Rule
related rules
discussions
Thank you for considering this suggestion!
Beta Was this translation helpful? Give feedback.
All reactions