Skip to content

Enable TypeScript noImplicitAny option & fix types as necessary#1981

Open
kyoto wants to merge 1 commit into
openshift:mainfrom
kyoto:main-noImplicitAny
Open

Enable TypeScript noImplicitAny option & fix types as necessary#1981
kyoto wants to merge 1 commit into
openshift:mainfrom
kyoto:main-noImplicitAny

Conversation

@kyoto
Copy link
Copy Markdown
Member

@kyoto kyoto commented May 26, 2026

Manual cherry pick of #1971

Summary by CodeRabbit

  • Refactor

    • Improved TypeScript type annotations and type safety across the codebase.
  • Chores

    • Updated TypeScript type package dependencies and build configuration.

@kyoto kyoto added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 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: 38903a7b-3191-4c44-a818-729f6bc758a2

📥 Commits

Reviewing files that changed from the base of the PR and between 716a2f9 and 52c31a4.

⛔ 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 applies TypeScript type safety improvements across the lightspeed-console codebase by adding type definitions for external libraries, explicitly typing component callbacks and reducer parameters, strengthening YAML validation, and updating the alerting rule ID hashing to remove a salt parameter.

Changes

TypeScript Type Safety Improvements

Layer / File(s) Summary
TypeScript Infrastructure and Dependencies
package.json, tsconfig.json
Adds @types/js-yaml, @types/lodash, @types/murmurhash-js to devDependencies and removes the explicit noImplicitAny: false compiler option to strengthen type checking.
Kubernetes Selector Types in Attachment Log Modal
src/components/AttachLogModal.tsx
Imports Selector type and refactors Job and VirtualMachine/VirtualMachineInstance pod selectors to use explicit matchLabels form. Container element mapping now includes inline type annotation.
Editor and Attachment Size Component Types
src/components/AttachmentModal.tsx, src/components/AttachmentsSizeAlert.tsx
Adds EditorDidMount type to CodeEditor handler and explicit Attachment type annotation for reduce callback in total size calculation.
Prompt Component Multi-Callback Type Safety
src/components/Prompt.tsx
Imports PrometheusRulesResponse, PrometheusAlert, PrometheusRule, and Silence types. Strengthens YAML validation to reject null values, types fetch callbacks for Prometheus queries and silences, types attachment mapping for submission, and adds explicit React event handler typing for textarea onChange.
Redux Reducer and Hook Type Annotations
src/redux-reducers.ts, src/hooks/usePopover.ts
Adds explicit ImmutableMap<string, unknown> type annotation to reducer callback parameters and updates usePopover hook to return null instead of empty array with explicit return type.

Alert Rule Hash Computation

Layer / File(s) Summary
Remove Salt Parameter from alertingRuleID Hash
src/validation.ts
Updates alertingRuleID function to compute Murmur3 hash using only the rule key string, removing the previous 'monitoring-salt' salt parameter. Rule ID values will be deterministically different.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

lgtm

Suggested reviewers

  • joshuawilson
  • syedriko

Poem

🐰 A rabbit's ode to stronger types:
Types cascade through the files so bright,
Selectors wrapped, callbacks typed right,
No salt, just hash in validation's way,
The compiler smiles—type safety's here to stay! ✨

🚥 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 accurately describes the main objective of the PR: enabling TypeScript's noImplicitAny option and fixing type issues throughout the codebase to comply with stricter type checking.
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 xrajesh May 26, 2026 06:14
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 26, 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 26, 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 kyoto added the lgtm Indicates that a PR is ready to be merged. label May 26, 2026
@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 26, 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.

1 participant