From 0fabc7406e5a281a4e72be33de6e3bf8642aa746 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 26 Jan 2024 21:28:27 -0700 Subject: [PATCH] docs: More explicit about all and recommended configs (#150) --- README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7641c74..b23d22b 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ const __dirname = path.dirname(__filename); const compat = new FlatCompat({ baseDirectory: __dirname, // optional; default: process.cwd() resolvePluginsRelativeTo: __dirname, // optional - recommendedConfig: js.configs.recommended, // optional - allConfig: js.configs.all, // optional + recommendedConfig: js.configs.recommended, // optional unless you're using "eslint:recommended" + allConfig: js.configs.all, // optional unless you're using "eslint:all" }); export default [ @@ -77,8 +77,8 @@ const js = require("@eslint/js"); const compat = new FlatCompat({ baseDirectory: __dirname, // optional; default: process.cwd() resolvePluginsRelativeTo: __dirname, // optional - recommendedConfig: js.configs.recommended, // optional - allConfig: js.configs.all, // optional + recommendedConfig: js.configs.recommended, // optional unless using "eslint:recommended" + allConfig: js.configs.all, // optional unless using "eslint:all" }); module.exports = [ @@ -110,6 +110,17 @@ module.exports = [ ]; ``` +## Troubleshooting + +**TypeError: Missing parameter 'recommendedConfig' in FlatCompat constructor** + +The `recommendedConfig` option is required when any config uses `eslint:recommended`, including any config in an `extends` clause. To fix this, follow the example above using `@eslint/js` to provide the `eslint:recommended` config. + +**TypeError: Missing parameter 'allConfig' in FlatCompat constructor** + +The `allConfig` option is required when any config uses `eslint:all`, including any config in an `extends` clause. To fix this, follow the example above using `@eslint/js` to provide the `eslint:all` config. + + ## License MIT License