@nx/eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.
Setting Up ESLint Plugin
In any Nx workspace, you can install
@nx/eslint-plugin by running the following commands if the package is not already installed:
The plugin contains the following rule configurations divided into sub-plugins.
@nx/typescript ESLint plugin contains best practices when using TypeSript.
Contains configurations matching best practices when using Angular framework:
Contains configurations matching best practices when using React framework:
You can also use
@nx/react which includes all three
Enforce Module Boundaries rule
enforce-module-boundaries ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. Enforcing strict boundaries helps keep prevent unplanned cross-dependencies. Read more about it on a dedicated page