feat: add eslint-plugin-jsx-a11y for accessibility linting (ASTD-198)#431
feat: add eslint-plugin-jsx-a11y for accessibility linting (ASTD-198)#431marcusds wants to merge 1 commit into
Conversation
- Add eslint-plugin-jsx-a11y to pnpm catalog - Add per-package a11y ESLint configs (eslint.config.a11y.js) for studio and common - Add lint:a11y npm script to both packages with warning baselines - studio: 73 warnings - common: 18 warnings - All jsx-a11y rules run at warn level initially
📝 WalkthroughWalkthroughAdds ChangesAccessibility ESLint Setup
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@web/packages/common/package.json`:
- Line 13: The a11y ESLint config is importing globals without declaring it in
the package manifest. Update the common package’s package.json to add globals as
a dependency or devDependency, and make sure eslint.config.a11y.js can resolve
that import consistently. Keep the change scoped to the package that owns
lint:a11y.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 71a2566a-5cfd-40a8-ba4d-7f665a2b303d
⛔ Files ignored due to path filters (1)
web/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
web/packages/common/eslint.config.a11y.jsweb/packages/common/package.jsonweb/packages/studio/eslint.config.a11y.jsweb/packages/studio/package.jsonweb/pnpm-workspace.yaml
| "format:fix": "prettier --write './**/*.{js,jsx,ts,tsx}'", | ||
| "lint": "eslint . --report-unused-disable-directives --max-warnings 0", | ||
| "lint:fix": "eslint . --fix --report-unused-disable-directives --max-warnings 0", | ||
| "lint:a11y": "eslint . --config eslint.config.a11y.js --no-config-lookup --no-inline-config --max-warnings 18", |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
jq -r '.scripts["test:ci"], .scripts["typecheck"]' web/packages/common/package.jsonRepository: NVIDIA-NeMo/nemo-platform
Length of output: 198
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== package.json relevant sections ==="
python3 - <<'PY'
import json
from pathlib import Path
p = Path('web/packages/common/package.json')
data = json.loads(p.read_text())
for key in ['scripts','dependencies','devDependencies','peerDependencies']:
if key in data:
print(f"\n[{key}]")
for k,v in data[key].items():
if k in ('test:ci','typecheck','globals','eslint-plugin-jsx-a11y','eslint'):
print(f"{k}: {v}")
PY
echo
echo "=== eslint.config.a11y.js ==="
cat -n web/packages/common/eslint.config.a11y.jsRepository: NVIDIA-NeMo/nemo-platform
Length of output: 1324
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import json
from pathlib import Path
p = Path('web/packages/common/package.json')
data = json.loads(p.read_text())
print("scripts.test:ci =", data.get('scripts', {}).get('test:ci'))
print("scripts.typecheck =", data.get('scripts', {}).get('typecheck'))
for section in ('dependencies','devDependencies','peerDependencies'):
deps = data.get(section, {})
if 'globals' in deps:
print(f"{section}.globals =", deps['globals'])
PY
echo
sed -n '1,120p' web/packages/common/eslint.config.a11y.js | cat -nRepository: NVIDIA-NeMo/nemo-platform
Length of output: 1174
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n '"globals"|globals:' web/packages/common/package.json package.json pnpm-workspace.yaml .npmrc .github -g '!**/node_modules/**'Repository: NVIDIA-NeMo/nemo-platform
Length of output: 323
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== direct package references ==="
rg -n '"globals"|globals:' web/packages/common/package.json package.json pnpm-workspace.yaml .npmrc .github -g '!**/node_modules/**' || true
echo
echo "=== repository-wide globals mentions ==="
rg -n '\bglobals\b' web/packages/common -g '!**/node_modules/**' || trueRepository: NVIDIA-NeMo/nemo-platform
Length of output: 848
Add globals to web/packages/common/package.json
web/packages/common/eslint.config.a11y.js imports globals, but web/packages/common/package.json doesn’t declare it.
🤖 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 `@web/packages/common/package.json` at line 13, The a11y ESLint config is
importing globals without declaring it in the package manifest. Update the
common package’s package.json to add globals as a dependency or devDependency,
and make sure eslint.config.a11y.js can resolve that import consistently. Keep
the change scoped to the package that owns lint:a11y.
Source: Coding guidelines
|
Problem
No accessibility linting was in place for the Studio frontend, making it easy to introduce a11y issues.
Solution
Added
eslint-plugin-jsx-a11yto the monorepo with per-package configs forstudioandcommon.Changes
eslint-plugin-jsx-a11yto the catalogeslint-plugin-jsx-a11yas devDependency (catalog:)eslint.config.a11y.jswith all jsx-a11y rules atwarnlevellint:a11yscript (baseline: 73 warnings)eslint-plugin-jsx-a11yas devDependency (catalog:)eslint.config.a11y.jswith all jsx-a11y rules atwarnlevellint:a11yscript (baseline: 18 warnings)Usage
# Run a11y lint check pnpm --filter nemo-studio-ui lint:a11y pnpm --filter @nemo/common lint:a11yNotes
lint/checkcommands as existing warnings would cause those to failupdate-warning-countpatternSummary by CodeRabbit
New Features
lint:a11yscript available in the web packages to run these checks.Chores