Skip to content

Report empty-area expect-error directives, document Node 22 and upstream differences - #24

Merged
NullVoxPopuli merged 3 commits into
NullVoxPopuli:mainfrom
NullVoxPopuli-ai-agent:nvp/issues-12-16
Aug 27, 2026
Merged

NullVoxPopuli merged 3 commits into
NullVoxPopuli:mainfrom
NullVoxPopuli-ai-agent:nvp/issues-12-16

Conversation

@NullVoxPopuli-ai-agent

Copy link
Copy Markdown
Contributor

Assessment and fixes for #12, #13, #14, #15, and #16.

Mapper fix (#15, second part)

A {{! @glint-expect-error }} whose next line transforms to nothing (blank, closing tag, closing block, another directive) was never reported as unused. ember-tsc reports all of them. With two consecutive directives the mapper reported only the second, which reads as "the diagnostic is on the line after the directive". The mapper now expects a diagnostic on the placeholder's empty ; statement for such directives, and stays silent when the directive suppressed a transform error. test/diagnostics-tests/directives covers the shapes.

I could not reproduce a (1,1) position for an unused directive. A file that shows it would help.

Node 22 (#16)

The mapper process runs on Node 22. The failure is in the typescript launcher: bin/tsc calls process.execve, and Node 22.15.0 to 22.20.0 and 24.0.0 to 24.9.x pass an empty environment to it (nodejs/node#60029, fixed in 22.21.1 and 24.10.0). The native compiler has no PATH, cannot start node, and reports TS100025 for every file. The mapper never starts, so a runtime check cannot help. This PR adds engines and a README section with the exact range and the error text.

Upstream differences (#12, #13, #14, #15 first part)

test/diagnostics-tests/upstream-differences records each report with the reason in test/test-packages/README.md:

🤖 Generated with Claude Code

https://claude.ai/code/session_011Wt614FPhxrjKFAARVNqFS

NullVoxPopuli and others added 3 commits August 27, 2026 14:52
A `{{! @glint-expect-error }}` directive owns the mapping nodes of the
line after it. When that line is blank, closes a tag or block, or is
another directive, there are no nodes, so no Expect directive was
emitted for it and TypeScript never reported it as unused. `ember-tsc`
reports every one of these. In a large migration this looked like the
unused-directive diagnostic landing on the line after the directive:
with two consecutive directives, only the second was reported.

Expect a diagnostic on the placeholder's empty `;` statement for such
directives. There never is one, so TypeScript reports the directive.

A directive that suppresses a transform error (a special-form arity
error, for example) also owns no nodes, but it is used. The transform
now decides which placeholders suppressed an error before building the
directives, so those stay silent.

Refs NullVoxPopuli#15

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Wt614FPhxrjKFAARVNqFS
Node 22.15.0 to 22.20.0 and 24.0.0 to 24.9.x start `process.execve`
targets with an empty environment (nodejs/node#60029). The `typescript`
package's `bin/tsc` uses `process.execve`, so the native compiler has no
`PATH` and cannot start `node` for the mapper. The mapper never runs, so
it cannot report anything better than TS100025. Record the range in
`engines` so package managers warn at install, and explain it in the
README.

Add `test/diagnostics-tests/upstream-differences`, one file per report
from the AuditBoard migration that `ember-tsc` accepts and the mapper
rejects, with the reason for each in `test/test-packages/README.md`:

- `Args: Record<string, never>`, a conditional `Element` over an
  unresolved type parameter, and `{{component X a=1}}` in content
  position are rejected by `@glint/template`'s types. TypeScript 5.9
  reports the same errors on the transformed text. `ember-tsc` drops
  them because no Volar verification mapping covers the generated text
  they anchor on.
- JSDoc `@extends` over `Component.extend(Mixin)` is ignored by
  TypeScript 7 and honored by 5.9, in plain JavaScript too.

Refs NullVoxPopuli#12, NullVoxPopuli#13, NullVoxPopuli#14, NullVoxPopuli#15, NullVoxPopuli#16

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Wt614FPhxrjKFAARVNqFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants