chore(lint): restore green lint via scoped rules + meaningful JSDoc (…#440
Conversation
…435) * chore(lint): scope eslint rules by file type + residual code fixes Splits eslint.config.js into three file-scoped rule blocks so strict JSDoc requirements apply only where they belong: - all `**/*.ts`: keeps import/first, prettier, member-ordering, and tightens `no-unused-vars` to `argsIgnorePattern: "^_"` (was `"^_$"` which only matched bare `_`) - `app/api/**/*.ts`: retains the full jsdoc ruleset per CLAUDE.md's "all API routes require JSDoc" mandate - test files (`**/*.test.ts`, `**/__tests__/**`): disables `no-explicit-any` and `jsdoc/require-jsdoc` — tests legitimately need loose typing and don't ship as docs Residual code-level fixes the new config surfaces: - `lib/credits/getCreditUsage.ts`: replace `(usage as any)` with a typed Partial record narrowing - `lib/content/templates/types.ts`, `lib/trigger/fetchTriggerRuns.ts`: move `[key: string]: unknown` index signature before named fields (member-ordering) - `lib/artists/createArtistInDb.ts`, `lib/workspaces/createWorkspaceInDb.ts`: drop unused `error` binding from catch - misc test files: remove unused imports/vars, fix import/first ordering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs(api): meaningful JSDoc for 19 route handlers Writes endpoint-specific JSDoc against the strict rules scoped to `app/api/**`. Each handler now documents the HTTP verb + path, the request body/query shape (referencing the `validate*Body` / `validate*Query` schema file where applicable), the success response shape, and the relevant non-200 status codes. No placeholder filler — every description conveys something the signature does not. Files: - accounts/[id], admins/coding/pr, admins/coding/slack, admins/content/slack, admins/privy - chats/[id]/messages/trailing - coding-agent/callback, coding-agent/github - connectors - content (PATCH), content/analyze, content/caption, content/image, content/templates/[id], content/transcribe, content/upscale, content/video - songs/analyze/presets - transcribe Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(credits): use typed LanguageModelUsage fields; restore json() assertion in sandbox test - `getCreditUsage`: drop the hand-rolled Partial-record cast and the v2-compat `promptTokens`/`completionTokens` fallback — `LanguageModelUsage` (= V3Usage) already types `inputTokens` / `outputTokens` directly, and the real runtime caller (`handleChatCredits`) passes this exact type. The compat branch was dead against the typed surface. - `getCreditUsage.test.ts`: update mock usage objects from the legacy `promptTokens`/`completionTokens` shape to the SDK V3 shape the function is actually typed against. - `postSandboxesFilesHandler.test.ts`: restore `result.json()` so the 500-path still asserts the response is valid JSON (not just status code), matching the original test intent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs(api): correct @returns shape for coding-agent github webhook Cubic review feedback: the JSDoc claimed `{ ok: true }` on 200 but the handler returns `{ status: <outcome> }` payloads (`update_triggered`, `ignored`, `busy`, `no_state`, `updating`) and `{ status: "error", error }` on non-200s. Update the doc to match the actual contract. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 49 minutes and 41 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (13)
📒 Files selected for processing (26)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…#435)
Splits eslint.config.js into three file-scoped rule blocks so strict JSDoc requirements apply only where they belong:
**/*.ts: keeps import/first, prettier, member-ordering, and tightensno-unused-varstoargsIgnorePattern: "^_"(was"^_$"which only matched bare_)app/api/**/*.ts: retains the full jsdoc ruleset per CLAUDE.md's "all API routes require JSDoc" mandate**/*.test.ts,**/__tests__/**): disablesno-explicit-anyandjsdoc/require-jsdoc— tests legitimately need loose typing and don't ship as docsResidual code-level fixes the new config surfaces:
lib/credits/getCreditUsage.ts: replace(usage as any)with a typed Partial record narrowinglib/content/templates/types.ts,lib/trigger/fetchTriggerRuns.ts: move[key: string]: unknownindex signature before named fields (member-ordering)lib/artists/createArtistInDb.ts,lib/workspaces/createWorkspaceInDb.ts: drop unusederrorbinding from catchWrites endpoint-specific JSDoc against the strict rules scoped to
app/api/**. Each handler now documents the HTTP verb + path, the request body/query shape (referencing thevalidate*Body/validate*Queryschema file where applicable), the success response shape, and the relevant non-200 status codes. No placeholder filler — every description conveys something the signature does not.Files:
getCreditUsage: drop the hand-rolled Partial-record cast and the v2-compatpromptTokens/completionTokensfallback —LanguageModelUsage(= V3Usage) already typesinputTokens/outputTokensdirectly, and the real runtime caller (handleChatCredits) passes this exact type. The compat branch was dead against the typed surface.getCreditUsage.test.ts: update mock usage objects from the legacypromptTokens/completionTokensshape to the SDK V3 shape the function is actually typed against.postSandboxesFilesHandler.test.ts: restoreresult.json()so the 500-path still asserts the response is valid JSON (not just status code), matching the original test intent.Cubic review feedback: the JSDoc claimed
{ ok: true }on 200 but the handler returns{ status: <outcome> }payloads (update_triggered,ignored,busy,no_state,updating) and{ status: "error", error }on non-200s. Update the doc to match the actual contract.Summary by cubic
Scopes strict JSDoc linting to
app/api/**and adds accurate docs for 19 API handlers, while tightening TypeScript lint rules and cleaning up minor code. Also fixes credit usage calculations and restores a missing JSON assertion in a sandbox test.Refactors
eslint.config.jsinto file-scoped rule sets: default TS,app/api/**(strict JSDoc), and tests (**/*.test.ts,**/__tests__/**) with JSDoc off andno-explicit-anydisabled.@typescript-eslint/no-unused-varsto ignore args/vars starting with_; keptimport/first,prettier, and member-ordering.Bug Fixes
getCreditUsage: useinputTokens/outputTokensfromLanguageModelUsage; updated tests to the v3 shape.result.json()assertion in sandbox file upload error test.{ status }responses and error shapes.Written for commit ec0008b. Summary will update on new commits.