Skip to content

feat(atomic-a11y): add shared types, guards, constants and WCAG data modules#7122

Open
y-lakhdar wants to merge 17 commits intofeat/a11y-package-scaffoldfrom
feat/a11y-shared-foundation
Open

feat(atomic-a11y): add shared types, guards, constants and WCAG data modules#7122
y-lakhdar wants to merge 17 commits intofeat/a11y-package-scaffoldfrom
feat/a11y-shared-foundation

Conversation

@y-lakhdar
Copy link
Contributor

@y-lakhdar y-lakhdar commented Feb 16, 2026

Context

The @coveo/atomic-a11y package provides accessibility tooling for Atomic components — automated WCAG auditing, conformance reporting, and VPAT generation.

This is the foundation layer that every other module depends on.

What this PR does

Establishes the shared type system, utility functions, and WCAG reference data that all downstream modules import from. Single source of truth.

Two directories:

  • src/shared/ — TypeScript contracts (A11yReport, CriterionLevel, etc.), type guards, constants, and file I/O helpers
  • src/data/ — WCAG 2.2 reference data (success criteria definitions, axe-core rule→WCAG mappings, criterion metadata), dynamically fetched at build time from the official W3C WCAG 2.2 JSON

WCAG criteria generation

Instead of hard-coding the list of WCAG success criteria, a build-time script (scripts/generate-wcag-criteria.mjs) fetches the authoritative W3C JSON and generates src/data/wcag-criteria.ts. This ensures the criteria stay in sync with the official spec without manual maintenance.

Run pnpm generate:wcag to regenerate. The generated file includes all Level A and AA criteria from WCAG 2.2 (55 total — 4.1.1 Parsing is excluded as it is obsolete in WCAG 2.2).

PR Chain (2 of 7)

# PR Branch Description
1 #7111 feat/a11y-package-scaffold Package scaffolding
2 #7122 feat/a11y-shared-foundation Shared types, constants, utilities ← this PR
3 #7123 feat/a11y-reporter VitestA11yReporter
4 #7124 feat/a11y-openacr OpenACR report generator
5 #7125 feat/a11y-scripts CLI scripts
6 #7126 feat/a11y-reporter-wiring Wire reporter into atomic vitest config
7 #7117 feat/a11y-ci-integration Weekly a11y scan workflow

KIT-5468

…modules

- Add src/shared/types.ts with unified type definitions (CriterionLevel, A11yReport, etc.)
- Add src/shared/guards.ts with type guard functions (isRecord, isA11yReport)
- Add src/shared/constants.ts with shared constants (DEFAULT_*, patterns, validation sets)
- Add src/shared/file-utils.ts with file I/O utilities (readJsonFile, wasExecutedDirectly)
- Add src/data/wcag-criteria.ts with WCAG 2.2 criteria definitions (56 entries)
- Add src/data/axe-rule-mappings.ts with axe rule to WCAG mappings
- Add src/data/criterion-metadata.ts with criterion metadata map
- Update index.ts to export shared types, guards, constants and data modules
- Add skipLibCheck to tsconfig.json
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2cf42d6b6b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions
Copy link

🔗 Scratch Orgs ready to test this PR:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants