eslint-plugin-turbo
Easy ESLint configuration for Turborepo
Installation
- You'll first need to install ESLint:
npm install eslint --save-dev
- Next, install
eslint-plugin-turbo
:
npm install eslint-plugin-turbo --save-dev
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]+$"]
}
]
}
}
Usage (Flat Config eslint.config.js
)
In ESLint v8, both the legacy system and the new flat config system are supported. In ESLint v9, only the new system will be supported. See the official ESLint docs.
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]+$"],
},
],
},
},
];