Accessibility
autocomplete-attribute
Require autocomplete on identity and payment form fields.
Flags identity, address, and payment inputs that lack an autocomplete attribute. The rule protects autofill UX (a power-user expectation) and the WCAG criterion that browsers rely on autocomplete to assist cognitively-impaired users.
Behavior
- Fixable: No.
- Suggestions: Yes — proposes the correct autocomplete value per input.
- Maps to: WCAG 1.3.5 (Identify Input Purpose).
Examples
Bad:
<input type="email" name="email" />Good:
<input type="email" name="email" autoComplete="email" />Related rules
form-labelsEvery form input must have an associated label.missing-statesDetect form elements missing error, disabled, or required handling.aria-validationForbid invalid ARIA roles and unknown aria-* attributes.
Use it
Enable autocomplete-attribute in your eslint.config.js:
import deslint from '@deslint/eslint-plugin';
export default [
{
plugins: { deslint },
rules: {
'deslint/autocomplete-attribute': 'error',
},
},
];Found a false positive? Report it on GitHub →