Skip to content
Esc

@noctcore/eslint-plugin-monorepo

v1.0.02 rules0 recommended2 opt-innamespace noctcore-monorepo

A bad fit for a single-package repo, and no-unexported-subpath-import reads each target's package.json from disk, so it needs a real checkout.

Workspace package boundaries: barrel-only imports and exports-map-aware subpaths.

In a workspace, reaching into @acme/ui/src/button/internal works on your machine and couples two packages to a file layout neither of them published. These rules keep cross-package imports on the surface each package actually exposes.

It will yell at you about deep imports across workspace packages. no-deep-package-imports is the strict policy (barrel only), no-unexported-subpath-import the looser one (anything the target’s exports map publishes); pick one. Both ship off in the preset, because neither can do anything without your scopes, so enabling recommended alone checks nothing. It is a bad fit for a single-package repo, and no-unexported-subpath-import reads each target’s package.json from disk, so it needs a real checkout.

Install
npm install --save-dev @noctcore/eslint-plugin-monorepo @typescript-eslint/parser
# or: bun add -D / pnpm add -D @noctcore/eslint-plugin-monorepo @typescript-eslint/parser

The recommended preset turns none of its 2 rules on: each needs options only your project can give, so the preset alone checks nothing. Switch a rule on in the board, then fill in its options as the rule's page shows.

Each rule links to its page, with the options it takes and Incorrect and Correct examples. A good first read is no-unexported-subpath-import.

0 of 2 at error

--fixsuggestionsneeds optionstype infoEach switch sets a rule to error or off.

no-deep-package-imports
Workspace packages in the configured scopes must be consumed through their package barrel only — never via a deep subpath into package internals.
Needs options
opt-in
no-unexported-subpath-import
Importing a @scope/pkg/<subpath> that the target workspace package's exports map does not expose. Reads the target package.json from disk.
Needs options
opt-in