Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @mlanlazc, 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!
I've implemented several optimizations to the pre-commit hook to enhance developer experience and efficiency. The primary goal is to make the pre-commit checks faster and more focused by leveraging lint-staged to process only staged files, alongside improvements to the TypeScript type-checking process. Additionally, I've adjusted an environment variable related to storage types.
Highlights
- Optimized Pre-Commit Hook: Switched from checking the entire codebase to only staged files using lint-staged, drastically speeding up commit checks.
- Automated Code Formatting & Linting: The pre-commit hook now automatically fixes autofixable ESLint and Prettier issues, reducing manual intervention.
- Faster TypeScript Type Checking: The typecheck command has been optimized with --noEmit and --skipLibCheck flags, accelerating the type-checking process during development.
- Environment Variable Adjustment: The STORAGE_TYPE environment variable in app/env/server.ts has been restricted to only FILE_SYSTEM, removing the DATABASE option.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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 or fill out our survey to provide feedback.
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
-
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. ↩
c414a9e to
a6dde6a
Compare
There was a problem hiding this comment.
Code Review
This pull request significantly improves the pre-commit hook by introducing lint-staged to lint and format only staged files, and by optimizing the typecheck command. This will speed up the commit process for developers. I have one suggestion to further enhance the performance of the pre-commit hook by making the type check conditional.
.husky/pre-commit
Outdated
| # Run typecheck (still needed for full project context) | ||
| echo "Running TypeScript typecheck..." | ||
| if ! pnpm typecheck; then | ||
| echo "❌ TypeScript type checking failed! Please review type errors." | ||
| echo "Once you're done, don't forget to add your changes to the commit! 🚀" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
While the optimizations to the typecheck command are great, the pre-commit hook still runs pnpm typecheck on every commit, regardless of which files were changed. This can be inefficient, for example when only documentation files are being committed.
To further optimize the hook, you could make the typecheck step conditional, so it only runs when TypeScript files (.ts or .tsx) are part of the staged changes.
# Run typecheck only if there are staged TypeScript files
if git diff --cached --name-only --diff-filter=ACM | grep -q -E '\.(ts|tsx)$'; then
echo "Running TypeScript typecheck..."
if ! pnpm typecheck; then
echo "❌ TypeScript type checking failed! Please review type errors."
echo "Once you're done, don't forget to add your changes to the commit! 🚀"
exit 1
fi
fi
There was a problem hiding this comment.
Tested, it works, bravo Gemini 👏
lint-stagedto check only staged file instead of the whole codebasetypecheckcommand:--noEmit:Skips generating JavaScript output files, only does type checking--skipLibCheck:Skips type checking of library declaration files (.d.ts files), which can be a significant time saver