-
-
Notifications
You must be signed in to change notification settings - Fork 406
Automate docs with eslint-doc-generator #1930
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
Conversation
1fd5bd6
to
68a674c
Compare
I slightly prefer to keep codes in The only missing part is the rule title, it's easy to support, I planned to do that, but haven't got time. |
It is true you can more-easily tweak the current in-house scripts. I'm hoping the benefits I described in the PR description will outweigh that downside, in addition to these selling points:
What do you mean the "rule title" is missing? |
I mean, currently, we are not auto-generating rule titles, but this PR did. |
I'll leave the decision to Sindre. |
@@ -1,11 +1,10 @@ | |||
# Improve regexes by making them shorter, consistent, and safer | |||
|
|||
<!-- Do not manually modify RULE_NOTICE part. Run: `npm run generate-rule-notices` --> |
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.
@bmish I think it may be smart to have a notice like this.
Maybe:
<!-- end rule header -->
<!-- DO NOT EDIT ANYTHING ABOVE HERE -->
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 added those original warning comments back in. But they aren't managed by eslint-doc-generator as they are outside the managed area indicated by the <!-- end rule header -->
comment.
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.
Filed an issue to consider making this part of the standard comment marker: bmish/eslint-doc-generator#150
I'm a big 👍 on this. I hope all ESLint plugins adopt this so we can get some universal consistency. |
You need to ensure the rule names have more space so less of them are word wrapped. See the difference between our and yours: |
Can you apply |
Would be nice if you could define the config in package.json instead of as CLI flags. https://github.com/sindresorhus/pkg-conf or a similar package. |
The docs for https://github.com/bmish/eslint-doc-generator#configuration-options |
68a674c
to
f77e966
Compare
Thanks for the feedback! Will work on making the tweaks and responding in the next few days. |
f77e966
to
0a3fb20
Compare
0a3fb20
to
903422d
Compare
4de6ac1
to
c47a474
Compare
Done. See: https://github.com/bmish/eslint-doc-generator#--rule-doc-title-format
Planned in bmish/eslint-doc-generator#95.
I wanted to use this but there isn't (yet) any way to opt out rules from that check which we need because of: eslint-plugin-unicorn/test/package.mjs Line 63 in dd92f06
Fixed in bmish/eslint-doc-generator#148. Also implemented a consolidated fixable/suggestions notice: bmish/eslint-doc-generator#149. @sindresorhus all the critical feedback so far should be addressed. Please keep the feedback coming and let me know if you see any blockers. |
c47a474
to
12666c7
Compare
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.
One comment. #1930 (comment)
Co-authored-by: fisker Cheung <[email protected]>
I built this CLI tool eslint-doc-generator for automating the generation of the README rules list and rule doc title/notices for ESLint plugins. It follows common documentation conventions from this and other top ESLint plugins and will help us standardize documentation across ESLint plugins (and generally improve the usability of our custom rules through better documentation and streamline the process of adding new rules).
This is a follow-up to the work I did to add the original notices in #1576. eslint-doc-generator is significantly more robust compared to the previous documentation generator script/tests which I have now removed. It has additional functionality (for example, the rules list legend is auto-generated, and the rules list will show additional columns of information when applicable) and 100% test coverage.
There are some discrepancies between the old docs and the new docs. Some of these are intentional and likely improvements. If you don't like any of the changes, let me know and I can tweak eslint-doc-generator or add a config option to support the desired behavior.