Skip to content

eslint and prettier workflows#5

Merged
Smef merged 8 commits into
mainfrom
lint-prettier-workflows
Apr 22, 2026
Merged

eslint and prettier workflows#5
Smef merged 8 commits into
mainfrom
lint-prettier-workflows

Conversation

@Smef
Copy link
Copy Markdown
Owner

@Smef Smef commented Apr 22, 2026

Added eslint and prettier workflow checks

Summary by CodeRabbit

  • New Features

    • Added automated format-and-lint checks in CI and new lint/format commands.
  • Chores

    • Set a default Node version and updated dev dependency tooling and package manager config.
    • Extended ignore rules to skip AI artifacts and generated docs outputs.
    • Adjusted lint/format targets and configuration.
  • Bug Fixes

    • Improved stack-trace parsing for more reliable caller identification.
    • Tightened query-builder typings for safer query expressions.
  • Documentation

    • Clarified project guidance to emphasize strong typing and developer experience.

Copilot AI review requested due to automatic review settings April 22, 2026 16:28
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Warning

Rate limit exceeded

@Smef has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 45 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a8d9eed-148d-4bac-8f51-8989b2df1dd5

📥 Commits

Reviewing files that changed from the base of the PR and between be1446c and dc3de80.

📒 Files selected for processing (1)
  • test/tests/Caller.ts
📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
CI / Format Workflow
.github/workflows/format-check.yml
Adds a GitHub Actions workflow triggered on push/pull_request to main that checks out the repo, sets up pnpm, installs Node from .nvmrc, runs pnpm install --frozen-lockfile, runs pnpm lint, and always runs pnpm prettier:check.
Node / Package
.nvmrc, package.json
Adds .nvmrc pinning Node to v24; adds packageManager: "pnpm@10.33.1" and lint/prettier scripts; bumps several devDependency versions.
Lint config
eslint.config.mjs
Rewrites to defineConfig([...]), adjusts imports/extends, adds top-level ignores (dist/**/*, docs/.nuxt, docs/.data, docs/.output), and narrows file globs to TypeScript targets.
Ignore files
.gitignore, .prettierignore
Adds .claude to .gitignore; adds docs/.nuxt, docs/.data, and docs/.output to .prettierignore.
Docs
AGENTS.md
Edits top-level header and adds a project-context bullet about delivering strong typing and IntelliSense for developer experience.
Source — util
src/util/caller.ts
Modifies the stack-trace parsing regex in getCallerMethodName() to match a different delimiter sequence, changing which caller lines are recognized.
Source — model
src/model/Builder.ts
Tightens where(...) and whereIn(...) signatures to accept a typed Kysely ((eb: ExpressionBuilder<ExtractDB<M>, ExtractTB<M>>) => Expression<any>) callback instead of a generic Function.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 I hopped through files to tune the flow,

Node set to v24, linters in tow,
Workflows hum, ignores tucked away,
Types sharpened, traces guided astray,
A tiny rabbit cheers the devs today 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'eslint and prettier workflows' accurately describes the main objective of this PR, which adds GitHub Actions workflows for ESLint and Prettier checks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lint-prettier-workflows

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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). Set permissions: contents: read at 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

📥 Commits

Reviewing files that changed from the base of the PR and between 36d919b and 76638ec.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • .github/workflows/format-check.yml
  • .gitignore
  • .nvmrc
  • .prettierignore
  • AGENTS.md
  • eslint.config.mjs
  • package.json
  • src/util/caller.ts

Comment thread AGENTS.md Outdated
Comment thread package.json Outdated
Comment thread src/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_]+) [[(]/);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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 matches

Repository: 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 -20

Repository: 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 -20

Repository: 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 -20

Repository: 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.ts

Repository: 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 -A5

Repository: 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 -A3

Repository: 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 undefined when 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.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 22, 2026

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
vasta-docs dc3de80 Commit Preview URL

Branch Preview URL
Apr 22 2026, 04:49 PM

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 / prettier npm scripts and update eslint.config.mjs to 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.

Comment thread package.json
Comment thread package.json
Comment thread .github/workflows/format-check.yml
Comment thread package.json Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
package.json (1)

57-57: ⚠️ Potential issue | 🟠 Major

Resolve Node runtime/type major mismatch at Line 57.

@types/node is 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

📥 Commits

Reviewing files that changed from the base of the PR and between 76638ec and d83dd28.

📒 Files selected for processing (2)
  • .github/workflows/format-check.yml
  • package.json
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/format-check.yml

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/model/Builder.ts (1)

129-130: Replace any params with unknown to enforce stricter typing and match overload contracts.

The implementation signatures still use broad any for parameters (opOrVal, value in where() at lines 129–130; values in whereIn() 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, using unknown would 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

📥 Commits

Reviewing files that changed from the base of the PR and between d83dd28 and be1446c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • AGENTS.md
  • eslint.config.mjs
  • package.json
  • src/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

@Smef Smef merged commit 290b2ba into main Apr 22, 2026
2 of 3 checks passed
@Smef Smef deleted the lint-prettier-workflows branch April 22, 2026 16:48
@coderabbitai coderabbitai Bot mentioned this pull request May 21, 2026
Merged
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.

2 participants