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

[Docs] Add infrastructure for auto-generating markdown table and list #837

Merged

Conversation

uncommon-type
Copy link
Contributor

Description

This PR adds infrastructure to keep a11y rules in the /rules folder in sync with the README markdown content. It generates markdown list and table programmatically and makes sure their contents are kept up-to-date.

Related Issue

Closes #836

Acceptance Criteria

  • The following has been added as a project dependency: markdown-magic
  • README list and table are generated programmatically
  • README list and table are kept in sync with a11y rules in the /rules folder. Every time a new a11y rule is added to /rules folder , README list and table contents are refreshed programmatically

Type of Changes

Type
πŸ› Bug fix
✨ New feature
πŸ”¨ Refactoring
πŸ’― Add tests
βœ“ πŸ”— Update dependencies
βœ“ πŸ“œ Docs

Testing Steps / QA Criteria

  • From your terminal, pull down this branch
  • npm install to install project dependencies
  • Delete the contents of the README table and list but keep in place the AUTO-GENERATED-CONTENT markers telling markdown-magic to generate table and list contents
  • Then npm generate-list-of-rules to auto-generate the table and list contents
  • Add a new a11y rule to the /rules folder , run npm generate-list-of-rules to refresh the table and list contents

- Add readme.yml file to ensure table and list markdown content is
auto-generated from rules folder
- Add md-magic dependency and scripts to package.json for updating
readme markdown
- Add markdown.config.js file to add transformation functions to the
transforms object
- Add scripts to README markdown to keep documentation content in sync
with readme
- Disable `no-console` rule in markdown.config file in .eslintrc
- Add errorOptions property to source files for rules with extra options

Closes jsx-eslint#836
@codecov
Copy link

codecov bot commented Feb 28, 2022

Codecov Report

Merging #837 (f027dec) into main (ea877c4) will not change coverage.
The diff coverage is n/a.

❗ Current head f027dec differs from pull request most recent head 9980d1d. Consider uploading reports for the commit 9980d1d to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #837   +/-   ##
=======================================
  Coverage   99.22%   99.22%           
=======================================
  Files          98       98           
  Lines        1419     1419           
  Branches      479      479           
=======================================
  Hits         1408     1408           
  Misses         11       11           
Impacted Files Coverage Ξ”
src/rules/alt-text.js 100.00% <ΓΈ> (ΓΈ)
src/rules/anchor-has-content.js 100.00% <ΓΈ> (ΓΈ)
src/rules/anchor-is-valid.js 100.00% <ΓΈ> (ΓΈ)
src/rules/aria-activedescendant-has-tabindex.js 100.00% <ΓΈ> (ΓΈ)
src/rules/aria-props.js 100.00% <ΓΈ> (ΓΈ)
src/rules/aria-proptypes.js 93.22% <ΓΈ> (ΓΈ)
src/rules/aria-role.js 100.00% <ΓΈ> (ΓΈ)
src/rules/aria-unsupported-elements.js 100.00% <ΓΈ> (ΓΈ)
src/rules/autocomplete-valid.js 100.00% <ΓΈ> (ΓΈ)
src/rules/click-events-have-key-events.js 100.00% <ΓΈ> (ΓΈ)
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update ea877c4...9980d1d. Read the comment docs.

name: 'nvm install lts/* && npm install'
with:
node-version: 'lts/*'
- run: npm run generate-list-of-rules:check
Copy link
Member

Choose a reason for hiding this comment

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

trailing newline (reminder for myself)

markdown.config.js Outdated Show resolved Hide resolved
markdown.config.js Outdated Show resolved Hide resolved
src/rules/no-interactive-element-to-noninteractive-role.js Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
markdown.config.js Outdated Show resolved Hide resolved
@uncommon-type uncommon-type marked this pull request as ready for review March 2, 2022 12:36
@@ -43,7 +43,7 @@ const validateId = (node) => {

export default ({
meta: {
docs: {},
docs: { description: 'Enforce that a `label` tag has a text label and an associated control.' },
Copy link
Member

Choose a reason for hiding this comment

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

should we add meta.docs.url here, as well, to match the others?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I've updated the README markdown, tooπŸ˜„.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Looks great! Other than the missing description, I can take care of the rest during the final rebase, if you'd prefer.

.eslintrc Outdated Show resolved Hide resolved
.eslintrc Outdated Show resolved Hide resolved
.eslintrc Outdated Show resolved Hide resolved
.github/workflows/readme.yml Outdated Show resolved Hide resolved
package.json Outdated
Comment on lines 61 to 62
"@babel/core": "^7.17.5",
"@babel/register": "^7.17.0"
Copy link
Member

@ljharb ljharb Mar 3, 2022

Choose a reason for hiding this comment

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

these should be alphabetized (edit: @ comes first tho)

src/rules/label-has-associated-control.js Show resolved Hide resolved
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Thanks! I'll get this rebased and landed :-)

@ljharb ljharb force-pushed the auto-generate-markdown-table-content branch from f027dec to 9980d1d Compare March 3, 2022 19:27
@ljharb ljharb merged commit 9980d1d into jsx-eslint:main Mar 3, 2022
@uncommon-type uncommon-type deleted the auto-generate-markdown-table-content branch March 3, 2022 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infrastructure for keeping a11y rules folder content in sync with README markdown content
2 participants