Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 days 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 (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T09:17:08.000Z (about 2 years ago)
- Last Synced: 2025-01-08T14:33:12.331Z (13 days ago)
- Topics: eslint, eslint-plugin, lerna, monorepo, yarn
- Language: JavaScript
- Homepage:
- Size: 769 KB
- Stars: 75
- Watchers: 3
- Forks: 12
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `eslint-plugin-monorepo`
[![Travis](https://img.shields.io/travis/azz/eslint-plugin-monorepo.svg?style=flat-square)](https://travis-ci.org/azz/eslint-plugin-monorepo)
[![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![npm](https://img.shields.io/npm/v/eslint-plugin-monorepo.svg?style=flat-square)](https://npmjs.org/eslint-plugin-monorepo)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](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';
```