Skip to content

docs(lint): add a reference page for every lint finding code - #5493

Merged
jrusso1020 merged 2 commits into
heygen-com:mainfrom
akushonkamen:fix/5385-lint-rules-reference
Oct 12, 2026
Merged

jrusso1020 merged 2 commits into
heygen-com:mainfrom
akushonkamen:fix/5385-lint-rules-reference

Conversation

@akushonkamen

Copy link
Copy Markdown
Contributor

What

Adds docs/reference/lint-rules.mdx (859 lines, 12 groups): one ### anchor section per lint finding code, each giving its severity, one sentence on what it catches, and how to fix it, grouped by the rule file the code comes from. Links it from the top of "What the Linter Catches" in docs/packages/lint.mdx and adds reference/lint-rules to the "Composition reference" group in docs.json.

Why

hyperframes lint and check print finding codes, but the docs only describe categories — there is no per-code reference, so the user has only the message itself to go on. The codes live as code: "..." literals scattered across packages/lint/src/rules/*.ts (121 codes) plus 11 project-level codes in packages/lint/src/project.ts, hyperframeLinter.ts and hevcPreviewLint.ts that reach users through the same lintProject pipeline.

A note on the count in the issue: the issue's 120 comes from its own suggested grep, code: "[a-z_]+". Exactly one code contains a digit (base64_media_prohibited), which that character class cannot match. With code: "[a-z_0-9]+" the count is 121 — and it was 121 with an identical set already at b20f3f7, the commit two minutes before the issue was filed, so nothing merged since.

Related work

Fixes #5385. Claim: comment on the issue. No overlapping PR found (open-PR search returned nothing for this).

How

  • Every code gets a ### \code`` anchor section: severity, what it catches, and a fix. Content is drawn from the rule's own message and fixHint, then tightened into prose. The 11 project-level checks get the same treatment under "Project-level checks".
  • Severities were read back from the source, including the conditional ones: four codes are "Error / warning" (severity depends on how the finding arises) and four structure checks are "Warning or error" (warning from the CLI, error when Studio lints the file it is editing).
  • Discoverability: docs.json "Composition reference" group gains reference/lint-rules, and docs/packages/lint.mdx links to it from "What the Linter Catches".

Test plan

Coverage (the issue's acceptance criterion):

  • git grep -hoE 'code: "[a-z_0-9]+"' -- 'packages/lint/src/rules/*.ts' ':!*.test.ts' | sort -u → 121 unique codes; the 11 project-level codes come from project.ts / hyperframeLinter.ts / hevcPreviewLint.ts, zero overlap with the rules set.
  • Looping over all 132 codes greping ^### \code`$indocs/reference/lint-rules.mdx` → 121/121 rule codes and 11/11 project codes hit, 0 missing.

Docs checks (the same commands .github/workflows/docs.yml runs, under timeout 300 since they need more than the default 120 on this machine):

  • cd docs && npx mint validate → exit 0, "success build validation passed".

  • cd docs && npx mint broken-links --check-redirects → exit 0, "success no broken links found".

  • Unit tests added/updated (not applicable: docs only)

  • Manual testing performed (coverage loop and docs checks above)

  • Documentation updated (this is the documentation)

  • Comments follow CONTRIBUTING.md "Comments": no code comments were added; rationale lives here

docs/reference/lint-rules.mdx lists every code emitted by the linter
(132: the 121 rule codes in packages/lint/src/rules/*.ts plus the 11
project-level probes that run as part of a project lint) with its
severity, what it catches, and how to fix it, grouped by the rule file
the code comes from. Conditional severities (Studio-host structure
checks, GSAP seek-order hazards) say when they escalate.

Link it from docs/packages/lint.mdx and add it to the Composition
reference group in docs.json.

Issue: heygen-com#5385

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this, it's a big, useful page. I checked it against packages/lint/src. All 132 code: "..." literals are covered with no extras, the fixed severities match, and docs.json is valid. There are a few things to fix before it merges:

Needed

  1. Three codes are missing. color_grading_non_media, color_grading_invalid_json and color_grading_invalid_structure are error-severity codes emitted through a report(code, …) helper in rules/media.ts (lines 499, 513, 521), so a code: grep misses them. The page says it lists every code, so they belong in "Media elements".
  2. html_dir_attribute_breaks_render names the wrong trigger. The page says rtl "(or ltr)", but the rule fires on rtl or auto (composition.ts: normalizedDir !== "rtl" && normalizedDir !== "auto"), and ltr produces no finding.

Should fix
3. system_font_will_alias only runs for distributed/Lambda renders (if (!options.distributed) return [];), but the entry reads as if it always applies.
4. inaccessible_media_url is only emitted by the exported lintMediaUrls() API, and the CLI doesn't call it. So hyperframes lint/check never show it, which contradicts the intro. Note that it's API-only.

Nits

  • timeline_track_too_dense: "many timed elements" means more than 3 per track (MAX_TIMED_ELEMENTS_PER_TRACK = 3).
  • gsap_infinite_repeat: the fix text only covers the error case. When the composition has a finite data-duration, it's a warning and nothing needs changing.

— Rames

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving at eef6c28a. I pushed one commit on top of yours, with the fixes from my earlier review:

  • Added color_grading_invalid_json, color_grading_invalid_structure and color_grading_non_media under "Media elements".
  • html_dir_attribute_breaks_render now names the real trigger (rtl or auto; ltr isn't flagged).
  • system_font_will_alias now says it only runs with distributed: true.
  • inaccessible_media_url now says only the lintMediaUrls() API reports it; lint/check don't.
  • timeline_track_too_dense now says "more than 3".

The page now lists all 135 codes the rules emit (both code: literals and report() helper calls), with nothing extra. docs.json is valid, and mint validate and mint broken-links pass. Thanks for the thorough page!

— Rames

@jrusso1020
jrusso1020 merged commit c3816a1 into heygen-com:main Oct 12, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: add a reference page for every lint finding code

3 participants