Turborepo

eslint-config-turbo

The eslint-config-turbo package helps you find environment variables that are used in your code that are not a part of Turborepo's hashing. Environment variables used in your source code that are not accounted for in turbo.json will be highlighted in your editor and errors will show as ESLint output.

Installation

Install eslint-config-turbo into the location where your ESLint configuration is held:

Terminal
npm i --save-dev eslint-config-turbo -w @acme/eslint-config

Usage (Flat Config eslint.config.js)

./packages/eslint-config/base.js
import turboConfig from 'eslint-config-turbo/flat';
 
export default [
  ...turboConfig,
  // Other configuration
];

You can also configure rules available in the configuration:

./packages/eslint-config/base.js
import turboConfig from 'eslint-config-turbo/flat';
 
export default [
  ...turboConfig,
  // Other configuration
  {
    rules: {
      'turbo/no-undeclared-env-vars': [
        'error',
        {
          allowList: ['^ENV_[A-Z]+$'],
        },
      ],
    },
  },
];

Usage (Legacy eslintrc*)

Add turbo to the extends section of your eslint configuration file. You can omit the eslint-config- prefix:

./packages/eslint-config/base.json
{
  "extends": ["turbo"]
}

You can also configure rules available in the configuration:

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

hours

Total Compute Saved
Get started with
Remote Caching →

On this page