npm.io
2.10.9 • Published yesterday

eslint-plugin-turbo

Licence
MIT
Version
2.10.9
Deps
1
Size
847 kB
Vulns
0
Weekly
0
Stars
30.8K

eslint-plugin-turbo

Easy ESLint configuration for Turborepo

Installation

  1. You'll first need to install ESLint:
npm install eslint --save-dev
  1. Next, install eslint-plugin-turbo:
npm install eslint-plugin-turbo --save-dev

Usage (Flat Config eslint.config.js)

ESLint v9 uses the Flat Config format seen below:

import turbo from "eslint-plugin-turbo";

export default [turbo.configs["flat/recommended"]];

Otherwise, you may configure the rules you want to use under the rules section.

import turbo from "eslint-plugin-turbo";

export default [
  {
    plugins: {
      turbo
    },
    rules: {
      "turbo/no-undeclared-env-vars": "error"
    }
  }
];

Example (Flat Config eslint.config.js)

import turbo from "eslint-plugin-turbo";

export default [
  {
    plugins: {
      turbo
    },
    rules: {
      "turbo/no-undeclared-env-vars": [
        "error",
        {
          allowList: ["^ENV_[A-Z]+$"]
        }
      ]
    }
  }
];

Usage (Legacy eslintrc*)

Add turbo to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["turbo"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "turbo/no-undeclared-env-vars": "error"
  }
}

Example (Legacy eslintrc*)

{
  "plugins": ["turbo"],
  "rules": {
    "turbo/no-undeclared-env-vars": [
      "error",
      {
        "allowList": ["^ENV_[A-Z]+$"]
      }
    ]
  }
}

Keywords