-
Notifications
You must be signed in to change notification settings - Fork 167
fix: resolve ESLint errors in CI workflow #1234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- 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>
There was a problem hiding this 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
anytype cast withunknownfor proper type narrowing in tests - Converted conditional expressions (
foo && foo()) to explicit if statements to satisfy no-unused-expressions rule - Replaced
useEffect+setStatepatterns with derived state usinguseMemoto avoid unnecessary re-renders - Removed unnecessary
forwardRefwrapper 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.
| 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] | ||
| ); |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lee Calcote <leecalcote@gmail.com>
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: Replaceanycast withunknownfor proper type narrowingUnused expressions (
@typescript-eslint/no-unused-expressions)workerfy.ts,CatalogDesignTable.tsx,FlipCard.tsx: Convertfoo && foo()patterns toif (foo) foo()React hooks rules
Hidden.tsx: Remove unnecessaryforwardRefwrapper (MUI Hidden doesn't support refs)ChallengesSection.tsx,LearningSection.tsx: ReplaceuseEffect+setStatewith derived state viauseMemoContentClassInfo.tsx,CatalogCardDesignLogo.tsx: Move component definitions outside render to prevent recreation on each renderDead code
ResponsiveDataTable.test.tsx: Remove staleeslint-disablecomment for nonexistentimport/firstruleExample: setState-in-effect refactor
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.