nrwl/nx

`@nx/enforce-module-boundaries` incorrectly allows deep imports

Opened this issue · 0 comments

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