From 79e0ff2b03142a0f1c6d9ebf324215ef2818dd60 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Fri, 22 Nov 2024 16:20:31 -0700 Subject: [PATCH 1/2] docs: Update README for eslint-config-turbo with Flat Config instructions. --- packages/eslint-config-turbo/README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/eslint-config-turbo/README.md b/packages/eslint-config-turbo/README.md index 834b887134852..2db7ade347ff5 100644 --- a/packages/eslint-config-turbo/README.md +++ b/packages/eslint-config-turbo/README.md @@ -16,7 +16,20 @@ npm install eslint --save-dev npm install eslint-config-turbo --save-dev ``` -## Usage +## Usage (Flat Config `eslint.config.js`) + +``` +{ +import turboConfig from "eslint-config-turbo/flat"; + +export default [ + ...turboConfig + // Other configuration +]; +} +``` + +## Usage (Legacy `eslintrc*`) Add `turbo` to the extends section of your eslint configuration file. You can omit the `eslint-config-` prefix: From 8d6fbe00b0ca31fdbf2c14da5079a4574d6f05da Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Fri, 22 Nov 2024 16:52:50 -0700 Subject: [PATCH 2/2] WIP --- packages/eslint-config-turbo/README.md | 41 ++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/packages/eslint-config-turbo/README.md b/packages/eslint-config-turbo/README.md index 2db7ade347ff5..fac8e1dd81f7e 100644 --- a/packages/eslint-config-turbo/README.md +++ b/packages/eslint-config-turbo/README.md @@ -18,15 +18,34 @@ npm install eslint-config-turbo --save-dev ## Usage (Flat Config `eslint.config.js`) +```js +import turboConfig from "eslint-config-turbo/flat"; + +export default [ + ...turboConfig, + // Other configuration +]; ``` -{ + +You can also configure rules available in the configuration: + +```js import turboConfig from "eslint-config-turbo/flat"; export default [ - ...turboConfig + ...turboConfig, // Other configuration + { + rules: { + "turbo/no-undeclared-env-vars": [ + "error", + { + allowList: ["^ENV_[A-Z]+$"], + }, + ], + }, + }, ]; -} ``` ## Usage (Legacy `eslintrc*`) @@ -38,3 +57,19 @@ Add `turbo` to the extends section of your eslint configuration file. You can om "extends": ["turbo"] } ``` + +You can also configure rules available in the configuration: + +```json +{ + "plugins": ["turbo"], + "rules": { + "turbo/no-undeclared-env-vars": [ + "error", + { + "allowList": ["^ENV_[A-Z]+$"] + } + ] + } +} +```