Fix lint/type issues and make anti-patterns optional#389
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
et3 | f0d1693 | Commit Preview URL Branch Preview URL |
Jan 13 2026, 04:46 PM |
Summary of ChangesHello @zz-plant, 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 enhancing the codebase's robustness and maintainability by addressing a range of linting and TypeScript issues. Key changes include optimizing API route handlers, making the 'antiPatterns' content field optional for greater flexibility, and refining test typings for Astro components. These updates collectively ensure a cleaner, more type-safe, and efficient application, resolving previous CI failures and improving developer experience. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses a range of linting and TypeScript issues, enhancing code quality and robustness. Key improvements include removing unnecessary async/await keywords, strengthening type safety in tests and API route handlers, and refactoring the content schema to make antiPatterns optional. The changes are well-executed and align with modern TypeScript best practices. I have one minor suggestion to improve test readability.
| for (const blocker of expectedBlockers) { | ||
| expect(blockers).toContain(blocker); | ||
| } |
There was a problem hiding this comment.
While this loop correctly checks for the presence of all expected blockers, using expect.arrayContaining is more idiomatic and declarative for this kind of assertion in a test. It can make the test more concise and often provides a more helpful diff when it fails.
expect(blockers).toEqual(expect.arrayContaining(expectedBlockers));
Motivation
async/awaitusage and improve test typings to satisfyeslintandtscrules.Description
AstroComponentFactorytype, cast components forrenderToString, and tighten mock behavior for middlewarenextto return aPromise.GETfunctions where noawaitis used to address@typescript-eslint/require-await.antiPatternsto thelibrarycontent types and content schema insrc/content.config.tsand guard uses insrc/pages/mechanisms/patterns/[slug].astroandsrc/utils/api.tsto avoid undefined access.src/layouts/BaseLayout.astroand fix the redirect param usage insrc/pages/library/patterns/[slug].astro.Testing
bun run check, which runs linting, unit tests, typecheck, andastro:check, and it completed successfully.bun test src) passed with all tests green aside from intentionally skipped integration/DOM-heavy tests.bun run typecheck) completed without errors.bun run validate:jsonandbun run validate:glossaryboth succeeded.Codex Task