ESLint InterlaceESLint Interlace
Plugin: react-a11y

Overview

React accessibility rules for WCAG compliance.

Live from GitHub

This content is fetched directly from README.md on GitHub and cached for 1 hour.

Accessibility Compliance

Ensure your React applications meet WCAG accessibility standards.


ESLint Interlace Logo

Accessibility (a11y) rules for React applications, enforcing WCAG standards.

NPM VersionNPM DownloadsPackage LicenseCodecovSince Dec 2025

Description

This plugin provides Accessibility (a11y) rules for React applications, enforcing WCAG standards. By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.

Philosophy

Interlace fosters strength through integration. Instead of stacking isolated rules, we interlace security directly into your workflow to create a resilient fabric of code. We believe tools should guide rather than gatekeep, providing educational feedback that strengthens the developer with every interaction.

Getting Started

npm install eslint-plugin-react-a11y --save-dev

Quick Start

// eslint.config.js
import reactA11y from 'eslint-plugin-react-a11y';

export default [reactA11y.configs.recommended];

โš™๏ธ Configuration Presets

PresetDescription
recommendedEnables critical accessibility rules (WCAG Level A as errors, AA as warnings)
strictEnforces all rules as errors for maximum WCAG compliance
wcag-aOnly rules required for WCAG 2.1 Level A compliance
wcag-aaIncludes Level A + additional rules for Level AA compliance

Configuration Examples

Basic Usage

// eslint.config.js
import reactA11y from 'eslint-plugin-react-a11y';

export default [reactA11y.configs.recommended];

With TypeScript

import reactA11y from 'eslint-plugin-react-a11y';
import tseslint from 'typescript-eslint';

export default [
  ...tseslint.configs.recommended,
  reactA11y.configs.recommended,
  {
    files: ['**/*.{ts,tsx}'],
    rules: {
      'react-a11y/img-requires-alt': 'error',
    },
  },
];

Strict WCAG Compliance

import reactA11y from 'eslint-plugin-react-a11y';

export default [
  reactA11y.configs['wcag-aa'],
  {
    // Additional customizations
  },
];

Custom Configuration

import reactA11y from 'eslint-plugin-react-a11y';

export default [
  {
    plugins: {
      'react-a11y': reactA11y,
    },
    rules: {
      'react-a11y/img-requires-alt': [
        'error',
        {
          allowAriaLabel: true,
          allowAriaLabelledby: true,
        },
      ],
      'react-a11y/anchor-ambiguous-text': [
        'warn',
        {
          words: ['click here', 'here', 'more', 'read more', 'learn more'],
        },
      ],
    },
  },
];

Rules

Legend

IconDescription
๐Ÿ’ผRecommended: Included in the recommended preset.
โš ๏ธWarns: Set towarn in recommended preset.
๐Ÿ”งAuto-fixable: Automatically fixable by the --fix CLI option.
๐Ÿ’กSuggestions: Providing code suggestions in IDE.
๐ŸšซDeprecated: This rule is deprecated.
RuleCWEOWASPCVSSDescription๐Ÿ’ผโš ๏ธ๐Ÿ”ง๐Ÿ’ก๐Ÿšซ
alt-textEnforce alt text
anchor-ambiguous-textEnforce anchor ambiguous text
anchor-has-contentEnforce anchor has content
anchor-is-validEnforce anchor is valid
aria-activedescendant-has-tabindexEnforce aria activedescendant has tabindex
aria-propsEnforce aria props
aria-roleEnforce aria role
aria-unsupported-elementsEnforce aria unsupported elements
autocomplete-validEnforce autocomplete valid
click-events-have-key-eventsEnforce click events have key events
control-has-associated-labelEnforce control has associated label
heading-has-contentEnforce heading has content
html-has-langEnforce html has lang
iframe-has-titleEnforce iframe has title
img-redundant-altEnforce img redundant alt
interactive-supports-focusEnforce interactive supports focus
label-has-associated-controlEnforce label has associated control
langEnforce lang
media-has-captionEnforce media has caption
mouse-events-have-key-eventsEnforce mouse events have key events
no-access-keyEnforce no access key
no-aria-hidden-on-focusableEnforce no aria hidden on focusable
no-autofocusEnforce no autofocus
no-distracting-elementsEnforce no distracting elements
no-interactive-element-to-noninteractive-roleEnforce no interactive element to noninteractive role
no-keyboard-inaccessible-elementsEnforce no keyboard inaccessible elements
no-missing-aria-labelsEnforce no missing aria labels
no-noninteractive-element-interactionsEnforce no noninteractive element interactions
no-noninteractive-element-to-interactive-roleEnforce no noninteractive element to interactive role
no-noninteractive-tabindexEnforce no noninteractive tabindex
no-redundant-rolesEnforce no redundant roles
no-static-element-interactionsEnforce no static element interactions
prefer-tag-over-roleEnforce prefer tag over role
role-has-required-aria-propsEnforce role has required aria props
role-supports-aria-propsEnforce role supports aria props
scopeEnforce scope
tabindex-no-positiveEnforce tabindex no positive

Part of the Interlace ESLint Ecosystem โ€” AI-native security plugins with LLM-optimized error messages:

PluginDownloadsDescription
eslint-plugin-secure-codingGeneral security rules & OWASP guidelines.
eslint-plugin-pgPostgreSQL security & best practices.
eslint-plugin-cryptoNodeJS Cryptography security rules.
eslint-plugin-jwtJWT security & best practices.
eslint-plugin-browser-securityBrowser-specific security & XSS prevention.
eslint-plugin-express-securityExpress.js security hardening rules.
eslint-plugin-lambda-securityAWS Lambda security best practices.
eslint-plugin-nestjs-securityNestJS security rules & patterns.
eslint-plugin-mongodb-securityMongoDB security best practices.
eslint-plugin-vercel-ai-securityVercel AI SDK security hardening.
eslint-plugin-import-nextNext-gen import sorting & architecture.

๐Ÿ“„ License

MIT ยฉ Ofri Peretz

ESLint Interlace Plugin

View README.md on GitHub โ†’

On this page

No Headings