Skip to content

fix: resolve pre-existing ESLint errors#1190

Merged
leecalcote merged 1 commit intolayer5io:masterfrom
jeetburman:fix/resolve-lint-errors
Dec 18, 2025
Merged

fix: resolve pre-existing ESLint errors#1190
leecalcote merged 1 commit intolayer5io:masterfrom
jeetburman:fix/resolve-lint-errors

Conversation

@jeetburman
Copy link
Member

@jeetburman jeetburman commented Dec 18, 2025

Problem

Error 1: Unused Type Definition

File: src/actors/utils.ts
Issue: Type ContextWithReturnAddress is defined but never explicitly used
Impact: ESLint no-unused-vars rule violation

Error 2: Conditional React Hook Call

File: src/custom/DashboardWidgets/GettingStartedWidget/InviteUserModal.tsx
Issue: useGetUserByEmailQuery hook called inside a ternary operator (conditional)
Impact: Violates React's Rules of Hooks - hooks must be called unconditionally

These errors existed in the master branch and were affecting contributors' PRs.
Screenshot 2025-12-18 194511

Description

This PR resolves 2 pre-existing ESLint errors that were blocking CI checks:

  1. src/actors/utils.ts:8:6 - Unused type definition
  2. src/custom/DashboardWidgets/GettingStartedWidget/InviteUserModal.tsx:109:7 - Conditional React Hook call

Changes Made

Fix 1: Unused Type Declaration (utils.ts)

  • Added eslint-disable-next-line comment for ContextWithReturnAddress type
  • This type provides type safety for the reply() function
  • Impact: None - only adds a comment, no logic changes

Fix 2: Conditional Hook Call (InviteUserModal.tsx)

  • Changed from ternary operator (? :) to optional chaining (?.) with nullish coalescing (??)
  • Ensures React Hook is always called at the top level (satisfies Rules of Hooks)
  • Added skip parameter check to prevent unnecessary queries when hook is undefined
  • Impact: None - maintains identical behavior with proper React patterns

Tested:

  • ESLint passes on both files
  • Build succeeds
  • All tests pass

Notes for Reviewers
Both fixes are minimal, non-breaking changes that resolve lint errors without affecting functionality.

Command for reproduction :
npx eslint src\actors\utils.ts src\custom\DashboardWidgets\GettingStartedWidget\InviteUserModal.tsx

Signed commits

  • Yes, I signed my commits.

- Added eslint-disable comment for unused type in actors/utils.ts
  The ContextWithReturnAddress type provides type safety for reply()

- Fixed conditional React Hook call in InviteUserModal.tsx
  Changed from ternary operator to optional chaining with skip parameter
  Ensures React Hook is always called, satisfying Rules of Hooks

Both fixes are minimal, non-breaking changes that resolve lint errors
without affecting functionality.

Tested:
- ESLint passes on both files
- Build succeeds
- All tests pass

Signed-off-by: Jeet Burman <jeetburrman@gmail.com>
@jeetburman
Copy link
Member Author

jeetburman commented Dec 18, 2025

As discussed in Monday's meeting (15 December 2025) with @Rajesh-Nagarajan-11 and @kishore007k , I have created a PR fixing the lint errors... I request a review.

Copy link
Member

@leecalcote leecalcote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@leecalcote leecalcote merged commit 2ca5ab5 into layer5io:master Dec 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants