Accessibility

form-labels

Every form input must have an associated label.

Requires every <input>, <select>, and <textarea> to carry an associated <label>, aria-label, or aria-labelledby. AI-generated forms frequently rely on placeholder-as-label, which fails screen readers and many autofill heuristics.

Behavior

  • Fixable: No.
  • Suggestions: No.
  • Maps to: WCAG 1.3.1 (Info and Relationships), 3.3.2 (Labels or Instructions).

Examples

Bad:

<input type="email" />

Good:

<label htmlFor="email">Email</label>
<input id="email" type="email" />

Related rules

Use it

Enable form-labels in your eslint.config.js:

import deslint from '@deslint/eslint-plugin';

export default [
  {
    plugins: { deslint },
    rules: {
      'deslint/form-labels': 'error',
    },
  },
];

Found a false positive? Report it on GitHub →

Back to all rules