chore: add Prettier and ESLint flat config, apply formatting#7
chore: add Prettier and ESLint flat config, apply formatting#7samintisar merged 2 commits intomainfrom
Conversation
…odebase Add .prettierrc and eslint.config.ts (flat config) to enforce consistent code style. Apply Prettier formatting to all frontend and backend source files, update agent skills markdown, and add convex routing skill. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces repository-wide formatting and linting standards (Prettier + ESLint flat config), applies automated formatting across frontend/backend code, and updates agent skill documentation and repo contributor guidance to match the new workflow.
Changes:
- Add Prettier config and ESLint flat config (plus
lint/formatscripts and dependencies). - Apply formatting and small refactors across
apps/web/andconvex/(including several error-wrapping improvements viaError(..., { cause })). - Reformat/update agent skills markdown and
CLAUDE.mdwith the new lint/format commands and a newconvexrouting skill.
Reviewed changes
Copilot reviewed 69 out of 70 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| skills-lock.json | Adds new convex skill entry and updates skill hashes. |
| package.json | Adds ESLint/Prettier deps + lint/format scripts. |
| eslint.config.ts | Introduces ESLint flat config with TS + React hooks/refresh + Prettier integration and ignore patterns. |
| .prettierrc | Adds Prettier formatting rules used across the repo. |
| bun.lock | Locks new lint/format toolchain dependencies. |
| CLAUDE.md | Documents lint/format commands and updates Serena workflow guidance. |
| convex/studio/writtenQuestions/writtenQuestionsJobPhases.ts | Removes @ts-ignore comments around structured LLM helpers. |
| convex/studio/slides/slideDeckJobPhases.ts | Removes @ts-ignore comments; improves thrown errors by attaching cause. |
| convex/studio/reports/reportJobPhases.ts | Removes @ts-ignore; adjusts return typing for structured output helper. |
| convex/studio/quizzes/quizJobPhases.ts | Removes @ts-ignore comments around structured LLM helpers. |
| convex/studio/mindmaps/mindmapJobPhases.ts | Removes @ts-ignore comment around structured LLM helper. |
| convex/http.ts | Minor refactor (let → const) for Response construction. |
| convex/documents/embeddingJob.ts | Changes null-byte sanitization implementation. |
| convex/billing/actions.ts | Adds { cause } to errors for better debugging context. |
| convex/_services/processing/StructuralChunker.ts | Regex formatting tweak (no behavior change intended). |
| convex/_services/processing/DocumentMetadataExtractor.ts | Regex formatting tweak (no behavior change intended). |
| convex/_services/extraction/SupadataLoaderService.ts | Adds { cause } on rethrown errors; regex formatting tweak. |
| convex/_services/extraction/MistralOCRService.ts | Adds { cause } on errors for better debugging context. |
| convex/_services/extraction/AudioTranscriptionService.ts | Adds { cause } on errors for better debugging context. |
| convex/_services/ai/titleGenerator.ts | Minor refactor (let → const) and adds { cause } on error. |
| convex/_generated/ai/guidelines.md | Re-formats generated Convex AI guidelines content. |
| convex/_generated/ai/ai-files.state.json | Updates hashes/installed skill names for generated AI files state. |
| convex/_agents/written_questions/structuredLlm.ts | Removes @ts-ignore; keeps as any return cast. |
| convex/_agents/written_questions/postprocess.ts | Cleans up escaping in prompt string. |
| convex/_agents/written_questions/nodeMap.ts | Changes counter variable typing/init style. |
| convex/_agents/slides/structuredLlm.ts | Removes @ts-ignore; keeps as any return cast. |
| convex/_agents/slides/services/SlideImageGenerationService.ts | Adds { cause } on errors for better debugging context. |
| convex/_agents/slides/nodeReduce.ts | Adds { cause } on errors for better debugging context. |
| convex/_agents/slides/nodeMap.ts | Changes counter variable typing/init style. |
| convex/_agents/slides/nodeCollapse.ts | Changes counter variable typing/init style. |
| convex/_agents/report/structuredLlm.ts | Removes @ts-ignore; keeps as any return cast. |
| convex/_agents/quiz/structuredLlm.ts | Removes @ts-ignore; keeps as any return cast. |
| convex/_agents/quiz/nodeMap.ts | Changes counter variable typing/init style. |
| convex/_agents/quiz/nodeCollapse.ts | Changes counter variable typing/init style. |
| convex/_agents/mindmap/nodeMap.ts | Adds { cause } to error for improved debugging context. |
| convex/_agents/flashcard/structuredLlm.ts | Removes @ts-ignore; keeps as any return cast. |
| convex/_agents/chat/vector_search.ts | Minor refactor (let → const). |
| convex/_agents/chat/hybrid_search.ts | Removes redundant try/catch rethrow block. |
| convex/_agents/_shared/validation.ts | Regex formatting tweaks (no behavior change intended). |
| convex/_agents/_shared/state_factory.ts | Improves generic default type (Record<string, never>). |
| convex/_agents/_shared/sanitization.ts | Regex formatting tweaks; adds eslint disable for control-regex. |
| convex/_agents/ChatAgent.ts | Refactors grounding validation local variables and formatting. |
| archive/push-convex-env.js | Adds ESLint env directive to archived script. |
| apps/web/src/shared/utils/sanitizeMarkdown.ts | Adds eslint disable for control-regex. |
| apps/web/src/features/studio/services/reportsApi.ts | Initializes preview via explicit branching (typed). |
| apps/web/src/features/studio/services/notesApi.ts | Adds block scope for case 'mindmap' to satisfy linting. |
| apps/web/src/features/studio/services/mindMapApi.ts | Initializes preview via explicit branching (typed). |
| apps/web/src/features/sources/components/PdfViewer.tsx | Adds explanatory comment for module-level constant. |
| apps/web/src/features/notebooks/hooks/useFolderHandlers.ts | Renames unused props param to _props to satisfy linting. |
| apps/web/src/features/notebooks/components/cards/NotebookCard.tsx | Replaces ternary with explicit if/else in click handler. |
| apps/web/src/features/notebooks/components/cards/FolderCard.tsx | Re-formats click handler for readability/linting. |
| apps/web/src/features/notebooks/components/HomePage.tsx | Makes unused props explicit (_props) and moves comment. |
| apps/web/src/features/chat/utils/messageRendering.tsx | Regex formatting tweak (no behavior change intended). |
| apps/web/src/features/chat/services/chatApi.ts | Minor refactors (let → const, init style) within send-message flow. |
| apps/web/src/features/chat/components/ChatPanel.tsx | Regex formatting tweak (no behavior change intended). |
| apps/web/src/features/billing/services/subscriptionApi.ts | Refactors conditional start time variable (let → const). |
| apps/web/src/features/auth/components/AuthFormPanel.tsx | Expands single-line if for linting/style consistency. |
| apps/web/src/features/audio/components/MiniAudioPlayer.tsx | Moves error handler into effect; adds exhaustive-deps suppression. |
| apps/web/src/features/audio/components/AudioPlayer.tsx | Adds exhaustive-deps suppression in effect. |
| .agents/skills/convex/SKILL.md | Adds new Convex routing skill documentation. |
| .agents/skills/convex-setup-auth/SKILL.md | Formatting tweak in code sample (comma placement). |
| .agents/skills/convex-quickstart/SKILL.md | Formatting tweaks (tables/code blocks). |
| .agents/skills/convex-performance-audit/references/occ-conflicts.md | Content/format updates to recommendations and examples. |
| .agents/skills/convex-performance-audit/references/hot-path-rules.md | Content/format updates to recommendations and examples. |
| .agents/skills/convex-performance-audit/references/function-budget.md | Re-formats limits table. |
| .agents/skills/convex-performance-audit/SKILL.md | Re-formats signal/reference table + updates checklist wording. |
| .agents/skills/convex-migration-helper/references/migrations-component.md | Formatting tweak to code sample. |
| .agents/skills/convex-migration-helper/references/migration-patterns.md | Formatting tweak to code sample. |
| .agents/skills/convex-migration-helper/SKILL.md | Formatting tweaks to code samples (semicolons, chaining). |
| .agents/skills/convex-create-component/SKILL.md | Formatting tweaks to tables/code samples (but introduces invalid syntax in examples). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /* eslint-env node */ | ||
| #!/usr/bin/env node |
There was a problem hiding this comment.
The /* eslint-env node */ comment is placed before the shebang. If this script is ever executed directly (e.g. ./push-convex-env.js), the OS will no longer recognize the shebang and it won’t run under Node. Keep the shebang as the very first line (move the ESLint directive below it, or configure ESLint via overrides).
| /* eslint-env node */ | |
| #!/usr/bin/env node | |
| #!/usr/bin/env node | |
| /* eslint-env node */ |
| - Here are the valid Convex types along with their respective validators: | ||
| Convex Type | TS/JS type | Example Usage | Validator for argument validation and schemas | Notes | | ||
| | ----------- | ------------| -----------------------| -----------------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | Id | string | `doc._id` | `v.id(tableName)` | | | ||
| | Null | null | `null` | `v.null()` | JavaScript's `undefined` is not a valid Convex value. Functions the return `undefined` or do not return will return `null` when called from a client. Use `null` instead. | | ||
| | Int64 | bigint | `3n` | `v.int64()` | Int64s only support BigInts between -2^63 and 2^63-1. Convex supports `bigint`s in most modern browsers. | | ||
| | Float64 | number | `3.1` | `v.number()` | Convex supports all IEEE-754 double-precision floating point numbers (such as NaNs). Inf and NaN are JSON serialized as strings. | | ||
| | Boolean | boolean | `true` | `v.boolean()` | | ||
| | String | string | `"abc"` | `v.string()` | Strings are stored as UTF-8 and must be valid Unicode sequences. Strings must be smaller than the 1MB total size limit when encoded as UTF-8. | | ||
| | Bytes | ArrayBuffer | `new ArrayBuffer(8)` | `v.bytes()` | Convex supports first class bytestrings, passed in as `ArrayBuffer`s. Bytestrings must be smaller than the 1MB total size limit for Convex types. | | ||
| | Array | Array | `[1, 3.2, "abc"]` | `v.array(values)` | Arrays can have at most 8192 values. | | ||
| | Object | Object | `{a: "abc"}` | `v.object({property: value})` | Convex only supports "plain old JavaScript objects" (objects that do not have a custom prototype). Objects can have at most 1024 entries. Field names must be nonempty and not start with "$" or "_". | | ||
| | Record | Record | `{"a": "1", "b": "2"}` | `v.record(keys, values)` | Records are objects at runtime, but can have dynamic keys. Keys must be only ASCII characters, nonempty, and not start with "$" or "_". | | ||
| Convex Type | TS/JS type | Example Usage | Validator for argument validation and schemas | Notes | | ||
| | ----------- | ------------| -----------------------| -----------------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | Id | string | `doc._id` | `v.id(tableName)` | | | ||
| | Null | null | `null` | `v.null()` | JavaScript's `undefined` is not a valid Convex value. Functions the return `undefined` or do not return will return `null` when called from a client. Use `null` instead. | | ||
| | Int64 | bigint | `3n` | `v.int64()` | Int64s only support BigInts between -2^63 and 2^63-1. Convex supports `bigint`s in most modern browsers. | | ||
| | Float64 | number | `3.1` | `v.number()` | Convex supports all IEEE-754 double-precision floating point numbers (such as NaNs). Inf and NaN are JSON serialized as strings. | | ||
| | Boolean | boolean | `true` | `v.boolean()` | | ||
| | String | string | `"abc"` | `v.string()` | Strings are stored as UTF-8 and must be valid Unicode sequences. Strings must be smaller than the 1MB total size limit when encoded as UTF-8. | | ||
| | Bytes | ArrayBuffer | `new ArrayBuffer(8)` | `v.bytes()` | Convex supports first class bytestrings, passed in as `ArrayBuffer`s. Bytestrings must be smaller than the 1MB total size limit for Convex types. | | ||
| | Array | Array | `[1, 3.2, "abc"]` | `v.array(values)` | Arrays can have at most 8192 values. | | ||
| | Object | Object | `{a: "abc"}` | `v.object({property: value})` | Convex only supports "plain old JavaScript objects" (objects that do not have a custom prototype). Objects can have at most 1024 entries. Field names must be nonempty and not start with "$" or "_". | | ||
| | Record | Record | `{"a": "1", "b": "2"}` | `v.record(keys, values)` | Records are objects at runtime, but can have dynamic keys. Keys must be only ASCII characters, nonempty, and not start with "$" or "\_". | |
There was a problem hiding this comment.
The Markdown table under “valid Convex types” is malformed (the header row is missing a leading |, separator alignment is inconsistent, and the last row formatting differs). This won’t render as a table and may break downstream consumers of these generated guidelines. Reformat the table so every row starts/ends with | and has consistent column separators.
| const originalLength = extractedText.length; | ||
| extractedText = extractedText.replace(/\u0000/g, ''); | ||
| extractedText = extractedText.split("\u0000").join(""); | ||
| if (originalLength !== extractedText.length) { |
There was a problem hiding this comment.
Null-byte sanitization was changed from a regex replace(/\u0000/g, "") to split("\u0000").join(""). For large extracted documents this can be significantly more memory-intensive (creates an array of substrings) and slower than a simple replace. Prefer the original replace approach here.
| ```ts | ||
| // Bad: parent app table IDs are not valid component validators | ||
| args: { userId: v.id("users") } | ||
| args: { | ||
| userId: v.id("users"); | ||
| } | ||
| ``` | ||
|
|
||
| ```ts | ||
| // Good: treat parent-owned IDs as strings at the boundary | ||
| args: { userId: v.string() } | ||
| args: { | ||
| userId: v.string(); | ||
| } | ||
| ``` |
There was a problem hiding this comment.
The code examples in this section use semicolons inside object literals (e.g. userId: v.id("users");), which is invalid TypeScript/JavaScript syntax and could mislead readers. Use commas between properties and only end the full statement/object with a semicolon if needed.
| "@eslint/js": "^10.0.1", | ||
| "@types/bun": "^1.3.11", | ||
| "@types/node": "^25.5.2", | ||
| "@typescript/native-preview": "^7.0.0-dev.20260409.1", | ||
| "convex": "^1.34.1", | ||
| "typescript": "^5.9.3" | ||
| "eslint": "9", | ||
| "eslint-config-prettier": "^10.1.8", | ||
| "eslint-plugin-react-hooks": "^7.1.0", | ||
| "eslint-plugin-react-refresh": "^0.5.2", | ||
| "prettier": "^3.8.3", | ||
| "typescript": "^5.9.3", | ||
| "typescript-eslint": "^8.58.2" |
There was a problem hiding this comment.
@eslint/js is pinned to ^10.0.1 but eslint is pinned to 9. @eslint/js@10.x declares a peer dependency on ESLint ^10, so this combination can cause install warnings and potentially incompatible rule/config behavior. Align the versions (either upgrade ESLint to 10.x, or downgrade @eslint/js to a 9.x release that matches ESLint 9).
…matting Add .prettierignore to exclude convex/_generated from Prettier checks. Fix shebang line ordering in archive/push-convex-env.js. Apply Prettier formatting to remaining files that were missed in the initial pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
.prettierrcandeslint.config.ts(ESLint flat config) to establish consistent code style rulesapps/web/) and backend (convex/) source filesconvexrouting skill and updateCLAUDE.mdwith linting/formatting commandsTest plan
bun run format:checkpasses with no changes neededbun run lintpassesbun run typecheck:web,bun run typecheck:convex)🤖 Generated with Claude Code