Skip to content

Commit 27f6998

Browse files
Arcanemagusjfmengels
authored andcommitted
Update the documentation for ESLint v4.15.0 URL property (#29)
ESLint v4.15.0 officially added `rule.meta.docs.url` as a location for rules to specify the location of their documentation. Update the `contributing.md` to suggest this as the first option. Also cleans up the steps a bit and add examples. Fixes #28.
1 parent 9ddb2c9 commit 27f6998

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

contributing.md

+25-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
11
# Add support for a new plugin
22

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.
44

55
In order to improve the tool you were using and improve others, your help would be very valuable.
66

77
## How you can help
88

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.
1014

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.
1218

13-
You'll need a [GitHub account](https://github.com/join)!
19+
You'll need a [GitHub account][join github]!
1420

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])
2026
- 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])
2328
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.
2429

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

Comments
 (0)