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
Build: Automatically add rule meta data in docs (fixes #5774) #6419
Conversation
LGTM |
By analyzing the blame information on this pull request, we identified @nzakas, @btmills and @ilyavolodin to be potential reviewers |
Forgot to mention changes in the Jekyll front matter:
|
I haven't had a chance to fully go over the code yet. But I don't think this is the right direction. I think we should completely delete |
Yes, agree about unit tests, especially for rule docs because the processing must work for a moving target, until we have written the new guidelines and deleted redundant content from existing files. |
I'd like to suggest something that keeps most of the templately stuff out of
Then, you can use Liquid in a layout template to use the page frontmatter like this:
I think this is a much better way to go because it keeps page layout in the |
@ilyavolodin I will cut this pull request back to the rule docs which was the specific request in the issue. I support an alternative method for the rules index, as long as the non-meta content for the page comes from somewhere in eslint repo. Because I lack experience with the templates, let’s invite someone else to pick up that part. @nzakas Right, I started down that nicely declarative path when you suggested it in #5774 (comment) I got stuck because the examples of Liquid templates in the _includes and _layouts directories of eslint.github.io are in HTML. I will do more homework whether it is possible to interpret Liquid templates in markdown before conversion to HTML. That matters because descriptions can have backticks which need to be converted to |
Oh yeah, sorry, I got a bit confused. The layout can be just HTML:
The |
Have put this on the back burner, but one question because I missed the
|
I don't know of a way to delete content in a Liquid template |
Noting while I am thinking of it that rule docs in eslint.github.io repo will be “headless”
|
@ilyavolodin @kaicataldo Ran into errors when I added the Jekyll
|
@pedrottimark I don't have a lot of experience with Jekyll, but doing a little digging around yielded these:
Both seem to indicate that the problem was caused by something not being correct in the YAML frontmatter - any chance that's what's going on here? |
@kaicataldo Thank you for searching. An ordinary reference to |
I really like the new main heading style that puts rule name first and summary below. A superb improvement! Will the existing markdown files in |
@aubergine10 Thank you for feedback and forward-thinking question. The long-term goal is:
The medium-term goal will be:
The short-term goal of either this pull request or a better one from another team member:
|
Once the |
@pedrottimark I can reuse the script I wrote for the codeshifting the rules to the new format to generate the initial version of the file with metadata for removed rules. Just ping me when we are at that stage and I will be glad to help! :) |
@aubergine10 Searching for text in the entire local repo is a good point to remember. I do that a lot, and it became even more effective when the original source for several non-rule docs moved from eslint.github.io to eslint repo in #6012 Although we are committed to deleting this repetition of
|
@vitorbal Oh please, can you pick up the rules index with direction from with Nicholas and Ilya? Here are a few thoughts which y’all can take or leave: A data format to make it easy to remove a rule (if we even do that again) is copy the object value of the Jekyll front matter s/List of available rules/Rules/ and template which has
The table format in markdown:
The table format in HTML where the description needs markdownify backticks to
|
@pedrottimark sure, I will gladly take over the rules index part, i will add it to my pipeline (currently working on the internal rule to check validity of meta props) and will let you know when i start working on it! |
@aubergine10
No. Forcing a build process before commit will just lead to problems. Whether or not something is fixable isn't critical information because you can only turn on fixes for all rules or turn them off for all rules. We can worry about offline docs at a later time. |
Recording the thought that another way to reduce the complexity of code in Makefile.js is provide variables |
@pedrottimark looks like @ilyavolodin got a head start on the rules index page, and it looks very good: 1cb0486 |
Sorry I didn't say that I started working on this. I had a little bit of free time yesterday and just wanted to get it done. I'll create a PR later tonight for it. |
Do we still need this? It looks like @ilyavolodin has a simpler solution that is almost ready. |
@nzakas I think this one does more, it also updates every rule documentation page titles and adds a paragraph about fixable, recommended. |
Yes, @ilyavolodin is right, @pedrottimark has been working separately on automating the insertion of the metadata for every rule's doc!
|
What do you think if I cut this PR back even further to do only the following:
The helper function to generate lines of front matter from a config object argument seems like a good place for me to practice on setting up unit tests. A future separate PR to meet the original goal of this PR will require more extensive unit tests for a helper function to find the redundant main heading and fixable paragraph at the beginning of rule docs. |
@pedrottimark Sounds good to me, that's quite some progress already :) |
@vitorbal Ha, the deferred part is the main goal of generating description, recommended, and fixable from rule
|
Checking in on this, since it's been sitting here for a while. |
Seems like @pedrottimark has been busy lately. It would still be very nice to auto-generate the metadata info of each rule doc. Would love to take this on myself, but I've got a couple of things on my pipeline already. |
Can we close this, since it looks like it's quite old and probably won't be finished up? |
I'm fine with that. I can open a new issue whenever I have time to pursue this (probably only after the JSCS milestone is finished). |
Thank you in advance for careful code review.
Added helper functions in
forEach
under// 4. Loop through all files in temporary directory
Main goals:
An associated chore (refs #5417) will update
meta.description
in 10 rules which are inconsistent with the current rules index.Future goals: