chore: enable additional eslint-react rules and fix violations#1028
chore: enable additional eslint-react rules and fix violations#1028
Conversation
Enable 7 eslint-react rules not in recommended-typescript: - jsx-no-leaked-dollar (error): prevent dollar signs leaking into JSX - jsx-no-useless-fragment (warn): remove unnecessary <></> wrappers - dom-no-missing-button-type (warn): require type on <button> elements - dom-no-unsafe-target-blank (error): require rel=noopener (security) - no-duplicate-key (error): catch duplicate keys in JSX lists - no-unstable-context-value (warn): catch perf-degrading context values - no-unstable-default-props (warn): catch perf-degrading default props Fix all 10 dom-no-missing-button-type violations by adding type=button. Fix pre-existing flaky test in client.test.ts: mock IS_DEV_AUTH_BYPASS to false so 401 interceptor actually exercises localStorage clearing (VITE_DEV_AUTH_BYPASS=true in web/.env was causing the test to skip).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
🧰 Additional context used📓 Path-based instructions (2)web/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (web/CLAUDE.md)
Files:
web/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2026-03-20T08:28:32.845ZApplied to files:
🔇 Additional comments (1)
WalkthroughESLint configuration was extended with 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches. Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR strengthens the web frontend’s linting by enabling additional @eslint-react rules (beyond recommended-typescript) and updates existing code/tests/stories to comply, plus stabilizes a previously flaky API client test impacted by the dev auth bypass flag.
Changes:
- Enabled 7 additional
@eslint-reactrules inweb/eslint.config.js. - Fixed
dom-no-missing-button-typeviolations by addingtype="button"to non-submit buttons across components, stories, and tests. - Fixed a flaky 401-interceptor test by mocking
@/utils/devto ensure the dev auth bypass is disabled during the test.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| web/eslint.config.js | Enables additional @eslint-react rules to tighten React/DOM linting. |
| web/src/tests/api/client.test.ts | Mocks dev auth bypass off so 401 interceptor behavior is deterministic in tests. |
| web/src/router/guards.tsx | Adds type="button" to retry button to prevent accidental form submission. |
| web/src/components/ui/live-region.stories.tsx | Adds type="button" to Storybook button to satisfy DOM lint rule. |
| web/src/components/ui/animated-presence.stories.tsx | Adds type="button" to Storybook list buttons to satisfy DOM lint rule. |
| web/src/components/layout/StatusBar.tsx | Adds type="button" to hamburger button for correct default button semantics. |
| web/src/components/layout/Sidebar.tsx | Adds type="button" to footer buttons to satisfy DOM lint rule. |
| web/src/tests/components/ui/section-card.test.tsx | Adds type="button" to test button to satisfy DOM lint rule. |
| web/src/tests/components/ui/drawer.test.tsx | Adds type="button" to opener button to satisfy DOM lint rule. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request introduces several new ESLint rules from @eslint-react to improve code quality and security, such as preventing leaked dollar signs in JSX and requiring explicit types for button elements. Consequently, numerous button elements across the codebase, including those in tests, layouts, and stories, have been updated to include type="button". Additionally, the API client tests now include a mock to disable development authentication bypass, ensuring proper testing of the 401 interceptor. I have no feedback to provide.
Verify that when IS_DEV_AUTH_BYPASS is true, the 401 response interceptor does NOT clear localStorage. Separate file because vi.mock is file-scoped. Pre-reviewed by 5 local agents + 3 external reviewers, 1 finding addressed.
🤖 I have created a release *beep* *boop* --- ## [0.5.8](v0.5.7...v0.5.8) (2026-04-03) ### Features * auto-select embedding model + fine-tuning pipeline wiring ([#999](#999)) ([a4cbc4e](a4cbc4e)), closes [#965](#965) [#966](#966) * ceremony scheduling batch 3 -- milestone strategy, template defaults, department overrides ([#1019](#1019)) ([321d245](321d245)) * five-pillar evaluation framework for HR performance tracking ([#1017](#1017)) ([5e66cbd](5e66cbd)), closes [#699](#699) * populate comparison page with 53 competitor entries ([#1000](#1000)) ([5cb232d](5cb232d)), closes [#993](#993) * throughput-adaptive and external-trigger ceremony scheduling strategies ([#1003](#1003)) ([bb5c9a4](bb5c9a4)), closes [#973](#973) [#974](#974) ### Bug Fixes * eliminate backup service I/O from API test lifecycle ([#1015](#1015)) ([08d9183](08d9183)) * update run_affected_tests.py to use -n 8 ([#1014](#1014)) ([3ee9fa7](3ee9fa7)) ### Performance * reduce pytest parallelism from -n auto to -n 8 ([#1013](#1013)) ([43e0707](43e0707)) ### CI/CD * bump docker/login-action from 4.0.0 to 4.1.0 in the all group ([#1027](#1027)) ([e7e28ec](e7e28ec)) * bump wrangler from 4.79.0 to 4.80.0 in /.github in the all group ([#1023](#1023)) ([1322a0d](1322a0d)) ### Maintenance * bump github.com/mattn/go-runewidth from 0.0.21 to 0.0.22 in /cli in the all group ([#1024](#1024)) ([b311694](b311694)) * bump https://github.com/astral-sh/ruff-pre-commit from v0.15.8 to 0.15.9 in the all group ([#1022](#1022)) ([1650087](1650087)) * bump node from `71be405` to `387eebd` in /docker/sandbox in the all group ([#1021](#1021)) ([40bd2f6](40bd2f6)) * bump node from `cf38e1f` to `ad82eca` in /docker/web in the all group ([#1020](#1020)) ([f05ab9f](f05ab9f)) * bump the all group in /web with 3 updates ([#1025](#1025)) ([21d40d3](21d40d3)) * bump the all group with 2 updates ([#1026](#1026)) ([36778de](36778de)) * enable additional eslint-react rules and fix violations ([#1028](#1028)) ([80423be](80423be)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
Enable 7 eslint-react rules not included in
recommended-typescriptand fix all violations. Also fix a pre-existing flaky test.New ESLint rules enabled
jsx-no-leaked-dollarjsx-no-useless-fragment<></>fragment wrappersdom-no-missing-button-typetypeattribute on<button>elementsdom-no-unsafe-target-blankrel="noopener"withtarget="_blank"(security)no-duplicate-keyno-unstable-context-valueno-unstable-default-propsNote:
jsx-no-leaked-semicolon(also new in 4.2.3) is already included inrecommended-typescriptautomatically.Violations fixed
dom-no-missing-button-typeviolations: addedtype="button"to buttons in Sidebar, StatusBar, guards, stories, and testsFlaky test fix
client.test.ts > clears auth localStorage keys on 401was failing becauseVITE_DEV_AUTH_BYPASS=trueinweb/.envcaused the 401 interceptor to skip localStorage clearing in tests. Fixed by mocking@/utils/devto disable the bypass.Test plan
npm --prefix web run lint-- zero warningsnpm --prefix web run type-check-- cleannpm --prefix web run test-- 2341/2341 passing (including the previously flaky test)Context
Follow-up to dependency PRs #1020-#1027 (all merged). The eslint-react upgrade from 4.2.1 to 4.2.3 added new rules worth enabling.