Skip to main content
🎉 A11y Issue Detection Agent is now live! Detect accessibility issues like a WCAG expert with AI. Try now!
No Result Found
Connect & Get help from 6000+ developers on our Discord community. Ask the CommunityAsk the Community

Configure your linter

Set rule-level severity in your project’s configuration file to control which accessibility issues are flagged as errors, warnings, or info across your IDE and CI/CD pipeline.

Accessibility DevTools supports rule-level configuration through a project-level configuration file (accessibility-devtools.config.json or accessibility-devtools.config.yml). You can assign a severity to each rule or set a global default for all rules to control how violations are reported in your IDE and treated in CI/CD builds. The same configuration applies across VS Code, JetBrains, Cursor, Xcode, and the CLI and NPM package.

Prerequisites

  • Accessibility DevTools installed in your environment (VS Code extension, JetBrains plugin, CLI, or NPM package).
  • A project containing your source code.

Benefits of linter configuration

Configuring linter rules offers the following advantages:

  • Granular control: Set different severity levels for individual rules to align with your project’s accessibility requirements.
  • Consistent enforcement: Share a single configuration file across your team so everyone follows the same accessibility standards.
  • IDE and CI/CD integration: One configuration file applies across all supported IDEs and the CLI, removing the need for separate setups per environment.
  • Flexible rule management: Disable rules that are not applicable to your project and promote warnings to errors as your accessibility practice matures.

Configure your linter

Create the configuration file

Create a configuration file (accessibility-devtools.config.json or accessibility-devtools.config.yml) in the root of your project using JSON format.

If you already have one of these files from setting up custom component linting, add a rules section to the existing file.

Define rule severities

Add a rules object to your configuration file to set the severity for individual rules or apply a global default. Each rule accepts one of the following severity values:

Severity Description
"error" Marks the rule as a blocking issue. In strict mode, at least one error violation causes the CLI to exit with a non-zero exit code.
"warn" Marks the rule as a warning. Does not affect the CLI exit code.
"info" Marks the rule as informational only.
"off" Disables the rule entirely.

Use the all key to set a global default severity for all rules, then override individual rules as needed:

{
  "version": 2,
  "rules": {
    "all": "warn",
    "meaningful-alt-text": "error",
    "autocomplete-valid": "off"
  }
}

The minimum version of the config that supports configuring rules is version 2.

All rules including Spectra and non-Spectra rules support severity configuration. You can reference any rule by its rule ID.

Apply the configuration

Save your configuration file to the root of your project. The linter automatically picks up the configuration in all supported environments:

  • VS Code: Reads the configuration file on startup and on each save.
  • JetBrains: Reads the configuration file when you run a scan.
  • Cursor: Reads the configuration file on startup and on each save.
  • Xcode: Reads the configuration file when you run a build or scan.
  • CLI / NPM package: Reads the configuration file from the project root when you run a scan.

By default, the CLI runs in strict mode. In strict mode, if at least one rule is set to "error" and a violation is detected, the CLI exits with exit code 1. Pass the --non-strict flag (or set "nonStrict": true in the NPM package configuration) to run in non-strict mode. In this mode, the CLI always exits with exit code 0 regardless of detected issues.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle