[osprey-ui] fix all suppressed lint violations and remove snapshot#293
[osprey-ui] fix all suppressed lint violations and remove snapshot#293haileyok wants to merge 7 commits into
Conversation
Fix violations of prefer-const, @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type, @typescript-eslint/no-wrapper-object-types, @typescript-eslint/no-unsafe-function-type, no-case-declarations, and no-prototype-builtins. Partially address @typescript-eslint/no-unused-vars (44 of 70 fixed; remaining 26 are parameter prefixing cases better handled in follow-up). Snapshot pruned to reflect remaining hook/JSX/a11y debt. Phase 6 task 2 of docs/design-plans/2026-05-22-ui-eslint.md.
Prefix intentionally-unused function parameters and caught errors with _ to opt into ESLint's argsIgnorePattern, varsIgnorePattern, and caughtErrorsIgnorePattern configurations. Remove unused imports and variables outright. Also configure @typescript-eslint/no-unused-vars rule with underscore ignore patterns in eslint.config.mjs to support the standard convention. Completes the @typescript-eslint/no-unused-vars work from Phase 6 Task 2. Pruned suppressions accordingly. Phase 6 task 2 (continued) of docs/design-plans/2026-05-22-ui-eslint.md.
…ks/refs violations Convert direct setState-in-effect patterns to useMemo where the value is derived from inputs; lift state or move to event handlers where the effect was synchronizing external interaction; document genuine reactive cascades with inline disables where refactoring would obscure intent. Move ref access in src/uikit/Collapse.tsx out of render by updating useResizeObserver hook to accept ref objects. Phase 6 task 3 of docs/design-plans/2026-05-22-ui-eslint.md.
Add explicit key props to lists in bulk_job_history, set displayName on forwardRef/memo components in common and top_n, escape literal entities in bulk_label_drawer, and remove autoFocus from rules_visualizer header. Snapshot now empty — all bulk-suppression entries cleared. Task 6 will remove the snapshot file and suppression machinery. Phase 6 tasks 4-5 of docs/design-plans/2026-05-22-ui-eslint.md.
…lations Previous task (commit 566448f) pruned snapshot entries for these files without actually fixing source. This commit completes the fixes: refactor derived-value patterns to useMemo where applicable, document genuine async/reactive cascades with inline disables explaining the intent. Completes the react-hooks/set-state-in-effect work from Phase 6 Task 3. Phase 6 task 3 (continued) of docs/design-plans/2026-05-22-ui-eslint.md.
All previously-suppressed violations are fixed; the snapshot file is deleted and --suppressions-location / --pass-on-unpruned-suppressions flags are removed from npm scripts and the pre-commit hook. Phase 6 task 6 of docs/design-plans/2026-05-22-ui-eslint.md.
…y pass The mechanical any → unknown substitution in commit 5918f83 propagated into type contracts and broke 11 downstream type checks (tsc --noEmit failures). Root causes and fixes: 1. QueryTypes extracted_features/action_data: Changed Record<string,unknown> to Record<string,string> since all consumers treat values as strings. (Fixes: EventDetailsPanel:145, EventStream:137,162, EventStreamCard:48) 2. HTTPUtils error handling: Stringified error.response.data (unknown) when adding to Set<string> of errors. Used String() conversion to handle the unknown type safely. 3. HierarchicalGraph tooltip: Imported tippy's Instance type for the tip reference variable, replacing the generic 'unknown' with the proper Instance<Props> | undefined type. (Fixes: HierarchicalGraph:77,86) 4. RulesVisualizer ToolTip: Wrapped node.data('file_path') in String() conversion since it's typed unknown but must be displayed as ReactNode. (Fixes: RulesVisualizer:29) 5. RulesVisualizerActions GraphJsonResponse: Aligned interface with actual consumer RuleVizGraph type by adding explicit nodes/edges fields and literal typing for selectedFeatureType. API responses are now properly unpacked with null fallbacks for missing fields. (Fixes: RulesVisualizer:116, RulesVisualizerHeader:48) 6. SearchParamsStateListener setState calls: Refactored to call setState separately for each property update instead of building a Partial<QueryStore> object, which caused zustand type checker to reject undefined fields. (Fixes: SearchParamsStateListener:48) Verification: - tsc --noEmit: 0 errors (was 11) - npm run lint: exit 0 (no new eslint violations) - No reintroduction of @typescript-eslint/no-explicit-any violations Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
hailey: a subsequent thing to do is to go through and remove all the eslint ignores...particularly ones about setting state inside effects, but there are others too we should be able to clean up |
Description
PR #2 of a stacked pair (depends on #292). Fixes every violation captured in
osprey_ui/eslint-suppressions.jsonfrom PR #1, then deletes the snapshot file and removes--suppressions-location/--pass-on-unpruned-suppressionsfromosprey_ui/package.jsonscripts and the.pre-commit-config.yamlhook entry. After this lands,cd osprey_ui && npx eslint srcexits 0 with no flags, no snapshot file.Total: 127 violations across 85 files fixed.
Stacked on
#292 (
hailey/ui-eslint). Land #292 first.Changes by rule family
5918f83prefer-const,no-explicit-any, partialno-unused-vars(44 of 70),no-empty-object-type,no-wrapper-object-types,no-unsafe-function-type,no-case-declarations,no-prototype-builtins483d86bno-unused-vars(remaining 26)566448freact-hooks/set-state-in-effect(partial),react-hooks/refsdafbe4breact-hooks/set-state-in-effect(the 9 commit 566448f missed)6edcdc4react/jsx-key,react/display-name,react/no-unescaped-entities,jsx-a11y/no-autofocuscc37a44190f4adany → unknownpass)Known follow-ups (not blocking this PR)
Code review caught a few items that are real but explicitly out-of-scope for this branch:
react-hooks/set-state-in-effectpolicy — 10 inlineeslint-disable-next-line react-hooks/set-state-in-effect -- <reason>comments remain (Chart.tsx, QueryView.tsx, QueryInput.tsx ×2, Timeseries.tsx ×2, Feature.tsx, QueryHistoryList.tsx, EventStream.tsx, usePromiseResult.tsx). Each carries a reason. Several are "sync local state with parent prop" anti-patterns React docs recommend refactoring to derived state orkey=-based remounts. Chart.tsx is the smallest and has the cleanest fix; the others involve UX trade-offs worth a separate design pass.useResizeObserversignature change in566448fshould have a manual UI smoke against the Collapse component — the new signature is likely a behaviour fix (the original passednullon first render, so the observer never actually wired up), but worth eyes on.tsc --noEmitornpm run build— the type-regression repaired by190f4ad(any → unknowncascade broke 11 type checks andnpm run build) would have landed green on lint alone. Recommend a follow-up PR to add a type-check step to theui-qualityjob.Verification
cd osprey_ui && ./node_modules/.bin/tsc --noEmit→ exit 0 (0 errors).cd osprey_ui && npm run lint→ exit 0 (0 errors, 19 pre-existing warnings).cd osprey_ui && DISABLE_ESLINT_PLUGIN=true NODE_OPTIONS='--openssl-legacy-provider' npx react-scripts build→ exit 0 ("Compiled successfully.").cd osprey_ui && ./node_modules/.bin/eslint src→ exit 0 with no flags, no snapshot file.ls osprey_ui/eslint-suppressions.json→ "No such file or directory".grep -RIn 'suppressions' osprey_ui/package.json .github/workflows .pre-commit-config.yaml→ no matches.DISABLE_ESLINT_PLUGIN=truepreserved in start/build/test/eject (AC7.1).: anyagainst the simplified pre-commit hook entry still fails (exit 1). The gate still works without the snapshot.Checklist
Confidence Level
Claude
🤖 Generated with Claude Code