eslint-plugin

@masknet/require-project-reference

Require project references for local package imports

Rule Details

This rule detects local package imports that TypeScript resolves to a local declaration or TypeScript source file. Add the referenced project to the importing project’s tsconfig.json references.

All referenced projects must enable both declaration and declarationMap so TypeScript can redirect navigation from emitted declarations to source files.

Options

Use ignore to skip imports whose module specifier starts with one of the configured strings.

{
  "@masknet/require-project-reference": ["error", { "ignore": ["@generated/"] }]
}

:x: Incorrect

// packages/app/src/index.ts
import { data } from 'lib'
// packages/app/tsconfig.json
{
  "references": []
}

:white_check_mark: Correct

// packages/app/tsconfig.json
{
  "references": [{ "path": "../lib/src" }]
}

Attributes