Back to Backstage

@backstage/eslint-plugin

packages/eslint-plugin/README.md

1.51.0-next.22.5 KB
Original Source

@backstage/eslint-plugin

A collection of ESLint rules useful to Backstage projects.

Usage

This ESLint plugin is part of the default lint configuration provided by the Backstage CLI, so you generally do not need to install it manually.

If you do wish to install this plugin manually, start by adding it as a development dependency to your project:

sh
yarn add --dev @backstage/eslint-plugin

Then add it to your ESLint configuration:

js
extends: [
  'plugin:@backstage/recommended',
],

Alternatively, if you want to install in individual rules manually:

js
plugins: [
  '@backstage',
],
rules: {
  '@backstage/no-forbidden-package-imports': 'error',
}

Rules

The following rules are provided by this plugin:

RuleDescription
@backstage/no-forbidden-package-importsDisallow internal monorepo imports from package subpaths that are not exported.
@backstage/no-relative-monorepo-importsForbid relative imports that reach outside of the package in a monorepo.
@backstage/no-undeclared-importsForbid imports of external packages that have not been declared in the appropriate dependencies field in package.json.
@backstage/no-top-level-material-ui-4-importsForbid top level import from Material UI v4 packages.
@backstage/no-mixed-plugin-importsDisallow mixed plugin imports.
@backstage/no-ui-css-imports-in-non-frontendEnsure that only packages with the frontend role can import CSS files from @backstage/ui.