Skip to content

Commit 428fc76

Browse files
authored
docs: resubmit Create Plugins documentation (#17268)
1 parent bdca88c commit 428fc76

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/src/extend/plugins.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,34 @@ Each plugin is an npm module with a name in the format of `eslint-plugin-<plugin
1818

1919
The easiest way to start creating a plugin is to use the [Yeoman generator](https://www.npmjs.com/package/generator-eslint). The generator will guide you through setting up the skeleton of a plugin.
2020

21+
### Metadata in Plugins
22+
23+
For easier debugging and more effective caching of plugins, it's recommended to provide a name and version in a `meta` object at the root of your plugin, like this:
24+
25+
```js
26+
// preferred location of name and version
27+
module.exports = {
28+
meta: {
29+
name: "eslint-plugin-custom",
30+
version: "1.2.3"
31+
}
32+
};
33+
```
34+
35+
The `meta.name` property should match the npm package name for your plugin and the `meta.version` property should match the npm package version for your plugin. The easiest way to accomplish this is by reading this information from your `package.json`.
36+
37+
As an alternative, you can also expose `name` and `version` properties at the root of your plugin, such as:
38+
39+
```js
40+
// alternate location of name and version
41+
module.exports = {
42+
name: "eslint-plugin-custom",
43+
version: "1.2.3"
44+
};
45+
```
46+
47+
While the `meta` object is the preferred way to provide the plugin name and version, this format is also acceptable and is provided for backward compatibility.
48+
2149
### Rules in Plugins
2250

2351
Plugins can expose custom rules for use in ESLint. To do so, the plugin must export a `rules` object containing a key-value mapping of rule ID to rule. The rule ID does not have to follow any naming convention (so it can just be `dollar-sign`, for instance). To learn more about creating custom rules in plugins, refer to [Custom Rules](custom-rules).

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy