fix: repair cross-package bugs so tests and typecheck pass - #138
Open
stooit wants to merge 1 commit into
Open
Conversation
- ui/Button: forward aria-label to the button element for icon-only buttons so they have an accessible name (WCAG 2.2 SC 4.1.2) - ui/DataTable: use functional setState for the sort-direction toggle to avoid a stale-closure toggle across rapid successive clicks - utils/formatDate: use en-GB so day-first dates render without a leading zero on the day (1/03/2024), matching the expected format - web/api: fix stale import of the renamed useThrottle export from @e2e/utils (now useDebounce) - tsconfig: add bun-types to compilerOptions.types to resolve the bun:test module type errors in the test files bun run test: 13 pass / 0 fail. tsc --noEmit: 0 errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and eliminates all type errors across the monorepo.
bun run test→ 13 pass / 0 fail;npx tsc --noEmit→ 0 errors. No test files were modified and no dependencies were added.Changes
packages/ui— Buttonaria-labelto the<button>element foriconOnlybuttons so they expose an accessible name (WCAG 2.2 SC 4.1.2). A generic fallback label is applied (with a dev warning) when omitted.packages/ui— DataTablesetStatefor the sort-direction toggle so it stays correct across rapid successive clicks; removed the staleBUG:comments.packages/utils—formatDateen-GBso day-first dates render with no leading zero on the day (1/03/2024). Everyen-AUfield-option combination forces a 2-digit day, which failed the test's/^1/assertion.apps/web—lib/api.tsuseThrottleexport in@e2e/utilswas renamed touseDebounce; updated the import (and collapsed the duplicate@e2e/utilsimport).tsconfig.json"types": ["bun-types"]to resolve theCannot find module 'bun:test'(TS2307) errors reported in the test files. Config-level change only — no test files touched.Assumptions
bun:testtype errors resolved via tsconfig, not test files. Addingbun-typestocompilerOptions.typesis the correct, test-file-free way to eliminate those TS2307 errors.bun-typeswas already a devDependency.formatDateusesen-GBbecauseen-AU(and every field-option variant of it) forces a 2-digit day in the ICU implementation, which the test forbids. Its siblingformatDateTimewas intentionally left onen-AUand out of scope (no test covers it).Follow-ups (not addressed — out of scope of the failing tests)
Button.tsxreferencesprocess.env.NODE_ENVunguarded in a shared UI package that ships raw source; considertypeof process !== "undefined"guarding to avoid a browserReferenceError."Button"fallback label satisfies a11y scanners mechanically but conveys no meaning; a discriminated-union type requiringaria-labelwheniconOnlywould be stronger, but conflicts with an existing (unmodifiable) test that rendersiconOnlywithout a label."bun-types": "latest"is unpinned in devDependencies — worth pinning for reproducibility.