8.0.0 • Published 8 months ago

@grafana/eslint-config v8.0.0

Weekly downloads
6,288
License
Apache-2.0
Repository
github
Last release
8 months ago

grafana-eslint-config

Grafana's ESLint config.

Installation

yarn add @grafana/eslint-config --dev

or:

npm install @grafana/eslint-config --save-dev

Don't forget to install peerDependencies.

  1. Install the correct versions of each package, which are listed by the command:
npm info "@grafana/eslint-config@latest" peerDependencies

If using npm 5+, use this command:

npx install-peerdeps --dev @grafana/eslint-config

If using a different package manager, run npm info "@grafana/eslint-config@latest" peerDependencies to list the peer dependencies and versions. Then run yarn add --dev <dependency1>@<version> <dependency2>@<version> <dependency3>@<version> for the listed peer dependencies.

Configuration (legacy: .eslintrc*)

Extend our configuration to get reasonable defaults:

{
  "extends": ["@grafana/eslint-config"]
}

It will automatically handle *.(js|ts|tsx) files.

Configuration (new: eslint.config.js)

From v8.21.0, Eslint introduced a new flat config system where eslint.config.js replaces .eslintrc* as the default config file name. Eslint@8.x supports both systems, while Eslint@9.x only supports the new flat config.

A guide on how to migrate to a flat config can be found here.

The following official blog posts are available for interested parties:

This package contains a single flat config object which can be imported like so:

const grafanaConfig = require("@grafana/eslint-config/flat");

/**
 * @type {Array<import('eslint').Linter.Config>}
 */
module.exports = [
  {
    grafanaConfig,
  },
];

You are then free to add/override properties.

Note: Our shareable configs does not preconfigure files, ignore, or languageOptions.globals. For most of the cases, you probably want to configure some properties for your project.

const grafanaConfig = require("@grafana/eslint-config/flat");

/**
 * @type {Array<import('eslint').Linter.Config>}
 */
module.exports = [
  {
    ignores: [".github", ".yarn", "**/build/", "**/compiled/", "**/dist/"],
  },
  grafanaConfig,
  {
    name: "myproject/defaults",
    files: ["**/*.{ts,tsx,js,jsx}"],
    rules: {
      // add custom rules here.
    },
  },
];
8.0.0

8 months ago

7.0.0

1 year ago

6.0.1

2 years ago

6.0.0

2 years ago

5.1.0

3 years ago

5.0.0

3 years ago

4.0.0

3 years ago

3.0.0

3 years ago

2.5.2

3 years ago

3.0.0-alpha

3 years ago

2.5.1

4 years ago

2.5.0

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0-rc1

5 years ago