New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Document extending plugin with new config #16394
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,7 +329,36 @@ 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 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 [ | ||
jsdoc.configs.recommended, | ||
// ... other configuration objects | ||
]; | ||
/* | ||
The above code is equivalent to the following configuration using the legacy .eslintrc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don’t think we should refer to the old way of doing this at all because they are not actually equivalent. They accomplish the same thing in a very narrow way but there are subtle differences that I think will confuse people if we say they’re equivalent. |
||
configuration system: | ||
|
||
{ | ||
"extends": ["plugin:jsdoc/recommended"] | ||
} | ||
*/ | ||
``` | ||
|
||
#### Using plugin rules | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’d suggest flipping the order of these two sections so using plugin rules comes first. That way, you can show how you can include a config from a plugin and also override the config’s default rule options with another config object in the array. |
||
|
||
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"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it’s important to include an actual config object here as an example. It can be fairly simple, just setting a jsdoc rule to “warn” would suffice.