Skip to content

Fix lint/type issues and make anti-patterns optional#389

Merged
zz-plant merged 1 commit into
mainfrom
codex/fix-all-lint-errors-z2r0n4
Jan 13, 2026
Merged

Fix lint/type issues and make anti-patterns optional#389
zz-plant merged 1 commit into
mainfrom
codex/fix-all-lint-errors-z2r0n4

Conversation

@zz-plant

Copy link
Copy Markdown
Owner

Motivation

  • Fix lint and TypeScript errors that were failing the repository checks and CI tasks.
  • Remove unnecessary async/await usage and improve test typings to satisfy eslint and tsc rules.
  • Align content schema and page logic to support optional mechanism anti-patterns without runtime errors.
  • Make small correctness fixes to route handlers and structured-data typing to eliminate type warnings.

Description

  • Update Astro container tests to derive an AstroComponentFactory type, cast components for renderToString, and tighten mock behavior for middleware next to return a Promise.
  • Convert JSON API route handlers to synchronous GET functions where no await is used to address @typescript-eslint/require-await.
  • Add optional antiPatterns to the library content types and content schema in src/content.config.ts and guard uses in src/pages/mechanisms/patterns/[slug].astro and src/utils/api.ts to avoid undefined access.
  • Relax structured data typing in src/layouts/BaseLayout.astro and fix the redirect param usage in src/pages/library/patterns/[slug].astro.

Testing

  • Ran the full check via bun run check, which runs linting, unit tests, typecheck, and astro:check, and it completed successfully.
  • Unit tests (bun test src) passed with all tests green aside from intentionally skipped integration/DOM-heavy tests.
  • Type checking (bun run typecheck) completed without errors.
  • Content validators bun run validate:json and bun run validate:glossary both succeeded.

Codex Task

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 13, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Linting and TypeScript Fixes: Resolved various linting and TypeScript errors that were causing CI failures, improving overall code quality and adherence to standards.
  • API Route Handler Optimization: Converted JSON API route handlers to synchronous GET functions by removing unnecessary async/await keywords, addressing @typescript-eslint/require-await warnings.
  • Optional Anti-Patterns in Content Schema: Introduced an optional antiPatterns field to the library content types and schema, allowing for more flexible content definition without runtime errors.
  • Improved Astro Component Test Typings: Updated Astro container tests to derive an AstroComponentFactory type and cast components for renderToString, enhancing type safety in tests.
  • Refined Structured Data and Redirect Handling: Relaxed structured data typing in BaseLayout.astro and corrected redirect parameter usage in src/pages/library/patterns/[slug].astro.
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.

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

Copy link
Copy Markdown
Contributor

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 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.

Comment on lines +54 to +56
for (const blocker of expectedBlockers) {
expect(blockers).toContain(blocker);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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));

@zz-plant zz-plant merged commit cec9ad0 into main Jan 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant