-
Notifications
You must be signed in to change notification settings - Fork 234
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
fix: consistent rule doc notices and sections #1226
fix: consistent rule doc notices and sections #1226
Conversation
724fb0f
to
bf22c94
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.
I'll give this a more detailed review later but we've already got a tool for updating our docs which runs in CI so it already covers at least some of what you've added tests for, and automatically does the fixing so want to favor that - would you be interested in expanding that to generate what you've manually added to these docs?
I love the idea of standardizing rule documentation but am wondering if it would be best to try and submit some sort of loose RFC/template so that we could see all the different parts + make it easy to write a tool to help generate them.
@MichaelDeBoey this feels like the sort of thing that would tie in fantastically with the new ESLint community stuff that got landed, so interested in if you have thoughts.
@G-Rath thanks for your initial thoughts.
|
bf22c94
to
8bfb1de
Compare
5a8c5c0
to
d1f6e55
Compare
@G-Rath good news, I went ahead and updated the |
d1f6e55
to
6727301
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.
Looks like a good start - I've put some comments around on how I'd like the output to change; I'll hold off reviewing the tools/
stuff in detail until we've gotten the actual output sorted because that'll impact the actual implementation :)
No but they have rules themselves that have documentation, and this is also exactly why @eslint-community has been created. I don't think it needs to be a strictly large or full-blown RFC but I do like the idea of something like this going through the RFC process in terms of visibility and discussion as I think it could help unify the community and especially help people that are looking to create their own plugins (I think especially for non-native English speakers, having a template like that would make it a lot easier). cc @nzakas cause you're probably the best person to give a steer. |
This is awesome @bmish, thanks for taking the time! Is the plan to upstream this into some shared eslint tool? |
* main: chore(deps): lock file maintenance docs: update removal details in `no-deprecated-functions` (jest-community#1230)
Here's a summary of my plans to standardize ESLint plugin documentation:
|
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.
This is looking awesome! If it's ok with you, I'm keen to toy with this a bit once its landed to see if it can be expanded into a self-standing tool.
We're just got a few type related things to resolve before landing this :)
Co-authored-by: Gareth Jones <Jones258@Gmail.com>
## [27.0.3](jest-community/eslint-plugin-jest@v27.0.2...v27.0.3) (2022-09-09) ### Bug Fixes * ensure jest globals are enabled in `styles` config ([jest-community#1241](jest-community#1241)) ([a165e98](jest-community@a165e98))
Thanks @bmish, this is awesome! |
## [27.0.4](v27.0.3...v27.0.4) (2022-09-10) ### Bug Fixes * consistent rule doc notices and sections ([#1226](#1226)) ([2580563](2580563))
🎉 This PR is included in version 27.0.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@G-Rath @SimenB thanks a lot for helping to get this in! As part of my goal to standardize ESLint plugin documentation, I agree we should work to share this tool, and I'd be interested to collaborate on that. If we went with the CLI command here, it could possibly make sense for it to live inside generator-eslint, although that tool currently only has Yeoman generators in it. I also plan to experiment with whether I could create a lint rule in eslint-plugin-eslint-plugin for enforcing documentation consistency (title, notices, options, etc), as most ESLint plugins already use this plugin and would thus easily pull in the new checks. We could also use a lint rule autofixer to generate the auto-generated parts of the rule doc (title, notices). |
This PR adds the following standardized rule doc notices:
all
,recommended
.--fix
flag on the command line.This improves usability by enabling users to clearly and easily find out if a rule is applying to their codebase given their configuration as well as other key rule details like the availability of auto-fixers or auto-suggestions that can help with addressing violations.
All these notices are tested to ensure they are in the correct position and not forgotten.
yarn tools:regenerate-docs
will also automatically add or update these notices in each rule doc (some inspiration taken from eslint-plugin-unicorn which has a similar command).It's common for ESLint and many popular ESLint plugins to include notices like these. Some examples (note: I am a maintainer on some of these plugins and have been working to standardize rule documentation):
I also added tests about a few other aspects of rule docs:
Rule details
sectionOptions
section only if the rule has options and mentions any named options