eslint-plugin-workspaces

An ESLint plugin for enforcing consistent imports across monorepo packages.
It supports:
Installation
npm install eslint-plugin-workspaces --save-dev
yarn add eslint-plugin-workspaces --dev
Configuration
Enable the rules in your ESLint configuration file:
{
"plugins": ["workspaces"],
"rules": {
"workspaces/no-relative-imports": "error",
"workspaces/require-dependency": "warn"
}
}
Or add the "recommended" preset:
{
"extends": ["plugin:workspaces/recommended"]
}
ESLint v9 Flat Config
Enable the rules in your ESLint configuration file:
import workspaces from "eslint-plugin-workspaces";
export default [
{
plugins: { workspaces },
rules: {
"workspaces/no-relative-imports": "error",
"workspaces/require-dependency": "warn",
},
},
];
Or add the "recommended" preset:
import workspaces from "eslint-plugin-workspaces";
export default [
workspaces.configs["flat/recommended"],
];
Rules
✔ included in the "recommended" preset
🔧 fixable using the --fix
command line option
Presets
recommended
enables rules recommended for all users
all
enables all rules
flat/recommended
enables rules recommended for all users
flat/all
enables all rules
License
MIT