Forked from upstream with the following changes: https://github.com/azz/eslint-plugin-monorepo/compare/master...jdb8:master
If these changes are merged to eslint-plugin-monorepo
, this fork can be deleted.
Until then, this fork can be installed via:
yarn add -D @jdb8/eslint-plugin-monorepo
or
npm install --save-dev @jdb8/eslint-plugin-monorepo
Unfortunately, any references to monorepo/*
rules (such as in eslint-ignore
comments) will have to be updated to point to @jdb8/monorepo/*
temporarily. If anyone knows of a way to avoid this when forking an eslint plugin (via some kind of rule aliasing?) please reach out!
The original README is included below.
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';