Skip to content
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

Automate docs with eslint-doc-generator #330

Merged
merged 1 commit into from
Dec 6, 2022

Conversation

bmish
Copy link
Contributor

@bmish bmish commented Oct 27, 2022

I built this CLI tool eslint-doc-generator for automating the generation of the README rules list table 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 custom rules through better documentation and streamline the process of adding new rules). It has 100% test coverage.

@lo1tuma
Copy link
Owner

lo1tuma commented Oct 28, 2022

Thanks for pushing this. A while ago there was a similar request here from @edg2s. Can you elaborate what eslint-doc-generator can do better than eslint-docgen? Also please note, that this project doesn’t publish the docs anywhere and doesn’t have any kind of build and or release process. So how should we make sure the docs are always re-generated when the rules are changed?

@bmish
Copy link
Contributor Author

bmish commented Oct 28, 2022

@lo1tuma thanks for calling that out. I haven't fully reviewed the differences between eslint-docgen and my tool eslint-doc-generator yet. A few of the bigger differences I see so far:

  • eslint-docgen adds examples generated from test cases to rule docs, whereas eslint-doc-generator does not manage examples
  • eslint-doc-generator automatically creates a README rules table + legend with relevant columns of information, whereas eslint-docgen requires the user to implement a custom script for this
  • eslint-doc-generator is written in TypeScript whereas eslint-docgen is written in JavaScript
  • I have tested eslint-doc-generator in 10+ top ESLint plugins so it's robust and lightweight to introduce.

Obviously, I'm biased since I'm actively developing eslint-doc-generator right now. Regardless of which you choose, it looks like there could be an opportunity for the two tools to learn from each other.

@bmish
Copy link
Contributor Author

bmish commented Oct 28, 2022

Also please note, that this project doesn’t publish the docs anywhere and doesn’t have any kind of build and or release process. So how should we make sure the docs are always re-generated when the rules are changed?

@lo1tuma I've added a lint:eslint-docs script in package.json that will ensure the docs are up-to-date on CI. Contributors will want to run npm run update:eslint-docs and check-in the results when creating a PR.

@bmish bmish force-pushed the eslint-doc-generator branch 3 times, most recently from ebc3554 to ae806a7 Compare October 30, 2022 18:59
@bmish bmish marked this pull request as ready for review October 30, 2022 19:01
@bmish bmish force-pushed the eslint-doc-generator branch 5 times, most recently from f952bef to 718de49 Compare November 2, 2022 19:49
@bmish
Copy link
Contributor Author

bmish commented Nov 2, 2022

Just a heads up that this PR is still ready. I'm just updating it whenever I publish a new version of the tool.

@lo1tuma
Copy link
Owner

lo1tuma commented Nov 10, 2022

@bmish sorry for the late response and thanks for the contribution, I’m definitely interested to generate at least some part of the documentation automatically. Unfortunately I didn’t find enough time yet to take a closer look. I hope I will get to it in the next days.

@bmish bmish force-pushed the eslint-doc-generator branch 2 times, most recently from 1866fd7 to 4272afb Compare November 17, 2022 19:08
@bmish bmish force-pushed the eslint-doc-generator branch 2 times, most recently from b66350f to d977069 Compare November 28, 2022 17:00
@bmish
Copy link
Contributor Author

bmish commented Nov 28, 2022

eslint-doc-generator has hit version 1.0.0 🎉. Now is a good time to consider it.

Copy link
Owner

@lo1tuma lo1tuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry again for the late response. I finally found some time to take a closer look. The generated part of the docs looks awesome and it is really cool to have the --check option, so we don’t forget about it.

Thank you very much for this contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants