Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

CI lint check failing with 13 ESLint errors after recent changes. Errors span multiple rule categories across 10 files.

Fixes

Type safety

  • routing.test.ts: Replace any cast with unknown for proper type narrowing

Unused expressions (@typescript-eslint/no-unused-expressions)

  • workerfy.ts, CatalogDesignTable.tsx, FlipCard.tsx: Convert foo && foo() patterns to if (foo) foo()

React hooks rules

  • Hidden.tsx: Remove unnecessary forwardRef wrapper (MUI Hidden doesn't support refs)
  • ChallengesSection.tsx, LearningSection.tsx: Replace useEffect + setState with derived state via useMemo
  • ContentClassInfo.tsx, CatalogCardDesignLogo.tsx: Move component definitions outside render to prevent recreation on each render

Dead code

  • ResponsiveDataTable.test.tsx: Remove stale eslint-disable comment for nonexistent import/first rule

Example: setState-in-effect refactor

// Before: triggers cascading renders
const [open, setOpen] = useState(false);
useEffect(() => {
  setOpen(data.length > 0);
}, [data]);

// After: derived state, no effect needed
const [manualOverride, setManualOverride] = useState<boolean | null>(null);
const hasData = useMemo(() => data.length > 0, [data]);
const open = manualOverride ?? hasData;
Original prompt

https://github.com/layer5io/sistent/actions/runs/21055981817


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Remove unused eslint-disable comment in ResponsiveDataTable.test.tsx
- Replace `any` with `unknown` type cast in routing.test.ts
- Convert && expression patterns to if statements in workerfy.ts
- Simplify Hidden component to remove problematic forwardRef usage
- Convert && expression pattern to if statement in CatalogDesignTable.tsx
- Refactor ChallengesSection to use useMemo instead of setState in useEffect
- Refactor ContentClassInfo to remove component defined during render
- Refactor LearningSection to use useMemo instead of setState in useEffect
- Refactor CatalogCardDesignLogo to use render function instead of component
- Convert && expression patterns to if statements in FlipCard.tsx

Co-authored-by: fitzergerald <182300328+fitzergerald@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with action run not completing fix: resolve ESLint errors in CI workflow Jan 16, 2026
Copilot AI requested a review from fitzergerald January 16, 2026 04:59
@ritzorama ritzorama marked this pull request as ready for review January 16, 2026 19:24
Copilot AI review requested due to automatic review settings January 16, 2026 19:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR resolves 13 ESLint errors that were causing CI failures. The changes focus on improving code quality and TypeScript type safety across multiple areas.

Changes:

  • Replaced any type cast with unknown for proper type narrowing in tests
  • Converted conditional expressions (foo && foo()) to explicit if statements to satisfy no-unused-expressions rule
  • Replaced useEffect + setState patterns with derived state using useMemo to avoid unnecessary re-renders
  • Removed unnecessary forwardRef wrapper from Hidden component and moved component definitions outside render functions

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
routing.test.ts Improved type safety by using unknown instead of any for type casting
workerfy.ts Converted conditional expressions to explicit if statements
FlipCard.tsx Converted conditional expressions to explicit if statements
CatalogDesignTable.tsx Converted conditional expression to explicit if statement
Hidden.tsx Removed unnecessary forwardRef wrapper
ChallengesSection.tsx Replaced useEffect + setState with derived state using useMemo
LearningSection.tsx Replaced useEffect + setState with derived state using useMemo
ContentClassInfo.tsx Moved component definition outside render using useMemo
CatalogCardDesignLogo.tsx Converted nested component to function call
ResponsiveDataTable.test.tsx Removed obsolete eslint-disable comment

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +39
const CONTENT_CLASS: ContentClassType = useMemo(
() => ({
community: {
icon: CommunityClassIcon,
color: theme.palette.icon.secondary
},
official: {
icon: OfficialClassIcon,
color: '#EBC017'
},
verified: {
icon: VerificationClassIcon,
color: theme.palette.primary.brand?.default || KEPPEL
}
}),
[theme.palette.icon.secondary, theme.palette.primary.brand?.default]
);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The constant CONTENT_CLASS is being memoized, but it contains static component references (icon classes) that never change. Only the color values depend on theme. Consider extracting just the color computation into useMemo, or using a simpler approach since the object structure is constant and only colors are dynamic.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lee Calcote <leecalcote@gmail.com>
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.

4 participants