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

chore: validate (lint) production build HTML files #63

Closed
wants to merge 5 commits into from

Conversation

jbmoelker
Copy link
Member

@jbmoelker jbmoelker commented Nov 17, 2023

Issue #6 rightly states, each page must only have a single h1 and headings should not skip a level.
This PR introduces lint:html which uses html-validate to check the HTML pages of the production build.
It correctly finds these issues:

> head-start@0.0.1 lint:html
> html-validate dist/


/home/runner/work/head-start/head-start/dist/en/page-1/index.html
Error:   3:774  error  Multiple <h1> are not allowed                                       heading-level
Error:   3:810  error  Heading level can only increase by one, expected <h3> but got <h4>  heading-level

✖ 2 problems (2 errors, 0 warnings)

More information:
  https://html-validate.org/rules/heading-level.html

Error: Process completed with exit code 1.

But, what do we want to do with that? Because these issues are caused by a content editor using incorrect semantics in the CMS. However failing the build and then checking the logs isn't really a viable option.

Update: now partially resolved by #81 .


Changes

Associated issue

Part of #6

How to test

Checklist

  • I have performed a self-review of my own code
  • I have made sure that my PR is easy to review (not too big, includes comments)
  • I have added/updated tests to prove that my feature works (if not possible please explain why)
  • I have made changes to the README and if the change affects the project setup (npm commands changed, new service added, environmental variable added)
  • I have added a decision log entry if the change affects the architecture or changes a significant technology
  • I have notified a reviewer

Copy link

cloudflare-workers-and-pages bot commented Nov 17, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: c375c55
Status:🚫  Build failed.

View logs

@jbmoelker jbmoelker changed the title feat(lint-html): validate dist/**/*.html pages chore: validate (lint) production build HTML files Nov 17, 2023
@jbmoelker
Copy link
Member Author

This PR would be a good extension to #58 from which it reuses part of the setup.

@jbmoelker jbmoelker added help wanted Extra attention is needed question Further information is requested labels Nov 17, 2023
@jbmoelker jbmoelker mentioned this pull request Nov 29, 2023
3 tasks
@jbmoelker jbmoelker self-assigned this Dec 11, 2023
@jbmoelker
Copy link
Member Author

Regression on package-lock.json issues. Closing in favour of #100 .

@jbmoelker jbmoelker closed this Dec 25, 2023
@jbmoelker jbmoelker deleted the feat/lint-html branch December 25, 2023 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant