Skip to content

feat: add template-require-input-type#2763

Merged
NullVoxPopuli merged 1 commit intoember-cli:masterfrom
johanrd:html-validate/template-require-input-type
Apr 28, 2026
Merged

feat: add template-require-input-type#2763
NullVoxPopuli merged 1 commit intoember-cli:masterfrom
johanrd:html-validate/template-require-input-type

Conversation

@johanrd
Copy link
Copy Markdown
Contributor

@johanrd johanrd commented Apr 27, 2026

Note

This is part of a series where Claude has audited eslint-plugin-ember against jsx-a11y, vuejs-accessibility, angular-eslint, lit-a11y and html-validate, ember-template-lint, and the HTML and WCAG specs.

See html-validate no-implicit-input-type for the peer rule concept.

Adds template-require-input-type: rejects <input type="..."> values outside the 22 HTML-defined input types (always on, fixable). Provides an opt-in requireExplicit: true mode that additionally flags <input> without a type attribute.

Complements the existing template-require-button-type rule.

Premises

Premise 1 — correctness (always-on check): HTML spec §4.10.5 defines 22 input type states. The spec states: "The attribute's missing value default and invalid value default are both the Text state." So <input type="foo"> silently falls back to text without any error — a genuine silent-failure class where the author wrote a value that looks meaningful (or miskeyed a valid one, e.g. tex) and the browser quietly does something else.

Premise 2 — style/consistency (opt-in check): <input> with no type attribute is 100% spec-compliant. Requiring an explicit type is an authoring-consistency choice analogous to template-require-button-type. The opt-in is off by default because the correctness argument for inputs is thinner than for <button> (no accidental-submit footgun when type is missing).

Flags (default: invalid values only)

<input type='' />
<input type='foo' />
<input type='TEXTY' />

Flags (with requireExplicit: true)

Adds missing-type to the above:

<input />
<input name='email' />

Allows

<input type='text' />
<input type='email' />
<input type='datetime-local' />
<input type={{this.inputType}} />    {{! dynamic — skipped }}
<input />                            {{! allowed with default config (requireExplicit: false) }}

Prior art

Plugin Equivalent Notes
html-validate no-implicit-input-type Reports <input> missing a type. Does NOT validate the value (this rule adds that).
@angular-eslint/template button-has-type Same design for <button>, not <input>.
jsx-a11y No equivalent.
vuejs-accessibility No equivalent.
lit-a11y No equivalent.

Opt-in: not added to any preset config. Fixable with --fix to type="text" (the HTML default).

@NullVoxPopuli NullVoxPopuli merged commit 675427a into ember-cli:master Apr 28, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants