0.10.0 ā€¢ Published 5 months ago

eslint-plugin-workspaces v0.10.0

Weekly downloads
3,219
License
MIT
Repository
github
Last release
5 months ago

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"]
}

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

License

MIT