Skip to content

Conversation

@bniladridas
Copy link
Member

Re-applying the linting and cleanup changes from commit 662e69e.

- Add ESLint configuration with TypeScript support
- Remove unused variables, imports, and parameters
- Fix TypeScript any types and improve type safety
- Update preflight script to include linting
- Fix test script to run in CI mode
- Improve code quality and maintainability
@vercel
Copy link

vercel bot commented Nov 21, 2025

@bniladridas is attempting to deploy a commit to the harpertoken Team on Vercel.

A member of the Team first needs to authorize it.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @bniladridas, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a comprehensive codebase cleanup, re-applying previous linting and formatting changes to enhance code quality and maintainability. Key updates include the migration to a new, modern ESLint configuration with robust TypeScript support, refactoring of components to eliminate unused code, and improvements to type safety. Additionally, configuration files have been modernized, and dependency declarations have been streamlined.

Highlights

  • New ESLint Configuration: A new flat ESLint configuration file (eslint.config.js) has been introduced, setting up modern linting rules with TypeScript support, including checks for unused variables and explicit 'any' types across the codebase.
  • Code Refactoring and Unused Code Removal: The BottomBar component and the Editor page have been refactored to remove unused charCount and aiStatus properties and state variables, along with their corresponding usage in example components, simplifying the codebase.
  • TypeScript Type Enhancements: Type safety has been improved in TextEditor.tsx by refining the timeoutRef type and explicitly casting setTimeout return values. Similarly, capturedJsonResponse in index.ts now uses Record<string, unknown> for better type inference.
  • Configuration Modernization: The tailwind.config.ts file has been updated to use ES module imports for Tailwind CSS plugins, replacing older require() syntax for a more modern approach.
  • Dependency Management Updates: The package.json and package-lock.json files reflect significant updates, including the addition of new ESLint and TypeScript ESLint related packages, and the removal of express-rate-limit from production dependencies.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@vercel
Copy link

vercel bot commented Nov 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
autofix Ready Ready Preview Comment Nov 21, 2025 1:59pm

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a number of cleanup and linting changes across the codebase. The introduction of ESLint is a great step towards maintaining code quality. I've found a few issues, including a critical bug in the server's error handling middleware that needs to be addressed. There are also some smaller improvements that can be made to enhance type safety and fix some misplaced comments. Overall, good progress on cleaning up the codebase.

Comment on lines 50 to 55
configuredApp.use((err: any, _req: Request, res: Response) => {
const status = err.status || err.statusCode || 500;
const message = err.message || 'Internal Server Error';

res.status(status).json({ message });
}
);
res.status(status).json({ message });
});
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

This error handling middleware has an incorrect signature. In Express, an error handling middleware must have four arguments: (err, req, res, next). By removing the next parameter, this function will be treated as a regular middleware and will not be called by Express to handle errors. This will cause errors to be unhandled.

To fix this, you must add the next parameter back, even if it's unused. You will also need to re-import NextFunction from express.

Suggested change
configuredApp.use((err: any, _req: Request, res: Response) => {
const status = err.status || err.statusCode || 500;
const message = err.message || 'Internal Server Error';
res.status(status).json({ message });
}
);
res.status(status).json({ message });
});
configuredApp.use((err: any, _req: Request, res: Response, _next: NextFunction) => {
const status = err.status || err.statusCode || 500;
const message = err.message || 'Internal Server Error';
res.status(status).json({ message });
});


console.log('Generated Gemini suggestion:', suggestion);
return suggestion.startsWith(' ') ? suggestion : ' ' + suggestion;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This eslint-disable-next-line comment is on an unreachable line because it follows a return statement on line 73, so it has no effect. It should be moved to the line immediately preceding the catch statement (line 75) to correctly disable the lint rule for error: any.


console.log('Generated Gemini suggestion:', suggestion);
return suggestion.startsWith(' ') ? suggestion : ' ' + suggestion;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This eslint-disable-next-line comment is on an unreachable line because it follows a return statement on line 107, so it has no effect. It should be moved to the line immediately preceding the catch statement (line 109) to correctly disable the lint rule for error: any.

Comment on lines 80 to +83
timeoutRef.current = setTimeout(() => {
generateSuggestion(newText);
}, 500);
}, 500) as unknown as number;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The type cast as unknown as number is used here to align the return type of setTimeout with the timeoutRef. While this works, it's a bit of a code smell and can be avoided. Using window.setTimeout explicitly tells TypeScript to use the browser's implementation, which correctly returns a number, removing the need for a cast and making the code cleaner and more type-safe.

Suggested change
timeoutRef.current = setTimeout(() => {
generateSuggestion(newText);
}, 500);
}, 500) as unknown as number;
timeoutRef.current = window.setTimeout(() => {
generateSuggestion(newText);
}, 500);

Comment on lines 12 to -20
action?: ToastActionElement;
};

const actionTypes = {
ADD_TOAST: 'ADD_TOAST',
UPDATE_TOAST: 'UPDATE_TOAST',
DISMISS_TOAST: 'DISMISS_TOAST',
REMOVE_TOAST: 'REMOVE_TOAST',
} as const;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The actionTypes constant object has been removed. While this might seem like a cleanup, using a constant object for action types is a common and recommended pattern in Redux-style state management. It helps prevent typos by providing a single source of truth for action type strings and allows for autocompletion in IDEs. Reverting to magic strings (e.g., "ADD_TOAST") directly in the code can make it more error-prone and harder to maintain. Consider restoring the actionTypes constant object.

@bniladridas bniladridas changed the title Cherry-pick codebase cleanup chore: cherry-pick codebase cleanup Nov 21, 2025
@vercel
Copy link

vercel bot commented Nov 21, 2025

Deployment failed with the following error:

Resource is limited - try again in 21 minutes (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/harpertoken?upgradeToPro=build-rate-limit

@vercel
Copy link

vercel bot commented Nov 21, 2025

Deployment failed with the following error:

Resource is limited - try again in 18 minutes (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/harpertoken?upgradeToPro=build-rate-limit

@bniladridas bniladridas merged commit 2a7f853 into harpertoken:main Nov 21, 2025
6 of 7 checks passed
@bniladridas bniladridas deleted the cherry-pick-cleanup branch November 21, 2025 14:19
@github-actions
Copy link

🎉 This PR is included in version 1.4.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

1 participant