Skip to content

Commit 0fabc74

Browse files
authored
docs: More explicit about all and recommended configs (#150)
1 parent a613847 commit 0fabc74

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ const __dirname = path.dirname(__filename);
3333
const compat = new FlatCompat({
3434
baseDirectory: __dirname, // optional; default: process.cwd()
3535
resolvePluginsRelativeTo: __dirname, // optional
36-
recommendedConfig: js.configs.recommended, // optional
37-
allConfig: js.configs.all, // optional
36+
recommendedConfig: js.configs.recommended, // optional unless you're using "eslint:recommended"
37+
allConfig: js.configs.all, // optional unless you're using "eslint:all"
3838
});
3939

4040
export default [
@@ -77,8 +77,8 @@ const js = require("@eslint/js");
7777
const compat = new FlatCompat({
7878
baseDirectory: __dirname, // optional; default: process.cwd()
7979
resolvePluginsRelativeTo: __dirname, // optional
80-
recommendedConfig: js.configs.recommended, // optional
81-
allConfig: js.configs.all, // optional
80+
recommendedConfig: js.configs.recommended, // optional unless using "eslint:recommended"
81+
allConfig: js.configs.all, // optional unless using "eslint:all"
8282
});
8383

8484
module.exports = [
@@ -110,6 +110,17 @@ module.exports = [
110110
];
111111
```
112112
113+
## Troubleshooting
114+
115+
**TypeError: Missing parameter 'recommendedConfig' in FlatCompat constructor**
116+
117+
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.
118+
119+
**TypeError: Missing parameter 'allConfig' in FlatCompat constructor**
120+
121+
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.
122+
123+
113124
## License
114125
115126
MIT License

0 commit comments

Comments
 (0)