Skip to content

NX doesn't throw the lint error when buildable library depends on itself. Lint passes without any errors. The build fails. #16187

@nikbabchenko

Description

@nikbabchenko

Current Behavior

Importing the buildable library from itself via '@some-lib-path' doesn't throw any lint errors.
Nx lint passes.
Build fails.

Expected Behavior

Importing library from the same library should throw error - about relative paths.
"Projects should use relative imports to import from other files within the same project. Use "./path/to/file" instead of import" (nx-enforce-boundaries)

GitHub Repo

nrwl/nx-examples#271

Steps to Reproduce

  1. Create buildable library for ex. 'ui-kit/core' (using nx-examples repo or the latest nx workspace - 15.9.2)
  2. Import the module from the library inside the library - for example

Screenshot 2023-04-08 at 14 53 14

3. Observe - there are no any lint errors.

Screenshot 2023-04-08 at 14 55 32

  1. Try to build the library - observe 'circular dependency on itself error'.

Screenshot 2023-04-08 at 15 06 05

Nx Report

Node : 18.15.0
   OS   : darwin x64
   yarn : 1.22.19
   
   nx                      : 15.9.0-rc.2
   @nrwl/js                : 15.9.0-rc.2
   @nrwl/jest              : 15.9.0-rc.2
   @nrwl/linter            : 15.9.0-rc.2
   @nrwl/workspace         : 15.9.0-rc.2
   @nrwl/angular           : 15.9.0-rc.2
   @nrwl/cli               : 15.9.0-rc.2
   @nrwl/cypress           : 15.9.0-rc.2
   @nrwl/devkit            : 15.9.0-rc.2
   @nrwl/eslint-plugin-nx  : 15.9.0-rc.2
   @nrwl/react             : 15.9.0-rc.2
   @nrwl/tao               : 15.9.0-rc.2
   @nrwl/web               : 15.9.0-rc.2
   @nrwl/webpack           : 15.9.0-rc.2
   @nrwl/nx-cloud          : 15.3.3
   typescript              : 4.9.5
   ---------------------------------------
   Community plugins:
   @ngrx/component-store : 15.3.0
   @ngrx/effects         : 15.3.0
   @ngrx/entity          : 15.3.0
   @ngrx/router-store    : 15.3.0
   @ngrx/store           : 15.3.0
   @ngrx/store-devtools  : 15.3.0

Failure Logs

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { UiKitCoreCoreModule as UiKitNoCore } from '@ui-kit/core';

console.log(UiKitNoCore);

@NgModule({
  imports: [CommonModule],
})
export class UiKitCoreCoreModule {}

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions