Skip to content

hook: add TS comment reviewer and React named-hooks handler - #5

Open
Brookke wants to merge 1 commit into
laurenkt:masterfrom
Brookke:brooke-ts-comments-and-react-hooks
Open

Brookke wants to merge 1 commit into
laurenkt:masterfrom
Brookke:brooke-ts-comments-and-react-hooks

Conversation

@Brookke

@Brookke Brookke commented Jul 17, 2026

Copy link
Copy Markdown

What

Extends the hook handlers to cover TypeScript/TSX projects, not just Go.

  • asyncReview → fileSuffixes []string: generalises the single fileSuffix field so a reviewer can gate on multiple extensions (e.g. .ts + .tsx). Only valuable-comments used the old field. Also renames containsGoComment → containsLineComment (it was already language-agnostic).
  • valuable-comments-ts (async): the comment reviewer for .ts/.tsx. Same rubric structure and principles as the Go reviewer, with the idioms swapped to TS — types/zod/react-hook-form instead of proto/struct-tag validators, JSDoc, .map(), section dividers, etc.
  • react-named-hooks (deterministic, advisory): flags React.useXxx( calls and suggests importing the hook by name (import { useState } from 'react'). Matches all hooks; skips non-hook members like React.FC/React.ReactNode and type positions.

Wiring

These are registered handlers; enable them in settings.json PostToolUse (Write|Edit) — add react-named-hooks to the deterministic command and valuable-comments-ts alongside valuable-comments in the async (asyncRewake) command.

Testing

go test ./... and go vet ./... pass, including new tests for the multi-suffix matching, the TS registration/rubric, and the React-hook detector (positive cases, named-call/non-hook/non-JS/non-Write-Edit negatives, and Edit-scans-NewString-only).

🤖 Generated with Claude Code

- Generalise asyncReview to fileSuffixes []string (drop single fileSuffix
  shorthand) so a reviewer can gate on multiple extensions.
- Add valuable-comments-ts: the async comment reviewer for .ts/.tsx, with a
  TypeScript-tailored rubric (types/zod/react-hook-form/JSDoc idioms).
- Add react-named-hooks: deterministic advisory flagging React.useXxx() calls
  and suggesting named hook imports.
- Rename containsGoComment -> containsLineComment (language-agnostic).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
)

func init() {
Register("react-named-hooks", handleReactNamedHooks)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

tbh wondering if this should really be an eslint rule...

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