Skip to content
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

@nx/enforce-module-boundaries incorrectly allows deep imports #29258

Open
1 of 4 tasks
Katli95 opened this issue Dec 9, 2024 · 1 comment
Open
1 of 4 tasks

@nx/enforce-module-boundaries incorrectly allows deep imports #29258

Katli95 opened this issue Dec 9, 2024 · 1 comment
Assignees
Labels
scope: linter Issues related to Eslint support in Nx type: bug

Comments

@Katli95
Copy link

Katli95 commented Dec 9, 2024

Current Behavior

Given our repro repo

@here/cart can import from packages/utilities/src/private/private.ts via @here/utilities/src/private/private even though it's not explicitly exported from packages/utilities/src/index.ts

Expected Behavior

A lint error at import { privatePrivate } from '@here/utilities/src/private/private'; saying something like "only root level exports can be imported"

GitHub Repo

https://github.com/Katli95/nx-test

Steps to Reproduce

  1. Clone
  2. Lint/Build/Open in IDE

Nx Report

NX   Report complete - copy this into the issue template

Node           : 20.11.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.2.4

nx                 : 20.2.0
@nx/js             : 20.2.0
@nx/eslint         : 20.2.0
@nx/workspace      : 20.2.0
@nx/devkit         : 20.2.0
@nx/eslint-plugin  : 20.2.0
@nx/vite           : 20.2.0
@nx/web            : 20.2.0
typescript         : 5.6.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/eslint/plugin

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

@nx/enforce-module-boundaries correctly handles:

  • Relative imports
  • Imports breaking tag rules

Possibly related to #26646

@FrozenPandaz FrozenPandaz added the scope: linter Issues related to Eslint support in Nx label Jan 28, 2025
@Katli95
Copy link
Author

Katli95 commented Feb 11, 2025

Just adding that my project has actually changed strategies (we're migrating away from barrel files and allowing imports from specific paths defined in package.json>exports) and now require that the current functionality be maintained 😅 Sorry!

I don't know if you wanna keep the issue, which at the time of writing assumed this was the intended default functionality (for my 2 cents it can just be closed). If it stands to be fixed, might I then ask if this could become an option in the lint rule?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: linter Issues related to Eslint support in Nx type: bug
Projects
None yet
Development

No branches or pull requests

3 participants