Skip to content

4.19: Enable TypeScript noImplicitAny option & fix types as necessary#1971

Open
kyoto wants to merge 1 commit into
openshift:release-4.19from
kyoto:4.19-noImplicitAny
Open

4.19: Enable TypeScript noImplicitAny option & fix types as necessary#1971
kyoto wants to merge 1 commit into
openshift:release-4.19from
kyoto:4.19-noImplicitAny

Conversation

@kyoto
Copy link
Copy Markdown
Member

@kyoto kyoto commented May 21, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved Kubernetes resource selector logic for Job and VirtualMachine resources to use explicit label-based matching.
    • Updated alerting rule ID generation for consistency.
  • Chores

    • Added TypeScript type definitions for dependencies.
    • Enhanced type safety across components and utilities.
    • Updated TypeScript compiler configuration for stricter type checking.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kyoto kyoto added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 21, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: db3caa61-c28a-4522-811f-0c29db3804d9

📥 Commits

Reviewing files that changed from the base of the PR and between 844f5e1 and b9c9954.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • package.json
  • src/components/AttachLogModal.tsx
  • src/components/AttachmentModal.tsx
  • src/components/AttachmentsSizeAlert.tsx
  • src/components/Prompt.tsx
  • src/hooks/usePopover.ts
  • src/redux-reducers.ts
  • src/validation.ts
  • tsconfig.json
💤 Files with no reviewable changes (1)
  • tsconfig.json

📝 Walkthrough

Walkthrough

This PR strengthens TypeScript type safety across the codebase by tightening the compiler configuration, adding missing type packages, and annotating components, hooks, and validation flows with explicit types. It also adjusts alert rule ID hashing by removing a salt argument.

Changes

Unified Type Safety Improvements

Layer / File(s) Summary
TypeScript Configuration and Type Packages
tsconfig.json, package.json
Remove noImplicitAny: false override to use strict mode default behavior, and add missing @types packages for js-yaml, lodash, and murmurhash-js.
Prometheus Attachment Type Safety
src/components/Prompt.tsx
Import and apply PrometheusAlert, PrometheusRule, PrometheusRulesResponse, and Silence types to Alert, Silence, and AlertingRule attachment flows; tighten YAML validation to reject null; type the chat attachment payload mapping and textarea change handler.
Kubernetes Log Attachment Selector Typing
src/components/AttachLogModal.tsx
Import Selector type and refactor selectors to use matchLabels format for Job and VirtualMachine/VirtualMachineInstance resources; update container-name extraction with explicit callback types.
Editor and Attachment Size Type Annotations
src/components/AttachmentModal.tsx, src/components/AttachmentsSizeAlert.tsx
Add EditorDidMount type to code-editor mount handler and annotate attachment size aggregation with Attachment type in the reduce callback.
Hook and Redux State Typing
src/hooks/usePopover.ts, src/redux-reducers.ts
Change usePopover return type signature from array to null, and type findIndex callback entry parameters as ImmutableMap<string, unknown> in chat history reducers.
Alert Rule ID Hashing Update
src/validation.ts
Remove the 'monitoring-salt' second argument from murmur3() invocation in alertingRuleID computation, altering the derived rule ID values.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

lgtm

Suggested reviewers

  • syedriko
  • joshuawilson

🐰 Types are tight, types are clear,
No more any to cause us fear!
Selectors match, hashes align,
TypeScript guards make code divine!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: enabling TypeScript's noImplicitAny option and fixing types throughout the codebase, which aligns with the comprehensive type fixes shown in the changeset.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from joshuawilson and syedriko May 21, 2026 05:28
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 21, 2026

/retest

1 similar comment
@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 21, 2026

/retest

@PeterYurkovich
Copy link
Copy Markdown

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 21, 2026
@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 21, 2026

/retest

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants