Add and enable the validate-changelog-entry rule for validating Markdown-based changelog entries.#71
Conversation
validate-changelog-entry rule for validating Markdown-based changelog entries.validate-changelog-entry rule for validating Markdown-based changelog entries.
| plugins: { | ||
| markdown | ||
| }, | ||
| language: 'markdown/gfm', |
There was a problem hiding this comment.
Unlike other tests in this project, this one uses ESM. This is because otherwise ESLint fails to load the markdown/gfm language.
However, because all tests are loaded using require() I had to update our CI configuration to use Node 22.12, which added support for require(esm). This is the same change we recently implemented in other repositories.
| docker: | ||
| - image: cimg/node:22.12.0 |
There was a problem hiding this comment.
…n-based changelog entries.
129b41f to
7a68166
Compare
| const yaml = require( 'yaml' ); | ||
|
|
||
| const ALLOWED_TYPES = { | ||
| single: [ |
There was a problem hiding this comment.
Perhaps we could follow DRY principle, and extract common values to a common key, and create a function that would return joined list? Then again, its just twice, so I'm, not really insisting here.
There was a problem hiding this comment.
IMO that will overcomplicate a pretty simple bit of code. Pulling things out and adding a function would just add unnecessary abstraction without much real benefit here.
🚀 Summary
validate-changelog-entryrule for validating Markdown-based changelog entries.📌 Related issues
💡 Additional information
Error highlighting
I implemented this rule so that it tracks the positions of invalid entries rather than highlighting the entire frontmatter block as invalid. This makes it much easier to locate the issue.
output.mp4
How to test
externalfolder and check out theck/18777-add-rule-to-validate-changelog-entrybranch.ck/18777-lint-changelog-entriesbranches in thecoreandcommercialrepositories (core PR, commercial PR).yarn reinstall.yarn nicein both the core and commercial repositories, and experiment with the generated changelog file. Add valid and invalid values, remove values, etc., to verify that all cases are covered by the rule and that it doesn't break under any circumstances.