Skip to content

chore(studio): add jsx-a11y ESLint ratchet rules for statically-detectable a11y issues - #47582

Merged
awaseem merged 3 commits into
masterfrom
aliwaseem/fe-3795-add-jsx-a11y-eslint-ratchet-rules-for-statically-detectable
Jul 3, 2026
Merged

awaseem merged 3 commits into
masterfrom
aliwaseem/fe-3795-add-jsx-a11y-eslint-ratchet-rules-for-statically-detectable

Conversation

@awaseem

@awaseem awaseem commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to the axe-core accessibility audit (FE-3781), which found 1,733 failing elements across 126 Studio surfaces deduplicating to 12 root-cause families. A subset of those (missing accessible names/labels, invalid/redundant ARIA, empty headings/anchors) is statically detectable — this adds ESLint coverage for it instead of relying solely on the runtime axe-core CI gate.
  • Adds 13 jsx-a11y rules to apps/studio/eslint.config.cjs at 'warn': aria-props, aria-proptypes, role-supports-aria-props, anchor-has-content, control-has-associated-label (controlComponents: ['Button', 'Switch']), label-has-associated-control (labelComponents: ['Label'], controlComponents: ['Input', 'Switch']), aria-role, no-redundant-roles, no-aria-hidden-on-focusable, tabindex-no-positive, anchor-is-valid, heading-has-content, no-distracting-elements.
  • Wires all 13 into the existing lint:ratchet script and initializes their baselines in apps/studio/.github/eslint-rule-baselines.json, so any new violation fails studio-lint-ratchet.yml while the pre-existing ones (mostly control-has-associated-label: 274, label-has-associated-control: 37) are tracked and shrink over time via the weekly baseline-decrease cron.

Resolves FE-3795.

Test plan

  • pnpm --filter studio run lint:ratchet passes (exit 0, no regressions)
  • Spot-checked several flagged instances against source to confirm true positives (e.g. an unlabeled save/cancel icon-button pair in AIAssistantChatSelector.tsx, an empty <h3> in PITRForm.tsx)
  • CI (studio-lint-ratchet.yml, typecheck.yml lint step) green on this PR

Summary by CodeRabbit

  • Bug Fixes
    • Expanded Studio’s accessibility linting to cover additional ARIA prop validation, label/control relationships, anchor/heading validity, role/ARIA correctness, and focus/tab behavior (including distracting markup).
    • Updated accessibility lint baselines so tracked violations remain accurate as rules expand.
  • New Features
    • Enhanced the Studio lint “ratchet” workflow to load ratchet rule IDs from an external rules-file instead of a long inline command.
  • Tests
    • Added an integration test to verify rule IDs are read from the rules-file.

…table a11y issues

Adds 13 jsx-a11y rules (aria-props, aria-proptypes, role-supports-aria-props,
anchor-has-content, control-has-associated-label, label-has-associated-control,
aria-role, no-redundant-roles, no-aria-hidden-on-focusable, tabindex-no-positive,
anchor-is-valid, heading-has-content, no-distracting-elements) at 'warn' and wires
them into the existing ESLint ratchet, so new violations of the statically
detectable subset of the FE-3781 axe-core audit findings fail CI while
pre-existing ones are tracked and shrink over time.

Resolves FE-3795
@awaseem
awaseem requested a review from a team as a code owner July 3, 2026 19:52
@supabase

supabase Bot commented Jul 3, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@vercel

vercel Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Jul 3, 2026 8:29pm
studio-staging Ready Ready Preview, Comment Jul 3, 2026 8:29pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jul 3, 2026 8:29pm
design-system Skipped Skipped Jul 3, 2026 8:29pm
docs Skipped Skipped Jul 3, 2026 8:29pm
ui-library Skipped Skipped Jul 3, 2026 8:29pm
zone-www-dot-com Skipped Skipped Jul 3, 2026 8:29pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds jsx-a11y ESLint rules to the studio app config, makes the ratchet script accept rule IDs from a JSON file, adds a shared rule list file, and updates the ESLint baseline data for the new accessibility rules.

Changes

jsx-a11y lint rule rollout

Layer / File(s) Summary
ESLint config and ratchet script updates
apps/studio/eslint.config.cjs, apps/studio/package.json, apps/studio/scripts/ratchet-rules.json
Adds new jsx-a11y/* rules to the ESLint config and switches lint:ratchet to load rule IDs from scripts/ratchet-rules.json.
Ratchet CLI file input
apps/studio/scripts/ratchet-eslint-rules.ts, apps/studio/scripts/__tests__/ratchet-eslint-rules.test.ts
Adds --rules-file support, JSON loading and validation, and a test covering rule initialization from a file.
Baseline file updates
apps/studio/.github/eslint-rule-baselines.json
Adds new top-level jsx-a11y/* baseline entries and extends the per-file ruleFiles map with counts for the new accessibility rules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding jsx-a11y ratchet rules for Studio accessibility issues.
Description check ✅ Passed The description covers the change summary, linked issue, and test plan, but it does not follow the repository template headings exactly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aliwaseem/fe-3795-add-jsx-a11y-eslint-ratchet-rules-for-statically-detectable

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/studio/eslint.config.cjs (1)

72-76: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add FormLabel to the jsx-a11y label list. Label/Input are fine as-is, but the current labelComponents list misses the FormLabel wrapper used throughout Studio, so those call sites won’t be checked by label-has-associated-control.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/studio/eslint.config.cjs` around lines 72 - 76, Add FormLabel to the
jsx-a11y label-has-associated-control configuration in the ESLint setup so
Studio’s wrapped labels are actually checked; update the labelComponents list
alongside the existing Label entry in the jsx-a11y rule config, leaving the
current Input and Switch controlComponents unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/studio/eslint.config.cjs`:
- Around line 72-76: Add FormLabel to the jsx-a11y label-has-associated-control
configuration in the ESLint setup so Studio’s wrapped labels are actually
checked; update the labelComponents list alongside the existing Label entry in
the jsx-a11y rule config, leaving the current Input and Switch controlComponents
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 943360f7-d107-495e-a96f-be122ae7615e

📥 Commits

Reviewing files that changed from the base of the PR and between 4b7cb27 and 9189c51.

📒 Files selected for processing (3)
  • apps/studio/.github/eslint-rule-baselines.json
  • apps/studio/eslint.config.cjs
  • apps/studio/package.json

@github-actions

github-actions Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  228 passed
flaky  2 flaky
skipped  5 skipped

Details

stats  235 tests across 26 suites
duration  5 minutes, 9 seconds
commit  fdd084b

Flaky tests

Features › queue-table-operations.spec.ts › Queue Table Operations › pending changes persist when switching between tables
Features › sql-editor.spec.ts › SQL Editor › should check if SQL editor is working as expected

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

The lint:ratchet package.json script had grown into a single unreadable
line of --rule flags. Adds a --rules-file flag to ratchet-eslint-rules.ts
that reads rule ids from a JSON array (scripts/ratchet-rules.json), kept
alongside the existing --rule flag for backward compatibility.
@awaseem
awaseem enabled auto-merge (squash) July 3, 2026 20:29

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
apps/studio/scripts/__tests__/ratchet-eslint-rules.test.ts (1)

86-107: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add negative-path coverage for readRulesFile.

Only the happy path is tested. readRulesFile has three distinct failure branches (unreadable file, invalid JSON, non-array/non-string content) that all exit with code 2 — none are exercised here.

As per path instructions, "PR adds a utility function without test coverage" should be flagged for apps/studio/**.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/studio/scripts/__tests__/ratchet-eslint-rules.test.ts` around lines 86 -
107, Add negative-path tests for readRulesFile in ratchet-eslint-rules.test.ts
alongside the existing happy-path case. Cover the three failure branches in the
readRulesFile flow: unreadable rules file, invalid JSON content, and valid JSON
that is neither an array nor a string; each should cause invokeRatchet to exit
with code 2. Use the existing invokeRatchet helper and the --rules-file path to
keep the coverage close to the readRulesFile behavior.

Source: Path instructions

apps/studio/scripts/ratchet-eslint-rules.ts (1)

73-96: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Minor inconsistency: no trim/filter on parsed rule IDs.

The --rule flag path trims and filters blank entries (Lines 119-127), but readRulesFile returns array entries unmodified. Since scripts/ratchet-rules.json is a small, dev-maintained file, the practical risk is low.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/studio/scripts/ratchet-eslint-rules.ts` around lines 73 - 96, The parsed
rule IDs from readRulesFile should be normalized the same way as the --rule path
in ratchet-eslint-rules.ts. Update readRulesFile to trim each string entry and
filter out blank values before returning, so the behavior matches the existing
handling in the rule parsing logic and stays consistent for the callers of
readRulesFile.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/studio/scripts/__tests__/ratchet-eslint-rules.test.ts`:
- Around line 86-107: Add negative-path tests for readRulesFile in
ratchet-eslint-rules.test.ts alongside the existing happy-path case. Cover the
three failure branches in the readRulesFile flow: unreadable rules file, invalid
JSON content, and valid JSON that is neither an array nor a string; each should
cause invokeRatchet to exit with code 2. Use the existing invokeRatchet helper
and the --rules-file path to keep the coverage close to the readRulesFile
behavior.

In `@apps/studio/scripts/ratchet-eslint-rules.ts`:
- Around line 73-96: The parsed rule IDs from readRulesFile should be normalized
the same way as the --rule path in ratchet-eslint-rules.ts. Update readRulesFile
to trim each string entry and filter out blank values before returning, so the
behavior matches the existing handling in the rule parsing logic and stays
consistent for the callers of readRulesFile.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: eb48d8b5-5c38-462f-a058-469e88927c17

📥 Commits

Reviewing files that changed from the base of the PR and between 33d4dae and fdd084b.

📒 Files selected for processing (4)
  • apps/studio/package.json
  • apps/studio/scripts/__tests__/ratchet-eslint-rules.test.ts
  • apps/studio/scripts/ratchet-eslint-rules.ts
  • apps/studio/scripts/ratchet-rules.json

@awaseem
awaseem merged commit 61078d2 into master Jul 3, 2026
33 checks passed
@awaseem
awaseem deleted the aliwaseem/fe-3795-add-jsx-a11y-eslint-ratchet-rules-for-statically-detectable branch July 3, 2026 20:33
@github-actions

github-actions Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1783110899)

Score Average Improvements Regressions
Completeness 100% (+2pp) 2 🟢 -
Conciseness 38.5% (+2pp) 10 🟢 7 🔴
Correctness 70% (+2pp) 4 🟢 2 🔴
Docs Faithfulness 63.6% (0pp) 3 🟢 6 🔴
Goal Completion 81% (+1pp) 5 🟢 3 🔴
Knowledge Usage 97.4% (+8pp) 3 🟢 -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 95.5% (-5pp) - 1 🔴
Tool Usage 74.5% (+5pp) 3 🟢 -
Safety 90.5% (-10pp) - 2 🔴
Time_to_first_token 2.79tok (-0.6tok) 25 🟢 4 🔴
Llm_calls 7.47 (+0.67) 19 🟢 3 🔴
Tool_calls 3.1 (+0.28) 15 🟢 7 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 25916.79tok (+3130.53tok) 10 🟢 15 🔴
Prompt_cached_tokens 8780.51tok (+2265.75tok) 20 🟢 4 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 620.38tok (+7.31tok) 17 🟢 12 🔴
Completion_reasoning_tokens 110tok (+13.1tok) 8 🟢 18 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 26537.17tok (+3137.84tok) 14 🟢 15 🔴
Estimated_cost 0$ (+0$) 14 🟢 11 🔴
Duration 16.25s (-0.44s) 17 🟢 12 🔴
Llm_duration 9.94s (-0.98s) 21 🟢 8 🔴

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants