ember/template-require-input-type
April 27, 2026 ยท View on GitHub
๐ง This rule is automatically fixable by the --fix CLI option.
This rule rejects <input type="..."> values that are not one of the input
types defined by the HTML spec, and (optionally) requires every <input> to
declare a type attribute.
An invalid value like <input type="foo"> silently falls back to the Text
state โ the browser reports no error, but the author's intent (validation,
inputmode hint, platform keyboard) is lost. That's a genuine silent-failure
class, which this rule always flags and auto-fixes to type="text".
A missing type attribute (<input />) is spec-compliant โ the
missing-value default is the Text state โ so flagging it is a style /
consistency choice, not a correctness one. Opt in with requireExplicit: true
if your team wants parity with template-require-button-type.
Examples
This rule forbids the following (always):
<input type='' />
<input type='foo' />
<input type='TEXTY' />
With requireExplicit: true the rule also forbids:
<input />
<input name='email' />
This rule allows the following:
<input type='text' />
<input type='email' />
<input type='checkbox' />
<input type={{this.inputType}} />
Dynamic values such as type={{this.inputType}} are not flagged at lint time.
Configuration
requireExplicit(boolean, defaultfalse): when true, also flag<input>elements that have notypeattribute. Auto-fix insertstype="text".
module.exports = {
rules: {
'ember/template-require-input-type': ['error', { requireExplicit: true }],
},
};
References
- HTML spec โ the input element
- Adapted from
html-validate'sno-implicit-input-type(MIT).