laywill / laywill/laywill.github.io

djlint run locally reports 54 findings that MegaLinter's HTML_DJLINT never surfaces

Open
#109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
0
Forks
0
Avg merge
8h 17m
Merged PRs (30d)
58

Description

Found incidentally while checking whether an inline onerror on a script tag would trip an HTML rule (#94 / #108). Not caused by that change - it reproduces identically on master.

What happens

Running djlint over the pages the way .djlintrc configures it:

$ djlint --lint *.html
...
Linted 16 files, found 54 errors.

54 findings, all pre-existing:

  • H006 (53) - Img tag should have height and width attributes, on essentially every <img> on the site, banner/spotlight heroes and gallery thumbs alike.
  • H031 (1) - Consider adding meta keywords, on sitemap.html only. Every other page has the meta tag; sitemap.html does not.

MegaLinter is green on master and green on #108, so HTML_DJLINT as MegaLinter invokes it is evidently not running --lint, or is running it with a different rule set. Verified by exporting masters HTML plus .djlintrc to a clean directory and linting there: same 54, same set.

Why it is worth a look

Two separate things, and they want separating:

  1. The gate does not do what the docs imply. CLAUDE.md says the pre-commit hooks are the fast local subset and "full linting is MegaLinter in CI". Anyone who takes that at face value, runs djlint locally to check their HTML before pushing, and gets 54 errors will either assume they broke something or conclude djlint is noise and stop running it. Whichever HTML_DJLINT is actually doing, the discrepancy should be deliberate and written down.
  2. H006 is not purely cosmetic. Missing intrinsic dimensions on the hero and gallery images means the browser cannot reserve space before the image decodes, which is layout shift on exactly the sections #85, #87 and #92 were about. The .image containers may already be sized in CSS, in which case the finding is genuinely moot here and the rule should be added to the ignore list in .djlintrc next to H021 and H023, with the reason - rather than left to fail silently for whoever runs the tool by hand.

Suggested outcome

Establish which mode MegaLinter runs HTML_DJLINT in, then either bring the local invocation into line with it or record why they differ. Separately, decide H006 on its merits - fix the dimensions, or ignore the rule with a stated reason. H031 on sitemap.html is a one-line fix or a one-line ignore either way.

Refs #94, #108

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running djlint --lint *.html with .djlintrc, then inspect how MegaLinter invokes HTML_DJLINT and compare its rule set with the local command. Review CLAUDE.md, .djlintrc, and sitemap.html; done means the local and CI behavior is deliberate and documented, with H006 and H031 either fixed or explicitly ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
ci-cd, testing-qa, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.