|
1 | 1 | # Add support for a new plugin
|
2 | 2 |
|
3 |
| -You may have arrived here after clicking on a rule name from a linting error message or a different tool. If so, you may have expected to find the documentation of a rule. Unfortunately, it is likely that the rule originated from an ESLint plugin that is unknown to this tool. |
| 3 | +You may have arrived here after clicking on a rule name from a linting error message or a different tool. If so, you may have expected to find the documentation of a rule. Unfortunately, it is likely that the rule originated from an ESLint plugin that doesn't specify where it's own documentation is, or that is unknown to this tool. |
4 | 4 |
|
5 | 5 | In order to improve the tool you were using and improve others, your help would be very valuable.
|
6 | 6 |
|
7 | 7 | ## How you can help
|
8 | 8 |
|
9 |
| -You can submit a pull request to add support for a plugin. |
| 9 | +The best way you can help is to file an issue or submit a PR to the rule in |
| 10 | +question asking them to support the `rule.meta.docs.url` property on their rule. |
| 11 | +This was added in [ESLint v4.15.0][] |
| 12 | +and provides a location where the entire ESLint ecosystem can get to the location |
| 13 | +of the rule's documentation. |
10 | 14 |
|
11 |
| -But the documentation for plugin rules are not on that page, so there's no simple way for us to link to them automatically. That's where you come in. |
| 15 | +This package will continue to be maintained for rules that haven't updated to |
| 16 | +specify their own location though, so if you would like to add support here in |
| 17 | +`eslint-rule-documentation` you can submit a pull request. |
12 | 18 |
|
13 |
| -You'll need a [GitHub account](https://github.com/join)! |
| 19 | +You'll need a [GitHub account][join github]! |
14 | 20 |
|
15 |
| -1. Go edit the page containing the list of supported plugins by clicking [this link](https://github.com/jfmengels/eslint-rule-documentation/edit/master/plugins.json). |
16 |
| -2. Find out where the documentation for the rules of the plugin are located. Find the plugin on `npm`, then the location of the repository, then try to find out the generic url for rule documentation. Very often, it is at `https://github.com/USERNAME/eslint-plugin-PLUGINNAME/blob/master/docs/rules/RULENAME.md`. |
17 |
| -3. Add a new entry for your plugin, using the link in step 2, containing `RULENAME`as a placeholder for the name of the rule. |
18 |
| - - If the author uses the standard convention of hosting the documentation at `https://github.com/USERNAME/eslint-plugin-PLUGINNAME/blob/master/docs/rules/RULENAME.md`, then you can just put `"PLUGINNAME": "USERNAME",` in `plugins.json`. |
19 |
| - - If the author did not follow the repository naming convention outlined above, but still puts the rule documentation in `docs/rules/RULENAME.md`, then you can put `"PLUGINNAME": "USERNAME/REPONAME",` in `plugins.json`. |
| 21 | +1. Find out where the documentation for the rules of the plugin are located. Find the plugin on `npm`, then the location of the repository, then try to find out the generic URL for rule documentation. Very often, it is at `https://github.com/USERNAME/eslint-plugin-PLUGINNAME/blob/master/docs/rules/RULENAME.md`. |
| 22 | +2. Edit `plugins.json`, the file containing the list of supported plugins, by clicking [this link][edit plugins]. |
| 23 | +3. Add a new entry for your plugin, using the link found in step 1, containing `RULENAME`as a placeholder for the name of the rule. |
| 24 | + - If the author uses the standard convention of hosting the documentation at `https://github.com/USERNAME/eslint-plugin-PLUGINNAME/blob/master/docs/rules/RULENAME.md`, then you can just put `"PLUGINNAME": "USERNAME",` in `plugins.json`. ([Example][import]) |
| 25 | + - If the author did not follow the repository naming convention outlined above, but still puts the rule documentation in `docs/rules/RULENAME.md`, then you can put `"PLUGINNAME": "USERNAME/REPONAME",` in `plugins.json`. ([Example][xo]) |
20 | 26 | - If the author does not follow the convention for rule placement, then you must specify the path for the documentation.<br />
|
21 |
| - For example, if the rules for `eslint-plugin-foo` are documented under headings in `README.md`, you should specify that with `https://github.com/author/eslint-plugin-foo#RULENAME`, where `RULENAME` will get replaced with the name of the rule to open. |
22 |
| - |
| 27 | + For example, if the rules for `eslint-plugin-foo` are documented under headings in `README.md`, you should specify that with `https://github.com/author/eslint-plugin-foo#RULENAME`, where `RULENAME` will get replaced with the name of the rule to open. ([Example][mozilla]) |
23 | 28 | 4. In the bottom-field, add a title like `Add support for eslint-plugin-XYZ`, maybe add a little message, and then click on submit.
|
24 | 29 |
|
25 |
| -Thanks a lot for doing this! If you have any trouble with some step, do whatever you can, then describe your problem in the issue, and we'll try to help you for the last bit, or do it ourselves. |
| 30 | +Thanks a lot for doing this! If you have any trouble with these steps, please describe your problem in a [new Issue][], and we'll try to help you for the last bit, or do it ourselves. |
| 31 | + |
| 32 | +[ESLint v4.15.0]: https://eslint.org/blog/2018/01/eslint-v4.15.0-released |
| 33 | +[join github]: https://github.com/join |
| 34 | +[edit plugins]: https://github.com/jfmengels/eslint-rule-documentation/edit/master/plugins.json |
| 35 | +[import]: https://github.com/jfmengels/eslint-rule-documentation/blob/9ddb2c9e6e4fc9e89518ac69fefd97fc9d79904b/plugins.json#L13 |
| 36 | +[xo]: https://github.com/jfmengels/eslint-rule-documentation/blob/9ddb2c9e6e4fc9e89518ac69fefd97fc9d79904b/plugins.json#L38 |
| 37 | +[mozilla]: https://github.com/jfmengels/eslint-rule-documentation/blob/9ddb2c9e6e4fc9e89518ac69fefd97fc9d79904b/plugins.json#L24 |
| 38 | +[new Issue]: https://github.com/jfmengels/eslint-rule-documentation/issues/new |
0 commit comments