Skip to content

Configure ESLint no-unused-vars rule and clean up unused code #2613

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

Closed
wants to merge 2 commits into from

Conversation

FunamaYukina
Copy link
Member

@FunamaYukina FunamaYukina commented Jul 18, 2025

Why is this change needed?

The codebase had accumulated unused variables, imports, and functions that were not being detected by our existing tooling. While we use knip for detecting unused exports, it doesn't catch unused variables and imports within files. This change addresses that gap by:

  • Configuring ESLint to detect unused variables and imports across the codebase
  • Cleaning up existing unused code that knip couldn't detect
  • Adding pattern matching for type inference schemas (valibot/zod patterns)
  • Improving overall code quality and reducing bundle size

Changes

ESLint Configuration

  • Added @typescript-eslint/no-unused-vars rule to base ESLint configuration
  • Configured ignore patterns for underscore-prefixed variables
  • Added Schema$ pattern to support valibot/zod type inference variables

Code Cleanup

  • Removed unused variable agentType in Chat.tsx
  • Removed unused imports: TimelineItemEntry, v, TablesInsert, ErrorInfo
  • Cleaned up timelineUtils.ts by removing 400+ lines of unused functions and constants
  • Added appropriate ESLint disable comments for counter variables

Benefits

  • Improved code quality by removing dead code
  • Better detection of unused variables during development
  • Reduced bundle size by removing unused imports and functions
  • Consistent handling of type inference patterns
  • Fills the gap that knip doesn't cover for intra-file unused code

Test plan

  • All lint checks pass
  • Type checking passes
  • No functionality changes - only removed unused code

🤖 Generated with Claude Code

FunamaYukina and others added 2 commits July 18, 2025 18:23
- Add @typescript-eslint/no-unused-vars rule to base ESLint config
- Allow variables ending with 'Schema' for type inference patterns
- Configure ignore patterns for underscore-prefixed variables
- Support valibot and other type inference libraries

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove unused variable 'agentType' in Chat.tsx
- Remove unused imports: TimelineItemEntry, v, TablesInsert, ErrorInfo
- Clean up timelineUtils.ts by removing unused functions and constants
- Add eslint-disable comment for counter variables in schema-bench
- All changes based on ESLint no-unused-vars rule detection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

changeset-bot bot commented Jul 18, 2025

⚠️ No Changeset found

Latest commit: 17505e5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jul 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
liam-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2025 9:31am
liam-erd-sample ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2025 9:31am
liam-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2025 9:31am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
liam-docs ⬜️ Ignored (Inspect) Visit Preview Jul 18, 2025 9:31am

Copy link

supabase bot commented Jul 18, 2025

Updates to Preview Branch (fix/eslint-unused-vars-detection) ↗︎

Deployments Status Updated
Database Fri, 18 Jul 2025 09:27:23 UTC
Services Fri, 18 Jul 2025 09:27:23 UTC
APIs Fri, 18 Jul 2025 09:27:23 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Fri, 18 Jul 2025 09:27:28 UTC
Migrations Fri, 18 Jul 2025 09:27:30 UTC
Seeding Fri, 18 Jul 2025 09:27:33 UTC
Edge Functions Fri, 18 Jul 2025 09:27:33 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@FunamaYukina FunamaYukina changed the title Configure ESLint no-unused-vars rule and clean up unused code Configure ESLint no-unused-vars rule and clean up unused code Jul 18, 2025
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.

1 participant