You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-workspaces

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-workspaces

An ESLint plugin for enforcing consistent imports across monorepo packages.

0.11.0
latest
Source
npmnpm
Version published
Weekly downloads
82K
4.59%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-workspaces npm downloads Coverage Status code style: prettier

An ESLint plugin for enforcing consistent imports across monorepo packages.

It supports:

Installation

# npm
npm install eslint-plugin-workspaces --save-dev

# yarn
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

NameDescription
🔧no-absolute-importsdisallow absolute imports for files that are within the current package
no-cross-importsdisallow imports of files that are inside another package
🔧no-relative-importsdisallow relative imports of files that are outside of the current package
require-dependencydisallow importing from packages that are not listed as a dependency

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

Keywords

eslint

FAQs

Package last updated on 17 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts