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
[Docs] Re-sort all rules alphabetically #1742
Conversation
…cally To make it easier to find rules. This adds a script to auto-generate the list of rules and embeds special tags to README. Usage: $ npm run generate-list-of-rules Check whether the auto-generated changes are committed: $ npm run generate-list-of-rules:check Use `markdown-magic` package to transform README https://www.npmjs.com/package/markdown-magic
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 looks fine, thanks - but is there any way we could add a CI check that prevents these from being mis-sorted? Otherwise they'll keep drifting out of sync.
Thanks for your review!
I think it is easiest to use regular expressions, so what do you think? For example: const pattern = /# List of supported rules([\s\S]+?)#/;
const source = '<README.md contents...>';
const ruleListText = source.match(pattern)[1];
const ruleList = ruleListText.trim().split('*');
// check sorting... (I think using the markdown parser is too heavy for this task...) |
I'm not sure using an X parser is ever too heavy a task to parse X :-) |
To install a markdown parser such as I don't know how to extract easily any list items from markdown text, what do you know it? |
An alternative would be to make an |
Sorry for late reply 🙏
Thanks, I will try it! |
@ybiquitous i'm not concerned with a large diff since it can be in a different commit; is it OK if we do it in this PR? |
Yes! No problem! 🙏 |
This is so old. I close. |
That’s unfortunate; old is irrelevant. If you restore the branch and reopen the PR, and add the requested CI check, this can land. |
There's no "restore branch" button? |
I know the restore button, but I thought the branch name Sorry for confusing you... 🙇 |
I'd still prefer to consolidate PR refs - the branch name doesn't stick around but the PR ref does - so it'd be great if you could reopen this, and I'll be happy to manually keep this one in sync with your new one. |
OK, I will sync both. 👍 |
59c671f
to
7d4b55b
Compare
I've cherry-picked from #2541. |
@ljharb Thanks for your suggestion. markdown-magic can reduce the script code and works very well! If we would publish and share the transform script, it might be better to publish as a markdown-magic plugin. See also #2541 (comment) |
@ljharb Could you please review this again? |
a5a7922
to
182b045
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.
Thanks, this is great!
To make it easier to find rules.
It will be appreciated if you review it. 😊