Description
Expected behavior
Recommended config works.
This is actually the official ESLint docs https://eslint.org/docs/latest/use/configure/configuration-files-new#using-configurations-included-in-plugins
Using configurations included in plugins
You can use a configuration included in a plugin by adding that configuration directly to the eslint.config.js configurations array. Often, you do this for a plugin’s recommended configuration. Here’s an example:
import jsdoc from "eslint-plugin-jsdoc"; export default [ // configuration included in plugin jsdoc.configs.recommended, // other configuration objects... { files: ["**/*.js"], plugins: { jsdoc: jsdoc }, rules: { "jsdoc/require-description": "warn", } } ];
Actual behavior
Oops! Something went wrong! :(
ESLint: 8.44.0
TypeError: Key "plugins": Key "0": Expected an object.
at Object.validate (myrepo\node_modules\eslint\lib\config\flat-config-schema.js:315:23)
at ObjectSchema.validate (myrepo\node_modules@humanwhocodes\object-schema\src\object-schema.js:218:35)
at myrepo\node_modules@humanwhocodes\object-schema\src\object-schema.js:171:18
at Array.reduce ()
at ObjectSchema.merge (myrepo\node_modules@humanwhocodes\object-schema\src\object-schema.js:169:24)
at myrepo\node_modules@humanwhocodes\config-array\api.js:916:42
at Array.reduce ()
at FlatConfigArray.getConfig (myrepo\node_modules@humanwhocodes\config-array\api.js:915:39)
at FlatConfigArray.isFileIgnored (myrepo\node_modules@humanwhocodes\config-array\api.js:943:15)
at myrepo\node_modules\eslint\lib\eslint\eslint-helpers.js:312:49
ESLint Config
Flat config
import jsdoc from "eslint-plugin-jsdoc";
export default [
jsdoc.configs.recommended,
// omitted...
];
ESLint sample
It's a problem with the config. So running eslint should trigger the error.
$ eslint .
Environment
- Node version: v18.13.0
- ESLint version v8.44.0
eslint-plugin-jsdoc
version: 46.4.3
Workaround
I got it working using this workaround
import jsdoc from "eslint-plugin-jsdoc";
export default [
{
...jsdoc.configs.recommended,
plugins: {
jsdoc,
},
},
// omitted...
];