Skip to content

fix(lint): accept GLSL script blocks without JavaScript syntax errors - #6227

Open
AksharP5 wants to merge 1 commit into
heygen-com:mainfrom
AksharP5:fix-glsl-lint
Open

AksharP5 wants to merge 1 commit into
heygen-com:mainfrom
AksharP5:fix-glsl-lint

Conversation

@AksharP5

Copy link
Copy Markdown
Contributor

What

Valid inline GLSL shaders fail lint with invalid_inline_script_syntax, because the JavaScript syntax rule tries to parse their source as JavaScript. The three shader types already supported by the shader rule now pass that check.

Same input on upstream main and this branch:

<script id="fragmentShader" type="x-shader/x-fragment">
precision mediump float;
void main() { gl_FragColor = vec4(1.0); }
</script>

This block is in the complete composition and Node reproduction in #6225.

Result Main 3d45d1b037860afd42439a2b4ca7e0dc762448c3 This branch
ok false true
errorCount 1 0
Findings invalid_inline_script_syntax, Unexpected token (2:10), line 5, column 11 []

The same false error is fixed for x-shader/x-vertex and text/glsl. Unsafe shader expressions still emit shader_unbounded_cosine_pow.

Why

Authors cannot pass the static lint gate with GLSL data blocks that the linter explicitly supports. The existing shader regression checked only its warning, hiding the concurrent syntax error.

Related work

Closes #6225.

#5640 added GLSL shader warnings, which this fix preserves. #929 and #928 cover the already-fixed module/importmap case. #2223 handles embedded HTML structure. Open and closed issues/PRs were searched by symptom and shader MIME types on 2026-10-24, most recently at 16:32 UTC; no competing report or implementation was found. #779 is an unrelated closed registry contribution.

How

Keep the supported GLSL MIME types in one shared set. Both shader detection and the existing JavaScript syntax exemptions use it. No new rule or public API.

Test plan

  • Unit tests added/updated. All four regression assertions failed on baseline; all 1,083 lint tests pass after the fix, including existing classic-JavaScript syntax checks.
  • Manual testing performed. Ran the exact Node reproduction against the built package before and after, including on refreshed main.
  • Documentation updated in docs/packages/lint.mdx.
  • Comments follow CONTRIBUTING.md. No comments added.

Workspace build passed. After rebasing over an engine-only upstream commit, repeated lint build, lint typecheck and the full lint suite. Oxlint, oxfmt, Fallow, comment citations and comment share checks passed.

Environment: Linux x64, Node 26.11.1, installed Bun 1.4.1 versus the repository's 1.4.4 pin. /tmp rejected writes with error -122; validation passed with TMPDIR pointing inside this checkout's ignored dependency directory. No software upgrade or system configuration change. Mintlify is not installed, so its docs validation was not run.

@mintlify

mintlify Bot commented Oct 24, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit c12d759.

Approve preview

@miguel-heygen miguel-heygen 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, this is a tidy fix. Putting the three GLSL types in one shared set means the shader rule and the syntax rule can't disagree again, and I like that the new test asserts the whole findings list is empty, so no other rule trips on shader source either. I confirmed the new assertions fail on the old core.ts and pass with the change, and that the cosine/pow warning still fires.

One optional follow-up, not needed for this PR: the syntax check still works from a list of types to skip, so other inert data blocks get the same false error. application/ld+json with valid JSON, text/plain and text/x-template all report invalid_inline_script_syntax on this branch. Browsers only run JavaScript types, module and importmap, so checking only those (packages/lint/src/rules/core.ts:808) would cover every data block at once.

Verdict: APPROVE
Reasoning: The fix is correct and minimal, the tests go through the public lint entry and fail without the change, and all checks are green.

This branch has not been deployed

No deployments
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.

lint rejects supported GLSL script blocks as invalid JavaScript

2 participants