https://github.com/azz/eslint-plugin-monorepo
ESLint Plugin for monorepos
https://github.com/azz/eslint-plugin-monorepo
eslint eslint-plugin lerna monorepo yarn
Last synced: 5 months ago
JSON representation
ESLint Plugin for monorepos
- Host: GitHub
- URL: https://github.com/azz/eslint-plugin-monorepo
- Owner: azz
- License: mit
- Created: 2017-12-13T12:31:37.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T09:17:08.000Z (almost 3 years ago)
- Last Synced: 2025-05-20T15:05:51.460Z (6 months ago)
- Topics: eslint, eslint-plugin, lerna, monorepo, yarn
- Language: JavaScript
- Homepage:
- Size: 769 KB
- Stars: 74
- Watchers: 2
- Forks: 12
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `eslint-plugin-monorepo`
[](https://travis-ci.org/azz/eslint-plugin-monorepo)
[](https://github.com/prettier/prettier)
[](https://npmjs.org/eslint-plugin-monorepo)
[](https://github.com/semantic-release/semantic-release)
[](LICENSE)
A collection of ESLint rules for enforcing import rules in a monorepo. Supports:
* [Lerna](https://github.com/lerna/lerna)
* [Yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/)
## Configuration
Use the `"recommended"` configuration:
```json
// .eslintrc.json
{
"extends": ["plugin:monorepo/recommended"]
}
```
Or enable rules manually:
```json
// .eslintrc.json
{
"plugins": ["monorepo"],
"rules": {
"monorepo/no-internal-import": "error",
"monorepo/no-relative-import": "error"
}
}
```
## Rules
### `monorepo/no-internal-import`
Forbids importing specific files from a monorepo package.
```js
// Bad
import 'module/src/foo.js';
// Good
import { foo } from 'module';
```
### `monorepo/no-relative-import` (fixable)
Forbids importing other packages from the monorepo with a relative path.
```js
// Bad
import module from '../module';
// Good
import module from 'module';
```