eslint and prettier workflows#5
Conversation
|
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 0 minutes and 45 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. 📝 WalkthroughWalkthroughAdds developer tooling and linting: pins Node v24, adds a GitHub Actions "Format Check" workflow using pnpm to run ESLint and Prettier, updates ESLint config and npm scripts, refines ignore lists, tweaks a stack-trace regex, and narrows two Builder method types to typed ExpressionBuilder callbacks. Changes
Sequence Diagram(s)sequenceDiagram
participant GH as GitHub Actions
participant Repo as Repository
participant Node as Node (from .nvmrc)
participant PNPM as pnpm
participant ESLint as ESLint
participant Prettier as Prettier
GH->>Repo: on push / pull_request (main)
GH->>Repo: checkout
GH->>Node: resolve/install Node v24
GH->>PNPM: setup pnpm
GH->>PNPM: pnpm install --frozen-lockfile
GH->>ESLint: pnpm lint
GH->>Prettier: pnpm prettier:check (if: always())
ESLint-->>GH: lint results
Prettier-->>GH: prettier results
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.github/workflows/format-check.yml (1)
9-13: Add explicit read-only workflow permissions for security hardening.This workflow only reads repository contents (via
actions/checkout). Setpermissions: contents: readat the job level to enforce least-privilege access.🔒 Suggested change
jobs: format-check: + permissions: + contents: read name: ESLint & Prettier🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/format-check.yml around lines 9 - 13, The workflow job "format-check" lacks explicit read-only permissions; add a permissions block at the job level for format-check with "contents: read" to enforce least-privilege (i.e., insert permissions: contents: read under the jobs -> format-check definition in the .github/workflows/format-check.yml so the job that runs ESLint & Prettier only has read access).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@AGENTS.md`:
- Line 8: Update the sentence that currently reads "The goal is to create a
great developer experience with strong typing and intellisense." to capitalize
the product name by replacing "intellisense" with "IntelliSense" so it reads
"...strong typing and IntelliSense."; locate this text (the sentence string) in
AGENTS.md and make the single-word capitalization change.
In `@package.json`:
- Line 57: The package.json currently uses "@types/node": "^25.6.0" which
mismatches the pinned Node runtime v24 in .nvmrc; update the "@types/node"
dependency entry to a v24 major release (for example "^24.0.0" or a specific
24.x patch such as "24.x" or "24.20.0") so types align with the runtime, then
reinstall dependencies (npm/yarn install) to update the lockfile; target the
"@types/node" entry in package.json to make this change.
In `@src/util/caller.ts`:
- Line 10: Add direct unit tests for the stack-format parser in
src/util/caller.ts by exercising the code path that performs callerLine.match
(the const match = callerLine.match(/at (?:(?:[\w<>_]+\.)?get
|(?:[\w<>_]+\.)?)([\w_]+) [[(]/);) and asserting it extracts method names for
inputs like "at ClassName.methodName (file)", "at get methodName [as alias]
(file)", and that it returns undefined (no match) for non-matching stack lines;
place tests targeting the function or module that uses callerLine.match so
future regex changes are validated.
---
Nitpick comments:
In @.github/workflows/format-check.yml:
- Around line 9-13: The workflow job "format-check" lacks explicit read-only
permissions; add a permissions block at the job level for format-check with
"contents: read" to enforce least-privilege (i.e., insert permissions: contents:
read under the jobs -> format-check definition in the
.github/workflows/format-check.yml so the job that runs ESLint & Prettier only
has read access).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 89d595e4-b816-4656-bbfd-6abb815ee6a4
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (8)
.github/workflows/format-check.yml.gitignore.nvmrc.prettierignoreAGENTS.mdeslint.config.mjspackage.jsonsrc/util/caller.ts
| const asMatch = callerLine.match(/ \[as ([\w_]+)\]/); | ||
| if (asMatch) return asMatch[1]; | ||
| const match = callerLine.match(/at (?:(?:[\w<>_]+\.)?get |(?:[\w<>_]+\.)?)([\w_]+) [\[(]/); | ||
| const match = callerLine.match(/at (?:(?:[\w<>_]+\.)?get |(?:[\w<>_]+\.)?)([\w_]+) [[(]/); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find all call sites that depend on getCallerMethodName output.
rg -nP --type=ts -C3 '\bgetCallerMethodName\s*\('
# Check whether parser behavior is covered by tests.
rg -nP --type=ts -C3 'getCallerMethodName|callerLine\.match|new Error\(\)\.stack' src test
# Expected verification result:
# - tests asserting parsing for representative stack lines, including:
# 1) "at Class.method (file:line:col)"
# 2) "at get method [as alias] (file:line:col)"
# 3) fallback to undefined when no pattern matchesRepository: Smef/vasta
Length of output: 4829
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find test files related to caller.ts
fd -t f '\.test\.|\.spec\.' | grep -i caller
# Check if there are tests in a test directory
find . -type d -name test -o -name tests -o -name __tests__ | head -20
# Search for test files that import or reference getCallerMethodName
rg -l 'getCallerMethodName' --type=ts
# Search for any stack-related tests
rg -l 'stack|caller' --type=ts test/ 2>/dev/null | head -20Repository: Smef/vasta
Length of output: 36
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# List files in repository to understand structure
git ls-files | head -30
# Search for test files more broadly
git ls-files | grep -iE '\.(test|spec)\.(ts|tsx|js|jsx)$|test/|__tests__/'
# Search for any mention of caller in test context
rg 'caller|getCallerMethodName' --type=ts -l | head -20Repository: Smef/vasta
Length of output: 1724
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Search in test files for any reference to getCallerMethodName or stack parsing
rg 'getCallerMethodName|callerLine|stack|caller' test/tests/ --type=ts -n
# Also check if tests use relation methods that depend on getCallerMethodName
rg 'hasOne|hasMany|belongsTo' test/tests/ --type=ts -n | head -20Repository: Smef/vasta
Length of output: 36
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Show the diff for src/util/caller.ts
git diff HEAD^ HEAD -- src/util/caller.ts || git diff -- src/util/caller.ts || echo "No diff available"
# Also check git log for this file
git log --oneline -10 -- src/util/caller.tsRepository: Smef/vasta
Length of output: 126
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Read the full caller.ts file
cat -n src/util/caller.ts
# Also search for any test that uses hasOne, hasMany, or belongsTo to see if relations work
rg 'hasOne|hasMany|belongsTo' test/ --type=ts -B2 -A5Repository: Smef/vasta
Length of output: 3970
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check if there are any recent commits or changes to understand context
git log --oneline | head -20
# Check the PR or branch name if available
git branch -a
# Look for any test that explicitly validates the regex or stack format
rg 'getCallerMethodName|stack.*format|Error.*stack' test/tests/ -n -A3Repository: Smef/vasta
Length of output: 179
Add direct unit tests for stack format parsing before merging.
The regex on Line 10 parses caller method names used for relation cache keys in src/model/Model.ts. While integration tests cover relation functionality (eager/lazy loading), no direct unit tests validate this parser's behavior for representative stack formats. Add tests asserting the regex correctly handles:
"at ClassName.methodName (file)""at get methodName [as alias] (file)"- Fallback to
undefinedwhen patterns don't match
This ensures the regex change doesn't inadvertently break cache key derivation.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/util/caller.ts` at line 10, Add direct unit tests for the stack-format
parser in src/util/caller.ts by exercising the code path that performs
callerLine.match (the const match = callerLine.match(/at (?:(?:[\w<>_]+\.)?get
|(?:[\w<>_]+\.)?)([\w_]+) [[(]/);) and asserting it extracts method names for
inputs like "at ClassName.methodName (file)", "at get methodName [as alias]
(file)", and that it returns undefined (no match) for non-matching stack lines;
place tests targeting the function or module that uses callerLine.match so
future regex changes are validated.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
vasta-docs | dc3de80 | Commit Preview URL Branch Preview URL |
Apr 22 2026, 04:49 PM |
There was a problem hiding this comment.
Pull request overview
Adds CI enforcement for linting/formatting and updates the repo’s lint/format setup to support ESLint + Prettier checks in GitHub Actions.
Changes:
- Add a GitHub Actions workflow to run ESLint and Prettier on pushes/PRs to
main. - Add
lint/prettiernpm scripts and updateeslint.config.mjsto the new flat-config structure. - Bump dev dependencies (notably ESLint major version) and update ignore files / Node version pin.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/util/caller.ts |
Adjusts a stack-trace parsing regex (likely to satisfy lint rules). |
package.json |
Adds lint/format scripts and updates toolchain dependency versions. |
eslint.config.mjs |
Migrates ESLint config to defineConfig with ignores + TS targeting. |
.github/workflows/format-check.yml |
New CI workflow running pnpm lint and pnpm prettier:check. |
.prettierignore |
Ignores generated docs build output directories. |
.nvmrc |
Pins Node version for local/CI usage. |
.gitignore |
Adds .claude to ignored files. |
AGENTS.md |
Updates contributor/agent guidance and adds DX goal statement. |
pnpm-lock.yaml |
Lockfile update reflecting dependency bumps and new transitive deps. |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
package.json (1)
57-57:⚠️ Potential issue | 🟠 MajorResolve Node runtime/type major mismatch at Line 57.
@types/nodeis on major 25, while this repo context previously pinned runtime Node to major 24 via.nvmrc. That can permit APIs at type-check time that are unavailable at runtime.Proposed fix
- "@types/node": "^25.6.0", + "@types/node": "^24.0.0",#!/bin/bash set -euo pipefail runtime_major="$(sed -En 's/^v?([0-9]+).*/\1/p' .nvmrc | head -n1)" types_major="$(python - <<'PY' import json, re v = json.load(open("package.json"))["devDependencies"]["@types/node"] m = re.search(r'(\d+)', v) print(m.group(1) if m else "") PY )" echo "runtime_major=$runtime_major" echo "types_major=$types_major" test "$runtime_major" = "$types_major"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` at line 57, The `@types/node` devDependency is on major 25 while the repo runtime is pinned to Node major 24 in .nvmrc, which can allow type-only APIs not available at runtime; update the package.json devDependency for "@types/node" to use the same major as .nvmrc (e.g. change the version string to a 24.x range) or alternatively update .nvmrc to the newer runtime major if you intend to run Node 25 — modify the "@types/node" entry in package.json (or .nvmrc) so the two majors match and run install/typecheck to verify.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@package.json`:
- Line 57: The `@types/node` devDependency is on major 25 while the repo runtime
is pinned to Node major 24 in .nvmrc, which can allow type-only APIs not
available at runtime; update the package.json devDependency for "@types/node" to
use the same major as .nvmrc (e.g. change the version string to a 24.x range) or
alternatively update .nvmrc to the newer runtime major if you intend to run Node
25 — modify the "@types/node" entry in package.json (or .nvmrc) so the two
majors match and run install/typecheck to verify.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 16423e4b-b67d-4155-ad3a-22966ad5cf5a
📒 Files selected for processing (2)
.github/workflows/format-check.ymlpackage.json
✅ Files skipped from review due to trivial changes (1)
- .github/workflows/format-check.yml
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/model/Builder.ts (1)
129-130: Replaceanyparams withunknownto enforce stricter typing and match overload contracts.The implementation signatures still use broad
anyfor parameters (opOrVal,valueinwhere()at lines 129–130;valuesinwhereIn()at line 173), which weakens type safety. Since the implementation already performs runtime checks (Array.isArray,typeof,!== undefined) and the overloads define specific type contracts, usingunknownwould better align the implementation with those contracts while maintaining the same runtime behavior.♻️ Suggested typing-only adjustment
where( columnOrExpression: | string | Expression<any> | ((eb: ExpressionBuilder<ExtractDB<M>, ExtractTB<M>>) => Expression<any>), - opOrVal?: any, - value?: any, + opOrVal?: unknown, + value?: unknown, ): this { @@ whereIn( column: string | Expression<any> | ((eb: ExpressionBuilder<ExtractDB<M>, ExtractTB<M>>) => Expression<any>), - values: any, + values: unknown, ): this { this.constraints.push({ type: "whereIn", column, values: values as any }); return this; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/model/Builder.ts` around lines 129 - 130, The implementation signatures for where(opOrVal?: any, value?: any) and whereIn(..., values?: any) use overly-broad any which weakens typing; change those implementation parameter types to unknown (e.g., opOrVal?: unknown, value?: unknown, values?: unknown) and keep the existing runtime guards (Array.isArray, typeof checks, !== undefined) to narrow the types before use so the overload contracts remain correct and type-safety is enforced for functions where and whereIn in Builder.ts.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/model/Builder.ts`:
- Around line 129-130: The implementation signatures for where(opOrVal?: any,
value?: any) and whereIn(..., values?: any) use overly-broad any which weakens
typing; change those implementation parameter types to unknown (e.g., opOrVal?:
unknown, value?: unknown, values?: unknown) and keep the existing runtime guards
(Array.isArray, typeof checks, !== undefined) to narrow the types before use so
the overload contracts remain correct and type-safety is enforced for functions
where and whereIn in Builder.ts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 73d10b05-3dc2-48cc-8c3e-fac66a8e6865
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
AGENTS.mdeslint.config.mjspackage.jsonsrc/model/Builder.ts
✅ Files skipped from review due to trivial changes (2)
- AGENTS.md
- package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- eslint.config.mjs
Added eslint and prettier workflow checks
Summary by CodeRabbit
New Features
Chores
Bug Fixes
Documentation