A collection of ESLint rules for enforcing import rules in a monorepo. Supports:
Use the "recommended"
configuration:
// .eslintrc.json
{
"extends": ["plugin:monorepo/recommended"]
}
Or enable rules manually:
// .eslintrc.json
{
"plugins": ["monorepo"],
"rules": {
"monorepo/no-internal-import": "error",
"monorepo/no-relative-import": "error"
}
}
Forbids importing specific files from a monorepo package.
// Bad
import 'module/src/foo.js';
// Good
import { foo } from 'module';
Forbids importing other packages from the monorepo with a relative path.
// Bad
import module from '../module';
// Good
import module from 'module';