Skip to content

Rule aliases #1006

@WilcoFiers

Description

@WilcoFiers

The axe rules don't have the best IDs. We've more than a bit inconsistent about them. Some describe what should happen (for example "frame-title-unique"), others describe what shouldn't happen ("empty-heading"). Some include verbs (html-has-lang) others are just nouns (image-alt). Sometimes we put the adjective first (valid-lang) and other times we put it last (scope-attr-valid). We sometimes include a rule "scope" such as "landmark-*", we sometimes use -attr in the rule ID, but not all the time. In short, the IDs are all over the place.

Changing IDs is a breaking change, regardless of how we do it. But one way we may be able to lessen the pain of that is if we use aliases for our rules. The basic idea is: Let's keep the old ID in an alias property on the rule, so that if axe encounters an ID it doesn't know, it can look at the aliases and see if there's a match there. Doing that ensures that existing configurations don't throw errors. Because the IDs change in the output, some work will need to be done by anyone consuming the data to ensure continuity throughout major versions - but that's a solvable problem.

Anyway, here's what it'd look like:

// aria-valid-role-value.json
{
  "id": "aria-valid-role-value",
  "aliases": ["aria-roles"],
  ...
}

This could be a solution to #770

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreIssues in the core code (lib/core)featNew feature or enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions