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 (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]+$"]
}
]
}
}