diff --git a/docs/src/user-guide/configuring/configuration-files-new.md b/docs/src/user-guide/configuring/configuration-files-new.md index 38ee3eb9928..13e4e5bcd9a 100644 --- a/docs/src/user-guide/configuring/configuration-files-new.md +++ b/docs/src/user-guide/configuring/configuration-files-new.md @@ -329,7 +329,13 @@ For historical reasons, the boolean value `false` and the string value `"readabl ### Using plugins in your configuration -Plugins are used to share rules, processors, configurations, parsers, and more across ESLint projects. Plugins are specified in a configuration object using the `plugins` key, which is an object where the name of the plugin is the property name and the value is the plugin object itself. Here's an example: +Plugins are used to share rules, processors, configurations, parsers, and more across ESLint projects. + +#### Using plugin rules + +You can use specific rules included in a plugin. To do this, specify the plugin +in a configuration object using the `plugins` key. The value for the `plugin` key +is an object where the name of the plugin is the property name and the value is the plugin object itself. Here's an example: ```js import jsdoc from "eslint-plugin-jsdoc"; @@ -390,6 +396,31 @@ export default [ This configuration object uses `jsd` as the prefix plugin instead of `jsdoc`. +#### 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: + +```js +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", + } + } +]; +``` + ### Using processors Processors allow ESLint to transform text into pieces of code that ESLint can lint. You can specify the processor to use for a given file type by defining a `processor` property that contains either the processor name in the format `"pluginName/processorName"` to reference a processor in a plugin or an object containing both a `preprocess()` and a `postprocess()` method. For example, to extract JavaScript code blocks from a Markdown file, you might add this to your configuration: