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

chore(website): generate rule docs options automatically #5386

Merged

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Jul 26, 2022

PR Checklist

Overview

Uses even more fancy Markdown AST manipulations in the generated-rule-docs.ts Docusaurus plugin to automate the creation of much of the rules docs pages.

  • ## How to Use, and `## Options are added if they don't yet exist
  • Contents are added to the beginning of ## Options:
    • Base rule extensions have a link to the base rule's options
    • An .eslintrc.cjs snippet adds in the suggested config usage
    • If the rule isn't configurable, the This rule is not configurable. text is added
    • If the rule is configurable, json-schema-to-typescript and prettier are used to print the types and defaultConfig
  • description fields are used in rule schema metadata instead of .md explanations

Assorted other standardizations:

  • Using Docusaurus admonitions for deprecation notices and the like
  • Explaining default options is moved under ## Options (e.g. ban-ts-comment.md)
  • Properly using tabs in at least ban-types.md
  • Listing out string literal options (e.g. comma-dangle.md)
  • Using /* eslint ... */ comments in options examples

Some old todos from when this PR was a draft should be done:

  • get Options heading in right sidebar
  • see if json-schema-to-typescript can make shared types for repeated shapes this week I learned, definitions properties are the intended way to explicitly do that in json-schema ✨ ✅
  • finish trimming down more rule docs .md files

@nx-cloud
Copy link

nx-cloud bot commented Jul 26, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit cfd750d. 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 Jul 26, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit cfd750d
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/62fd2cc1d601b70008c0dc47
😎 Deploy Preview https://deploy-preview-5386--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.

@Josh-Cena
Copy link
Member

  • get Options heading in right sidebar

You need to move this remark plugin from remarkPlugins to beforeDefaultRemarkPlugins. See https://docusaurus.io/docs/markdown-features/plugins#creating-new-rehyperemark-plugins

@armano2
Copy link
Member

armano2 commented Jul 27, 2022

@bradzacher
Copy link
Member

@armano2 i was thinking that would be an awesome thing to do! Already suggested!

https://twitter.com/bradzacher/status/1552009532124958720

It would be a decent chunk of work to add the descriptions for everything up-front.

Side note: would be easy to write a lint rule to enforce all schemas define descriptions.

JoshuaKGoldberg and others added 2 commits July 27, 2022 20:15
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review August 1, 2022 03:30
@bradzacher bradzacher added the package: website Issues related to the @typescript-eslint website label Aug 7, 2022
bradzacher
bradzacher previously approved these changes Aug 7, 2022
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

https://deploy-preview-5386--typescript-eslint.netlify.app/rules/explicit-function-return-type

This one seems to be broken:

image


This is looking good to me - I spot checked a number and they looked good!

packages/eslint-plugin/src/rules/no-implicit-any-catch.ts Outdated Show resolved Hide resolved
bradzacher
bradzacher previously approved these changes Aug 17, 2022
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

image

@bradzacher
Copy link
Member

@JoshuaKGoldberg resolve the conflicts and we can merge this!

@bradzacher bradzacher added the 1 approval One team member has approved this PR; a second should be enough to merge it label Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval One team member has approved this PR; a second should be enough to merge it package: website Issues related to the @typescript-eslint website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: Automate the Options heading in rule docs pages
4 participants