Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshuajaco/eslint-plugin-workspaces
An ESLint plugin for enforcing consistent imports across monorepo packages.
https://github.com/joshuajaco/eslint-plugin-workspaces
bolt eslint eslint-plugin lerna-monorepo monorepo npm-workspaces pnpm-workspace workspaces yarn-workspaces
Last synced: 3 days ago
JSON representation
An ESLint plugin for enforcing consistent imports across monorepo packages.
- Host: GitHub
- URL: https://github.com/joshuajaco/eslint-plugin-workspaces
- Owner: joshuajaco
- License: mit
- Created: 2019-08-16T14:53:58.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-07-28T18:18:51.000Z (5 months ago)
- Last Synced: 2024-12-16T05:05:58.264Z (10 days ago)
- Topics: bolt, eslint, eslint-plugin, lerna-monorepo, monorepo, npm-workspaces, pnpm-workspace, workspaces, yarn-workspaces
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/eslint-plugin-workspaces
- Size: 444 KB
- Stars: 76
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-workspaces ![npm downloads](https://img.shields.io/npm/dw/eslint-plugin-workspaces) [![Coverage Status](https://coveralls.io/repos/github/joshuajaco/eslint-plugin-workspaces/badge.svg)](https://coveralls.io/github/joshuajaco/eslint-plugin-workspaces) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
An ESLint plugin for enforcing consistent imports across monorepo packages.
It supports:
- [Yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces)
- [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces)
- [pnpm workspaces](https://pnpm.io/workspaces)
- [lerna](https://github.com/lerna/lerna)
- [bolt](https://github.com/boltpkg/bolt)## Installation
```sh
# npm
npm install eslint-plugin-workspaces --save-dev# yarn
yarn add eslint-plugin-workspaces --dev
```## Configuration
Enable the rules in your ESLint configuration file:
```json
{
"plugins": ["workspaces"],
"rules": {
"workspaces/no-relative-imports": "error",
"workspaces/require-dependency": "warn"
}
}
```Or add the "recommended" preset:
```json
{
"extends": ["plugin:workspaces/recommended"]
}
```## Rules
✔ included in the "recommended" preset
🔧 fixable using the `--fix` command line option
| | | Name | Description |
| --- | --- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| ✔ | 🔧 | [no-absolute-imports](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/no-absolute-imports.md) | disallow absolute imports for files that are within the current package |
| | | [no-cross-imports](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/no-cross-imports.md) | disallow imports of files that are inside another package |
| ✔ | 🔧 | [no-relative-imports](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/no-relative-imports.md) | disallow relative imports of files that are outside of the current package |
| ✔ | | [require-dependency](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/require-dependency.md) | disallow importing from packages that are not listed as a dependency |## Presets
- `recommended` enables rules recommended for all users
- `all` enables all rules# License
[MIT](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/LICENSE)