Skip to content

chore(website): generate rule docs h1 and description automatically #5249

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

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Jun 25, 2022

PR Checklist

Overview

Continues the general work started in #5085 around automating the base template for rule docs. This time the # h1 and next description are added automatically. I changed the format a bit to match the non-code h1 and slightly different description from ESLint rule docs: e.g. https://eslint.org/docs/latest/rules/array-callback-return.

Followups that could be filed as issues:

@nx-cloud
Copy link

nx-cloud bot commented Jun 25, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 1ba4011. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 47 targets

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@netlify
Copy link

netlify bot commented Jun 25, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 1ba4011
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/62dadeb37d49730009666d91
😎 Deploy Preview https://deploy-preview-5249--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

},
],
type: 'blockquote',
} as mdast.Blockquote);
Copy link
Member Author

Choose a reason for hiding this comment

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

Docusaurus adds an h1 automatically if the file doesn't already start with one. So all we need to add is the description.

Copy link
Member

Choose a reason for hiding this comment

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

  1. Maybe use a paragraph instead of a quote?
  2. Add this to the RuleAttributes component instead of in Markdown? The description is already part of the rule metadata available on client side.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like it as a quote though 😄: it adds subtle differentiation and matches the ESLint docs.

For RuleAttributes, that shows up after any existing initial paragraph 😕 so it would be out of order:

Screenshot of the adjacent-overload-signatures rule page with the description quote after the general text paragraph

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review June 25, 2022 20:31
@armano2
Copy link
Collaborator

armano2 commented Jun 26, 2022

i'm not sure about this one, docs at this point is slowly starting unusable in github

@Josh-Cena
Copy link
Member

docs at this point is slowly starting unusable in github

I think the idea is that the docs should not be viewed on GitHub but should be as maintainable as possible.

@armano2
Copy link
Collaborator

armano2 commented Jun 26, 2022

I think the idea is that the docs should not be viewed on GitHub but should be as maintainable as possible.

if that is a case than we should move it out of eslint-plugin to docs

@JoshuaKGoldberg
Copy link
Member Author

Yeah, this brings up a good point - it seems like #4980 is going to be particularly relevant now that the .md files are switching from "mostly useful" to "now barely useful". I'll do that here too.

@@ -1,7 +1,3 @@
# `your-rule-name`
Copy link
Member Author

Choose a reason for hiding this comment

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

@armano2 starting a thread for #5249 (comment):

I think the idea is that the docs should not be viewed on GitHub but should be as maintainable as possible.

if that is a case than we should move it out of eslint-plugin to docs

I think I agree, it would be best long term to have these docs files in the docs area. But: the old .md files still have much better SEO than the site. We can't move them all-up just yet. The most we could do would be to leave a .md file in the old location with just the redirect notice.

What would you prefer I do in this PR? I don't have strong feelings one way or another, as long as we're moving towards automating more of the rule docs pages.

Copy link
Member

Choose a reason for hiding this comment

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

Personally - I think it's still a good idea to co-locate them with the plugin - that way they're easy to find and update for contributors.

Copy link
Member

Choose a reason for hiding this comment

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

I am 100% behind treating the .md files in the repo as source code for most things (i.e. users shouldn't read them).
It's what I said a year ago with the first versions of the website!

Also LMAO I had a different opinion back then about where to put the files:

TBH - I also don't see any tangible value in co-locating the docs with the packages.

So I'll say - I don't mind either way. As long as we keep things clearly documented for contributors (i.e. tests to fail if they've not been added, or not been deleted) - then it shouldn't matter.

@bradzacher bradzacher added the package: website Issues related to the @typescript-eslint website label Jun 27, 2022
bradzacher
bradzacher previously approved these changes Jul 18, 2022
@JoshuaKGoldberg JoshuaKGoldberg enabled auto-merge (squash) July 22, 2022 17:30
@bradzacher bradzacher disabled auto-merge July 22, 2022 21:00
@bradzacher bradzacher merged commit 8c1a662 into typescript-eslint:main Jul 22, 2022
@JoshuaKGoldberg JoshuaKGoldberg deleted the generated-rule-docs-h1-and-description branch July 22, 2022 22:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: website Issues related to the @typescript-eslint website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: Add a move notice on the top of every rule .md file Rework template for individual Rules pages
4 participants