Skip to content

Post-merge-review: Fix template-no-arguments-for-html-elements: add svg and mathml elements#2687

Merged
NullVoxPopuli merged 2 commits intoember-cli:masterfrom
johanrd:day_fix/template-no-arguments-for-html-elements
Apr 15, 2026
Merged

Post-merge-review: Fix template-no-arguments-for-html-elements: add svg and mathml elements#2687
NullVoxPopuli merged 2 commits intoember-cli:masterfrom
johanrd:day_fix/template-no-arguments-for-html-elements

Conversation

@johanrd
Copy link
Copy Markdown
Contributor

@johanrd johanrd commented Apr 13, 2026

Summary

  • Adds svg-tags to the element allowlist alongside existing html-tags — so <circle @r="x"> etc. are now flagged.
  • Documents accepted false negatives via new test cases: custom elements (<my-element @foo="x">), namespaced components (<NS.Foo @bar="baz">), and named blocks (<:slot @item="x">) aren't in the allowlists, so they're not flagged. Web-component namespace is open and can't be enumerated.
  • Adds a scope-check test: when div is rebound in GJS (let div = <template>...), <div @greeting="hello"> is treated as a component invocation and not flagged.

Test plan

  • <div @title="x"> / <button @onClick=...> / <span @data=...> → flagged
  • <circle @r="x"> (SVG) → now flagged
  • <MyComponent @title="x"> → valid
  • <NS.Foo @bar="baz"> → valid (dotted, not in allowlist)
  • <my-element @foo="x"> → valid (accepted false negative)
  • <:slot @item="x"> → valid (colon-prefixed, not in allowlist)
  • <div @greeting="x"> where div is rebound in GJS → valid (scope check)

@johanrd johanrd marked this pull request as ready for review April 13, 2026 16:09
@johanrd johanrd force-pushed the day_fix/template-no-arguments-for-html-elements branch from 2ff4253 to 3118f91 Compare April 13, 2026 17:38
@johanrd johanrd changed the title Fix template-no-arguments-for-html-elements: align HTML-element detection with upstream Post-merge-review: Fix template-no-arguments-for-html-elements: align HTML-element detection with upstream Apr 13, 2026
// - has NO uppercase letters (component invocations like <MyThing>)
// - does NOT contain '-' (HTML custom elements like <my-element>)
// Everything else is a component / custom-element / slot — not a plain HTML element.
function isHtmlElement(tagName) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use html-tags, don't use this function.

this function is duplicated through mayn rules, and we should just remove it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Switched to html-tags + svg-tags + scope (same approach as #2689). Dropped the isHtmlElement helper

…vg-tags

Adds svg-tags to the html-tags allowlist so `<circle @r="x">` etc. are
flagged alongside HTML elements. Documents accepted false negatives
(custom elements, namespaced components, named blocks) via new test
cases. Also adds a test for the scope-check path (`div` rebound in GJS
is treated as a component, not flagged).
@johanrd johanrd force-pushed the day_fix/template-no-arguments-for-html-elements branch from 5dea854 to fbc68ce Compare April 15, 2026 19:32
@johanrd johanrd requested a review from NullVoxPopuli April 15, 2026 19:34
Extends the allowlist with MathML tag names. NullVoxPopuli confirmed the
plugin can use ESM-only packages since the supported Node range (>=20.19)
has require(esm). Adds invalid tests for `<mfrac @numerator="x">` and
`<circle @r="5" />` (SVG, via svg-tags).
@johanrd johanrd changed the title Post-merge-review: Fix template-no-arguments-for-html-elements: align HTML-element detection with upstream Post-merge-review: Fix template-no-arguments-for-html-elements: add svg and mathml elements Apr 15, 2026
@NullVoxPopuli NullVoxPopuli merged commit 707de8d into ember-cli:master Apr 15, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants