Skip to content

Conversation

@Newbie012
Copy link
Collaborator

@Newbie012 Newbie012 commented Jun 23, 2025

Summary by CodeRabbit

  • New Features

    • Upgraded major versions of key packages, improving cross-platform compatibility by adopting WebAssembly builds for database parsing.
    • Introduced new ESLint configuration files across demo projects, streamlining SQL linting integration for TypeScript and various database setups.
    • Added support for ES modules in multiple projects and packages.
  • Bug Fixes

    • Improved handling of output directories and module path resolution in TypeScript configurations for better build consistency.
  • Chores

    • Upgraded dependencies and development tools across all packages and demos to their latest versions.
    • Updated scripts and ignored files for modern project structure, replacing legacy directories with standardized output folders.
  • Documentation

    • Simplified installation and prerequisites in documentation.
    • Updated roadmap and guides to reflect new major version and features.
  • Refactor

    • Removed deprecated configuration files and streamlined ESLint and TypeScript setup.
    • Simplified internal logic for SQL parsing and code generation, reducing complexity and improving maintainability.

@vercel
Copy link

vercel bot commented Jun 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
safeql ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2025 6:20pm

@changeset-bot
Copy link

changeset-bot bot commented Jun 23, 2025

🦋 Changeset detected

Latest commit: 89ec8e6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@ts-safeql/eslint-plugin Major
@ts-safeql/generate Major
@ts-safeql-demos/basic-flat-config Patch
@ts-safeql-demos/basic-migrations-raw Patch
@ts-safeql-demos/basic-transform-type Patch
@ts-safeql-demos/basic Patch
@ts-safeql-demos/big-project Patch
@ts-safeql-demos/config-file-flat-config Patch
@ts-safeql-demos/from-config-file Patch
@ts-safeql-demos/multi-connections Patch
@ts-safeql-demos/playground Patch
@ts-safeql-demos/postgresjs-custom-types Patch
@ts-safeql-demos/postgresjs-demo Patch
@ts-safeql-demos/vercel-postgres Patch
@ts-safeql/shared Major
@ts-safeql/sql-ast Major
@ts-safeql/test-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jun 23, 2025

Walkthrough

This update modernizes the codebase by upgrading dependencies, switching from .eslintrc.json to eslint.config.js for ESLint configuration, and standardizing output directories from lib to dist across all packages and demos. It also migrates to ES modules ("type": "module"), removes direct use of native binaries in favor of WebAssembly for libpg-query, and simplifies SQL parsing flows. Numerous configuration files are updated or removed, and test and build scripts are adjusted accordingly.

Changes

File(s) / Path(s) Change Summary
.eslintrc.json, packages/*/.eslintrc.json, demos/*/.eslintrc.json Removed legacy ESLint JSON configs in favor of new JS-based configs.
eslint.config.js, demos/*/eslint.config.js Added or updated ESLint JS configs using typescript-eslint and SafeQL plugin, with project service enabled.
.gitignore, demos/*/.gitignore Changed ignored build output from lib to dist (and added generated in some cases).
.nvmrc Updated Node.js version from 18 to 20.
README.md, docs/guide/getting-started.md Simplified prerequisites and removed references to native build requirements.
docs/blog/safeql-v5-roadmap.md Updated all references from SafeQL v4 to v5.
docs/package.json Upgraded documentation dependencies.
package.json, demos/*/package.json, packages/*/package.json Added "type": "module" and upgraded all dependencies and devDependencies to latest major/minor versions.
tsconfig.json, demos/*/tsconfig.json, packages/*/tsconfig.json Replaced "noEmit": true" with "outDir": "./dist" to enable output emission to dist.
demos/prisma/prisma/schema.prisma, demos/prisma/tsconfig.json, demos/prisma/src/index.ts, demos/prisma/src/prisma.ts-test.ts Changed Prisma client output and import paths to use generated/client instead of node_modules/.prisma/client.
demos/big-project/src/test.ts, demos/typeorm/src/data-source.ts Added ES module-compatible __dirname definition.
demos/vercel-postgres/src/setup.ts Changed import style for pg to default import.
packages/ast-types/src/index.ts Updated ESLint disable comments.
packages/eslint-plugin/build.config.ts, packages/generate/build.config.ts Updated build configs: removed worker entry, added "libpg-query" as external.
packages/eslint-plugin/src/dirs.ts, packages/eslint-plugin/src/workers/parse-sync.worker.ts Removed file(s) related to direct synchronous parsing with libpg-query.
packages/eslint-plugin/src/rules/check-sql.rule.ts, packages/eslint-plugin/src/workers/check-sql.worker.ts, packages/eslint-plugin/src/workers/index.ts Refactored to remove direct SQL parsing step; now parsing happens within generate function using WASM-based libpg-query.
packages/generate/src/generate.ts, packages/generate/src/generate.test.ts, packages/generate/src/utils/get-nonnullable-columns.test.ts, packages/generate/src/utils/get-relations-with-joins.test.ts Refactored to parse SQL queries at runtime, removing need for pre-parsed AST in parameters.
packages/eslint-plugin/src/utils/is-in-editor.ts Disabled specific ESLint rule via directive.
packages/eslint-plugin/src/rules/ts-fixture/file.ts, packages/eslint-plugin/src/rules/ts-fixture/tsconfig.json Added minimal files for test fixture setup.

Sequence Diagram(s)

sequenceDiagram
    participant ESLint
    participant SafeQL Plugin
    participant Generate Module
    participant libpg-query (WASM)

    ESLint->>SafeQL Plugin: Lint SQL query in code
    SafeQL Plugin->>Generate Module: Call generateSyncE(query, ...)
    Generate Module->>libpg-query (WASM): parse(query.text)
    libpg-query (WASM)-->>Generate Module: AST
    Generate Module-->>SafeQL Plugin: Type info, errors, etc.
    SafeQL Plugin-->>ESLint: Lint results
Loading

Poem

🐇
Hoppity hop, a modern leap,
From lib to dist, our builds now sleep.
No more native woes, WASM’s here—
SQL parsing flows are crystal clear!
ESLint config now shines in JS,
With modules and upgrades, we’re truly blessed.
The garden’s neat—onward, progress!
🥕✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6888f59 and 89ec8e6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • demos/postgresjs-demo/tsconfig.json (1 hunks)
  • demos/prisma/.gitignore (1 hunks)
  • demos/shared/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • demos/prisma/.gitignore
  • demos/shared/package.json
  • demos/postgresjs-demo/tsconfig.json

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai bot added a commit that referenced this pull request Jun 23, 2025
Docstrings generation was requested by @Newbie012.

* #398 (comment)

The following files were modified:

* `demos/basic-migrations-raw/src/index.ts`
* `demos/prisma/src/index.ts`
* `demos/prisma/src/prisma.ts-test.ts`
* `demos/vercel-postgres/src/setup.ts`
* `packages/eslint-plugin/src/rules/check-sql.rule.ts`
* `packages/eslint-plugin/src/utils/is-in-editor.ts`
* `packages/eslint-plugin/src/workers/check-sql.worker.ts`
* `packages/eslint-plugin/src/workers/index.ts`
* `packages/generate/src/generate.ts`
@coderabbitai
Copy link

coderabbitai bot commented Jun 23, 2025

Note

Generated docstrings for this pull request at #399

Copy link

@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: 5

♻️ Duplicate comments (1)
demos/prisma/src/prisma.ts-test.ts (1)

1-1: Duplicate: Path alias verification
Same alias change as in index.ts—ensure @/prisma-client is correctly configured in tsconfig.json.

🧹 Nitpick comments (14)
packages/eslint-plugin/src/utils/is-in-editor.ts (1)

1-1: Review ESLint disable directive scope
Disabling no-constant-binary-expression at the file level may be too broad. Consider narrowing the disable to the specific constant expression or refactoring to remove the false || prefix.

docs/blog/safeql-v5-roadmap.md (2)

33-33: Consider using a proper heading instead of emphasis for the date.

The static analysis tool correctly identifies that emphasis (italics) is being used where a heading might be more appropriate for the publication date.

-_December 15, 2024_
+## December 15, 2024

122-122: Improve sentence variety to enhance readability.

The static analysis tool identified repetitive sentence beginnings with "I'm" which could affect readability. Consider varying the sentence structure.

-I'm excited about the upcoming changes in SafeQL v5. I believe they will make the library more flexible and powerful. I'm looking forward to hearing your feedback and suggestions.
+I'm excited about the upcoming changes in SafeQL v5. These updates will make the library more flexible and powerful. Your feedback and suggestions are always welcome.
packages/eslint-plugin/src/rules/ts-fixture/file.ts (1)

1-1: Nit: Correct comment grammar.

The comment currently reads “File needs to exists”; update it to “File needs to exist.” for grammatical correctness and clarity.

Apply this diff:

- // File needs to exists
+ // File needs to exist.
demos/vercel-postgres/src/setup.ts (1)

19-19: Validate the connection string before use.
Add a guard to ensure process.env.POSTGRES_URL is defined and throw a clear error if not. For example:

const url = process.env.POSTGRES_URL;
if (!url) throw new Error("POSTGRES_URL is not set");
const client = new pg.Client({ connectionString: url });

This prevents confusing runtime errors when the env var is missing.

.changeset/forty-meals-behave.md (1)

6-6: Fix typos in the breaking change description.

There are spelling errors in the breaking change description that should be corrected for professional documentation.

-BREAKING: SafeQL now requires the latest minore releases of `libpg-query` which use WASM builds instead of native binaries. This change imporves compatibility across different platforms and eliminates native compilation issues.
+BREAKING: SafeQL now requires the latest minor releases of `libpg-query` which use WASM builds instead of native binaries. This change improves compatibility across different platforms and eliminates native compilation issues.
demos/big-project/eslint.config.js (1)

6-15: Review flat ESLint configuration
The flat config setup aligns with the new style and applies SafeQL rules. Confirm that parserOptions.projectService: true is supported; if not, specify project with the path(s) to your tsconfig.json.

demos/basic/eslint.config.js (1)

14-19: SafeQL connection configuration
Setting safeql.configs.connections with databaseUrl and targets is good. You may want to allow overriding the URL via an environment variable for flexibility in CI/local setups.

demos/postgresjs-demo/package.json (1)

22-22: Move @types/node to devDependencies.
Type definitions are only needed at build time, so relocating @types/node to devDependencies prevents unnecessary production installs.

demos/vercel-postgres/package.json (1)

24-24: Move @types/node to devDependencies.
Type definitions are only needed during development—shifting @types/node into devDependencies avoids extra production installs.

demos/basic/package.json (1)

22-22: Move @types/node to devDependencies.
Type declaration packages are only needed at build time and shouldn’t ship as runtime deps.

demos/postgresjs-demo/eslint.config.js (1)

14-20: SafeQL connection config and credentials
The connections rules are properly set to lint tagged SQL in the demo. To avoid committing credentials and enhance flexibility, consider loading the database URL from an environment variable (e.g., process.env.DATABASE_URL).

packages/generate/src/generate.ts (1)

179-182: Consider refactoring to avoid ESLint disable.

The ESLint disable for unused expressions suggests a potential code smell. Consider restructuring this logic to be more explicit.

-        // eslint-disable-next-line @typescript-eslint/no-unused-expressions
-        map.has(table)
-          ? map.get(table)?.set(column, type)
-          : map.set(table, new Map([[column, type]]));
+        if (map.has(table)) {
+          map.get(table)?.set(column, type);
+        } else {
+          map.set(table, new Map([[column, type]]));
+        }
packages/eslint-plugin/src/rules/check-sql.test.ts (1)

1758-1758: Consider a more descriptive test suite name.

The test suite name "json(b)" could be more descriptive.

-  ruleTester.run("json(b)", rules["check-sql"], {
+  ruleTester.run("JSON/JSONB type inference", rules["check-sql"], {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c28ed0 and 6888f59.

⛔ Files ignored due to path filters (3)
  • docs/public/safeql-v4-roadmap.jpg is excluded by !**/*.jpg
  • docs/public/safeql-v5-roadmap.jpg is excluded by !**/*.jpg
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (107)
  • .changeset/forty-meals-behave.md (1 hunks)
  • .eslintrc.json (0 hunks)
  • .gitignore (1 hunks)
  • .nvmrc (1 hunks)
  • README.md (1 hunks)
  • demos/basic-flat-config/eslint.config.js (1 hunks)
  • demos/basic-flat-config/package.json (1 hunks)
  • demos/basic-flat-config/tsconfig.json (1 hunks)
  • demos/basic-migrations-raw/.eslintrc.json (0 hunks)
  • demos/basic-migrations-raw/.gitignore (1 hunks)
  • demos/basic-migrations-raw/eslint.config.js (1 hunks)
  • demos/basic-migrations-raw/package.json (1 hunks)
  • demos/basic-migrations-raw/src/index.ts (0 hunks)
  • demos/basic-migrations-raw/tsconfig.json (1 hunks)
  • demos/basic-transform-type/.eslintrc.json (0 hunks)
  • demos/basic-transform-type/.gitignore (1 hunks)
  • demos/basic-transform-type/eslint.config.js (1 hunks)
  • demos/basic-transform-type/package.json (2 hunks)
  • demos/basic-transform-type/tsconfig.json (1 hunks)
  • demos/basic/.eslintrc.json (0 hunks)
  • demos/basic/.gitignore (1 hunks)
  • demos/basic/eslint.config.js (1 hunks)
  • demos/basic/package.json (2 hunks)
  • demos/basic/tsconfig.json (1 hunks)
  • demos/big-project/.eslintrc.json (0 hunks)
  • demos/big-project/eslint.config.js (1 hunks)
  • demos/big-project/package.json (2 hunks)
  • demos/big-project/src/test.ts (1 hunks)
  • demos/big-project/tsconfig.json (1 hunks)
  • demos/config-file-flat-config/.gitignore (1 hunks)
  • demos/config-file-flat-config/eslint.config.js (1 hunks)
  • demos/config-file-flat-config/package.json (1 hunks)
  • demos/config-file-flat-config/tsconfig.json (1 hunks)
  • demos/from-config-file/.eslintrc.json (0 hunks)
  • demos/from-config-file/.gitignore (1 hunks)
  • demos/from-config-file/eslint.config.js (1 hunks)
  • demos/from-config-file/package.json (2 hunks)
  • demos/from-config-file/tsconfig.json (1 hunks)
  • demos/multi-connections/.eslintrc.json (0 hunks)
  • demos/multi-connections/.gitignore (1 hunks)
  • demos/multi-connections/eslint.config.js (1 hunks)
  • demos/multi-connections/package.json (1 hunks)
  • demos/multi-connections/tsconfig.json (1 hunks)
  • demos/playground/.eslintrc.json (0 hunks)
  • demos/playground/eslint.config.js (1 hunks)
  • demos/playground/package.json (2 hunks)
  • demos/playground/tsconfig.json (1 hunks)
  • demos/postgresjs-custom-types/.eslintrc.json (0 hunks)
  • demos/postgresjs-custom-types/eslint.config.js (1 hunks)
  • demos/postgresjs-custom-types/package.json (1 hunks)
  • demos/postgresjs-custom-types/tsconfig.json (1 hunks)
  • demos/postgresjs-demo/.eslintrc.json (0 hunks)
  • demos/postgresjs-demo/.gitignore (1 hunks)
  • demos/postgresjs-demo/eslint.config.js (1 hunks)
  • demos/postgresjs-demo/package.json (2 hunks)
  • demos/postgresjs-demo/tsconfig.json (1 hunks)
  • demos/prisma/.eslintrc.json (0 hunks)
  • demos/prisma/.gitignore (1 hunks)
  • demos/prisma/eslint.config.js (1 hunks)
  • demos/prisma/package.json (1 hunks)
  • demos/prisma/prisma/schema.prisma (1 hunks)
  • demos/prisma/src/index.ts (1 hunks)
  • demos/prisma/src/prisma.ts-test.ts (1 hunks)
  • demos/prisma/tsconfig.json (1 hunks)
  • demos/shared/package.json (1 hunks)
  • demos/typeorm/.eslintrc.json (0 hunks)
  • demos/typeorm/eslint.config.js (1 hunks)
  • demos/typeorm/package.json (2 hunks)
  • demos/typeorm/src/data-source.ts (1 hunks)
  • demos/typeorm/tsconfig.json (1 hunks)
  • demos/vercel-postgres/.eslintrc.json (0 hunks)
  • demos/vercel-postgres/eslint.config.js (1 hunks)
  • demos/vercel-postgres/package.json (2 hunks)
  • demos/vercel-postgres/src/setup.ts (2 hunks)
  • demos/vercel-postgres/tsconfig.json (1 hunks)
  • docs/blog/safeql-v5-roadmap.md (4 hunks)
  • docs/guide/getting-started.md (1 hunks)
  • docs/package.json (1 hunks)
  • eslint.config.js (1 hunks)
  • package.json (2 hunks)
  • packages/ast-types/.eslintrc.json (0 hunks)
  • packages/ast-types/package.json (1 hunks)
  • packages/ast-types/src/index.ts (1 hunks)
  • packages/ast-types/tsconfig.json (1 hunks)
  • packages/eslint-plugin/.eslintrc.json (0 hunks)
  • packages/eslint-plugin/build.config.ts (1 hunks)
  • packages/eslint-plugin/package.json (1 hunks)
  • packages/eslint-plugin/src/dirs.ts (0 hunks)
  • packages/eslint-plugin/src/rules/check-sql.rule.ts (2 hunks)
  • packages/eslint-plugin/src/rules/check-sql.test.ts (2 hunks)
  • packages/eslint-plugin/src/rules/ts-fixture/file.ts (1 hunks)
  • packages/eslint-plugin/src/rules/ts-fixture/tsconfig.json (1 hunks)
  • packages/eslint-plugin/src/utils/is-in-editor.ts (1 hunks)
  • packages/eslint-plugin/src/workers/check-sql.worker.ts (1 hunks)
  • packages/eslint-plugin/src/workers/index.ts (1 hunks)
  • packages/eslint-plugin/src/workers/parse-sync.worker.ts (0 hunks)
  • packages/eslint-plugin/tsconfig.json (1 hunks)
  • packages/generate/.eslintrc.json (0 hunks)
  • packages/generate/build.config.ts (1 hunks)
  • packages/generate/package.json (1 hunks)
  • packages/generate/src/generate.test.ts (2 hunks)
  • packages/generate/src/generate.ts (3 hunks)
  • packages/generate/src/utils/get-nonnullable-columns.test.ts (1 hunks)
  • packages/generate/src/utils/get-relations-with-joins.test.ts (1 hunks)
  • packages/generate/tsconfig.json (1 hunks)
  • packages/shared/.eslintrc.json (0 hunks)
  • packages/shared/package.json (1 hunks)
⛔ Files not processed due to max files limit (10)
  • packages/shared/tsconfig.json
  • packages/sql-tag/.eslintrc.json
  • packages/sql-tag/package.json
  • packages/sql-tag/tsconfig.json
  • packages/test-utils/.eslintrc.json
  • packages/test-utils/package.json
  • packages/test-utils/tsconfig.json
  • pnpm-workspace.yaml
  • tsconfig.node.json
  • turbo.json
💤 Files with no reviewable changes (20)
  • demos/basic-migrations-raw/src/index.ts
  • packages/generate/.eslintrc.json
  • packages/eslint-plugin/.eslintrc.json
  • packages/ast-types/.eslintrc.json
  • demos/postgresjs-demo/.eslintrc.json
  • demos/playground/.eslintrc.json
  • demos/prisma/.eslintrc.json
  • packages/shared/.eslintrc.json
  • demos/basic-migrations-raw/.eslintrc.json
  • demos/multi-connections/.eslintrc.json
  • packages/eslint-plugin/src/workers/parse-sync.worker.ts
  • demos/big-project/.eslintrc.json
  • demos/vercel-postgres/.eslintrc.json
  • packages/eslint-plugin/src/dirs.ts
  • .eslintrc.json
  • demos/postgresjs-custom-types/.eslintrc.json
  • demos/basic/.eslintrc.json
  • demos/basic-transform-type/.eslintrc.json
  • demos/typeorm/.eslintrc.json
  • demos/from-config-file/.eslintrc.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/eslint-plugin/src/workers/index.ts (1)
packages/eslint-plugin/src/workers/check-sql.worker.ts (1)
  • CheckSQLWorkerHandler (37-37)
🪛 markdownlint-cli2 (0.17.2)
docs/blog/safeql-v5-roadmap.md

33-33: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

🪛 LanguageTool
docs/blog/safeql-v5-roadmap.md

[style] ~122-~122: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...the library more flexible and powerful. I'm looking forward to hearing your feedb...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: check (ubuntu-latest, 20)
🔇 Additional comments (125)
.nvmrc (1)

1-1: Bump Node.js version to 20
This update aligns the runtime with upgraded ESLint configs and dependencies. Ensure that CI workflows, Dockerfiles, and any developer documentation are updated to reference Node 20.

.gitignore (1)

3-5: Approve new ignore patterns
Ignoring build artifacts (*.tsbuildinfo, dist, generated) aligns with the updated output directories and keeps the repo clean.

demos/basic/.gitignore (1)

1-1: Approve updated ignore directory
Ignoring the dist directory matches the new build output path in this demo.

demos/basic-flat-config/package.json (1)

13-18: Approve devDependencies upgrades
Upgrading @eslint/js, @types/node, eslint, tsx, typescript, and typescript-eslint is consistent with the monorepo’s modernization and maintains alignment across demos.

demos/shared/package.json (2)

4-4: Approve ES module field
Adding "type": "module" correctly marks this demo as an ES module.


6-6: Approve TypeScript version bump
Updating TypeScript to ^5.8.2 aligns with other demos and the root configuration.

packages/ast-types/src/index.ts (1)

1-1: Verify that the new ESLint disable rule covers all previous cases.

The ESLint disable comment has been simplified from three specific rules to a single @typescript-eslint/no-empty-object-type rule. Ensure this new rule properly covers the same linting cases as the previous rules (no-empty-interface, ban-types, and no-namespace).

#!/bin/bash
# Description: Verify the ESLint rule change covers the same cases
# Search for usage patterns that the old rules would have caught

echo "=== Searching for empty interfaces ==="
ast-grep --pattern 'interface $_ {}'

echo "=== Searching for namespace declarations ==="
ast-grep --pattern 'namespace $_ { $$$ }'

echo "=== Searching for type aliases with object types ==="
ast-grep --pattern 'type $_ = {}'
packages/ast-types/tsconfig.json (1)

2-5: LGTM! Build output configuration aligned with codebase standards.

The TypeScript configuration correctly specifies the output directory as ./dist, which aligns with the project-wide standardization mentioned in the AI summary.

packages/ast-types/package.json (2)

27-27: LGTM! Clean script updated to align with new build output directory.

The clean script correctly targets the new dist directory, consistent with the tsconfig.json changes.


30-35: Verify compatibility with major dependency updates.

Several dependencies have been updated to newer major versions, particularly ESLint (8.x → 9.x) and TypeScript-ESLint (7.x → 8.x). Ensure these updates don't introduce breaking changes that affect the build or linting process.

#!/bin/bash
# Description: Check for potential breaking changes in updated dependencies
# Check if there are any ESLint configuration issues with the new versions

echo "=== Checking ESLint configuration compatibility ==="
cd packages/ast-types
npm ls eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser

echo "=== Testing lint command ==="
npm run lint 2>&1 || echo "Linting may have issues with new versions"

echo "=== Testing TypeScript compilation ==="
npm run typecheck 2>&1 || echo "TypeScript compilation may have issues"
packages/eslint-plugin/src/rules/ts-fixture/tsconfig.json (1)

1-10: LGTM! Well-configured TypeScript setup for ESLint rule testing.

The TypeScript configuration uses appropriate modern settings for a test fixture environment. The ESNext target and Bundler module resolution are suitable for testing scenarios, and strict mode ensures type safety.

docs/blog/safeql-v5-roadmap.md (1)

2-2: LGTM! Comprehensive version update from v4 to v5.

The documentation has been thoroughly updated to reflect the new major version across all relevant sections including metadata, headings, and content references.

Also applies to: 16-16, 19-19, 22-22, 25-25, 31-31, 35-35, 37-37, 51-51, 122-122

package.json (2)

5-5: Add "type": "module" for ESM support
Approving explicit ESM mode declaration to enable ES module resolution across the workspace.

Please verify that all import paths and sub-package configurations are compatible with ESM (no remaining CommonJS-only imports).


31-34: Approve devDependency version bumps
The upgrades for @changesets/cli, prettier, turbo, and typescript align with the modernization effort.

demos/config-file-flat-config/eslint.config.js (1)

8-8: Formatting-only change (trailing comma)
This trailing comma addition does not affect functionality.

demos/prisma/src/index.ts (1)

1-1: Verify @/prisma-client path alias
Confirm that the TypeScript paths configuration points to ./generated/client and that imports resolve correctly at runtime.

demos/typeorm/tsconfig.json (1)

4-4: Verify .gitignore for dist
With outDir switched to ./dist, ensure the dist folder is added to .gitignore to avoid committing build artifacts.

demos/multi-connections/.gitignore (1)

1-1: Approve: Updated ignore directory aligns with standard.

Ignoring the dist directory matches the new output configuration and maintains consistency across demos.

demos/prisma/prisma/schema.prisma (1)

6-6: Approve: Updated Prisma client output path.

Switching the client generator output to "../generated/client" aligns with updated TypeScript path aliases and ensures generated code resides outside node_modules.

demos/from-config-file/.gitignore (1)

1-1: Approve: Standardized output ignore folder.

Ignoring dist aligns with the new build output directory and matches changes in other demos.

demos/config-file-flat-config/tsconfig.json (1)

4-4: Standardize compile output to dist.

The outDir is correctly set to ./dist, aligning with the project-wide convention for emitted files.

demos/basic-migrations-raw/tsconfig.json (1)

4-4: Standardize compile output to dist.

The outDir is correctly set to ./dist, aligning with the project-wide convention for emitted files.

demos/basic-flat-config/tsconfig.json (1)

4-4: Standardize compile output to dist.

The outDir is correctly set to ./dist, aligning with the project-wide convention for emitted files.

demos/from-config-file/tsconfig.json (1)

4-4: Standardize compile output to dist.

The outDir is correctly set to ./dist, aligning with the project-wide convention for emitted files.

demos/postgresjs-demo/.gitignore (1)

1-1: Ignore the dist directory.

Updated .gitignore to exclude the dist folder instead of lib, matching the new output directory.

docs/guide/getting-started.md (1)

9-9: Approve updated prerequisite instructions.

The simplified standalone sentence is clear and the link is correct.

demos/basic-migrations-raw/.gitignore (1)

1-1: Approve updated ignore directory.

Ignoring dist now aligns with the updated build outputs.

demos/config-file-flat-config/.gitignore (1)

1-1: Approve updated ignore directory.

Standardizing on dist across demos is consistent.

demos/basic-transform-type/.gitignore (1)

1-1: Approve updated ignore directory.

Consistent dist ignore pattern applied.

demos/vercel-postgres/src/setup.ts (1)

3-3: Confirm default import semantics for pg.
Switching from a named import ({ Client }) to a default import (pg) is fine under ESM, but please verify that your build/runtime interop supports it. If you encounter issues, consider reverting to:

import { Client } from "pg";
demos/basic-transform-type/tsconfig.json (1)

4-4: Emit compiled files into dist.
Replacing "noEmit": true with "outDir": "./dist" aligns with other demos and enables your build artifacts to be generated. Make sure your scripts (e.g., build in package.json) reference dist accordingly.

demos/multi-connections/tsconfig.json (1)

4-4: Configure output directory for compiled code.
Adding "outDir": "./dist" ensures that all transpiled files land in a single folder. Verify that your CI/CD and local build steps target this directory.

demos/basic/tsconfig.json (1)

4-4: Standardize output folder to dist.
The new "outDir": "./dist" replaces noEmit and standardizes artifact placement across demos. Confirm that your downstream tooling (e.g., demos launch scripts) points to dist.

demos/playground/tsconfig.json (1)

4-4: Enable emission to dist.
Switching to "outDir": "./dist" aligns this project with the rest of the repo. Ensure .gitignore is updated to exclude dist/ and that any import paths or scripts reference the new folder.

demos/vercel-postgres/tsconfig.json (1)

4-4: Enable emitted output to dist directory
Switching from suppressing emissions to specifying "outDir": "./dist" aligns with the standardized build outputs across demos. Ensure that any scripts, CI steps, and .gitignore entries now reference dist instead of relying on noEmit.

demos/big-project/tsconfig.json (1)

4-4: Emit compiled files into dist
Consistent with other demos, "outDir": "./dist" enables file emission. Please verify removal of any legacy noEmit flags and update downstream tooling to consume from dist.

demos/postgresjs-custom-types/tsconfig.json (1)

4-4: Standardize TypeScript output directory
Replacing noEmit with "outDir": "./dist" ensures build artifacts are emitted. Confirm that .gitignore and cleanup targets include the dist folder.

packages/generate/build.config.ts (1)

12-12: Mark libpg-query as external
Adding "libpg-query" to externals prevents bundling its wasm/native binaries, reducing bundle size. Ensure it’s declared under dependencies or peerDependencies in package.json.

packages/generate/tsconfig.json (1)

2-5: Configure compiler output to dist
Introducing "outDir": "./dist" enables generated files to be placed in the dist folder. Verify removal of noEmit and update build/clean scripts accordingly.

docs/package.json (2)

13-14: LGTM! Documentation dependency updates look good.

The vitepress and plugin version updates are reasonable incremental upgrades that should provide bug fixes and new features.


18-18: LGTM! Analytics dependency update is appropriate.

The @vercel/analytics update to ^1.5.0 is a reasonable minor version bump.

demos/basic-flat-config/eslint.config.js (1)

11-11: Good practice: Adding trailing comma improves maintainability.

The trailing comma addition follows JavaScript best practices and will make future configuration changes result in cleaner diffs.

packages/eslint-plugin/build.config.ts (2)

12-12: LGTM! Externalizing libpg-query is appropriate for WASM builds.

Adding libpg-query to externals makes sense with the migration to WASM builds, as it should now be a runtime dependency rather than bundled.


5-5: Verify removal of parse-sync worker references.

The removal of the parse-sync worker from build entries aligns with the WASM migration. Ensure all imports and references to this worker have been removed from the codebase.

#!/bin/bash
# Description: Verify that all references to parse-sync.worker.ts have been removed
# Expected: No references should remain

# Search for any remaining references to the removed worker
rg -i "parse-sync\.worker" --type ts --type js
packages/eslint-plugin/tsconfig.json (1)

4-6: Let’s refine the checks for leftover “lib” references and ensure dist/ is ignored:

#!/bin/bash
# 1. Verify .gitignore includes dist/
echo "Checking .gitignore for dist/…"
grep -n 'dist/' .gitignore || echo "✗ dist/ not found in .gitignore"

# 2. Look for any --outDir lib in package.json scripts
echo -e "\nSearching package.json for --outDir lib…"
grep -R '"scripts"' -n package.json | sed -n '1,20p'
grep -R 'outDir.*lib' -n package.json || echo "✓ No --outDir lib references in package.json"

# 3. Find any local imports or paths pointing to a lib/ directory
echo -e "\nScanning .ts/.js files for './lib/' or '/lib/' paths…"
rg -g '*.ts' -g '*.js' '(\./lib/|/lib/)' -n || echo "✓ No local lib/ imports found"
demos/prisma/tsconfig.json (2)

4-4: LGTM! Enabling compilation output aligns with the migration.

The change from "noEmit": true to "outDir": "./dist" properly enables TypeScript compilation output, consistent with the broader standardization to dist directories across the project.


6-6: Good update to the Prisma client path alias.

The path change from "./node_modules/.prisma/client" to "./generated/client" aligns with the updated Prisma client output directory, making the generated client location more explicit and avoiding node_modules dependencies.

demos/typeorm/src/data-source.ts (1)

3-4: Correct ES module __dirname implementation.

This is the standard pattern for replicating CommonJS __dirname functionality in ES modules. The implementation correctly uses import.meta.url to obtain the current module's directory path, enabling the existing path resolution on line 11 to continue working.

README.md (1)

36-36: Good simplification of prerequisites.

The removal of node-gyp requirements and simplification to focus on ESLint setup aligns well with the migration to WebAssembly builds for libpg-query. This reduces setup complexity for users while maintaining the essential TypeScript ESLint configuration guidance.

packages/generate/package.json (2)

30-30: LGTM! Clean script updated for new output directory.

The change from "rm -rf lib" to "rm -rf dist" properly aligns with the standardization of output directories across the project.


33-41: ```shell
#!/bin/bash

List all TypeScript config files across the repo (excluding node_modules)

echo "Listing all tsconfig.json files:"
find . -not -path "./node_modules/*" -name "tsconfig.json"

List all ESLint configuration files across the repo

echo
echo "Listing all ESLint config files (.eslintrc.* and eslint.config.js):"
find . -not -path "./node_modules/*" (
-name "eslint.config.js"
-o -name ".eslintrc.js"
-o -name ".eslintrc.json"
-o -name ".eslintrc.yaml"
-o -name ".eslintrc.yml"
)


</details>
<details>
<summary>demos/big-project/src/test.ts (1)</summary>

`5-6`: **Consistent ES module __dirname implementation.**

This follows the same correct pattern used in other files for ES module compatibility. The implementation properly enables the existing `path.join(__dirname, ...)` usage on line 7 to continue working in the ES module context.

</details>
<details>
<summary>packages/generate/src/utils/get-relations-with-joins.test.ts (1)</summary>

`119-119`: **Verify API compatibility and consistency across the codebase.**

The change from `parser.parseQuery` to `parser.parse` aligns with the migration to WASM-based parsing. Ensure this API change is consistent throughout the codebase and that the new method has the same signature and behavior.




```shell
#!/bin/bash
# Description: Verify all usages of parser.parseQuery have been updated to parser.parse

# Search for any remaining usage of the old API
rg "parseQuery" --type ts

# Search for the new API usage to confirm consistency
rg "parser\.parse" --type ts -A 2
packages/eslint-plugin/src/workers/check-sql.worker.ts (2)

25-28: Import reordering looks good.

The import reordering is a cosmetic improvement with no functional impact.


30-35: ```shell
#!/bin/bash

Search for any remaining references to pgParsed in the codebase

rg --heading --line-number 'pgParsed' --color never


</details>
<details>
<summary>demos/config-file-flat-config/package.json (1)</summary>

`13-18`: **Verify compatibility of major dependency upgrades.**

Several major version upgrades require attention:
- ESLint: 8.57.1 → 9.23.0 (breaking changes expected)
- typescript-eslint: 7.18.0 → 8.28.0 (breaking changes expected)  
- @types/node: 18.19.68 → 22.13.13 (significant Node.js version jump)

Ensure the new ESLint flat config system is properly supported and test the demo thoroughly.



```web
What are the breaking changes in ESLint 9.0 compared to ESLint 8.x?
What are the breaking changes in typescript-eslint 8.0 compared to 7.x?
demos/from-config-file/eslint.config.js (1)

1-15: Excellent modernization to ESLint flat config.

The new configuration properly implements the ESLint flat config system with:

  • Correct TypeScript ESLint parser integration
  • Modern projectService: true for better performance
  • Proper SafeQL plugin configuration
  • Clean file targeting pattern

This is a significant improvement over the legacy .eslintrc.json format.

demos/typeorm/package.json (2)

4-4: Verify ES modules compatibility throughout the demo.

The addition of "type": "module" is a significant change that requires:

  • All imports to use explicit file extensions where needed
  • Compatibility with CommonJS dependencies
  • Proper handling of __dirname and __filename (use import.meta.url instead)

Ensure the demo works correctly with ES modules.

#!/bin/bash
# Description: Check for potential ES modules compatibility issues

# Look for CommonJS-style require statements that need updating
rg "require\(" demos/typeorm/src --type ts

# Check for __dirname/__filename usage that needs ES modules equivalent
rg "__dirname|__filename" demos/typeorm/src --type ts

# Verify import statements have proper extensions where needed
rg "from ['\"]\.\.?/[^'\"]*[^\.]['\"]" demos/typeorm/src --type ts

15-23: Verify compatibility of upgraded dependencies.

Multiple dependency upgrades include:

  • Runtime: pg (8.14.1), reflect-metadata (0.2.2), typeorm (0.3.21)
  • Dev: TypeScript (5.8.2), ESLint (9.23.0), typescript-eslint (8.28.0)

Ensure the TypeORM demo functions correctly with these updates, especially with the ES modules migration.

What are the breaking changes in TypeORM 0.3.21 compared to earlier versions?

Also applies to: 27-29

packages/generate/src/utils/get-nonnullable-columns.test.ts (1)

82-82: LGTM - Clean API migration

The change from parser.parseQuery to parser.parse aligns with the broader simplification of SQL parsing flows mentioned in the PR summary. This internal API update maintains the same functionality while using the updated libpg-query interface.

eslint.config.js (1)

1-19: Well-structured ESLint flat config migration

This configuration properly migrates to the modern ESLint flat config format with appropriate settings:

  • Correct file targeting for the packages directory
  • Proper exclusion of test files
  • Modern typescript-eslint integration with projectService enabled
  • Reasonable rule customization

The migration aligns with the broader modernization effort described in the PR.

demos/playground/eslint.config.js (1)

1-15: Appropriate demo-specific ESLint configuration

This configuration correctly adapts the flat config format for the playground demo with:

  • Proper file targeting for the demo's source structure
  • Correct integration with the SafeQL ESLint plugin
  • Type-aware linting enabled via projectService
  • Use of SafeQL's useConfigFile configuration

The setup supports the demo's SQL linting requirements while maintaining consistency with the overall modernization.

demos/basic-migrations-raw/package.json (2)

4-4: ES module migration enabled

Adding "type": "module" correctly enables ES modules for this demo package, aligning with the broader modernization effort.


12-15: Modern dependency consolidation

The dependency updates properly consolidate ESLint tooling and upgrade to recent versions. The migration from separate @typescript-eslint/parser and @typescript-eslint/eslint-plugin packages to the unified typescript-eslint package follows current best practices.

Let me verify these dependency versions are current and secure:

#!/bin/bash
# Check for the latest versions of the updated dependencies
echo "Checking latest versions of updated dependencies..."

# Check latest stable versions
npm view @eslint/js version
npm view eslint version  
npm view typescript version
npm view typescript-eslint version

# Check for any security advisories
npm audit --json | jq -r '.vulnerabilities | keys[]' 2>/dev/null || echo "No vulnerabilities found"
packages/generate/src/generate.test.ts (2)

186-204: Simplified test flow aligns with parsing refactor

The removal of the parseQueryTE step and direct use of generateTE with the query object correctly reflects the architectural change to handle SQL parsing internally during generation rather than pre-parsing. This simplification reduces complexity while maintaining test coverage.


694-694: Correct error message update

The removal of the "Internal error: " prefix from the expected error message aligns with the parsing workflow changes. The raw PostgreSQL syntax error is now exposed directly, which provides clearer error reporting.

packages/shared/package.json (3)

28-28: Update clean script to target dist directory
The clean script now removes dist instead of lib, aligning with the new output directory convention.


31-38: Bump devDependencies to latest tooling versions
Upgraded to TS 5.8.2, ESLint 9.23.0, Vitest 3.0.9, etc. Ensure there are no regressions in type-checking, linting, or tests after these upgrades.


40-42: Verify compatibility of minimatch@^10.0.1
Version 10 is pure ESM and may affect CJS import paths. Please confirm that all minimatch usages import correctly and update any require statements if needed.

demos/from-config-file/package.json (3)

4-4: Mark package as ESM with "type": "module"
Good modernization. Ensure downstream scripts and imports are compatible with ESM.


13-18: Align devDependencies with upgraded tooling
Consolidating to @eslint/js, typescript-eslint, ESLint 9.23.0, TS 5.8.2, etc., matches the shared package. Verify lint and build pipelines still pass.


21-22: Add @types/node for Node type definitions
Pinning to ^22.13.13 ensures proper type coverage.

demos/big-project/eslint.config.js (1)

3-5: Verify ESLint imports
Ensure import tseslint from "typescript-eslint"; and import safeql from "@ts-safeql/eslint-plugin/config"; resolve correctly given the demo’s dependencies.

demos/basic/eslint.config.js (1)

9-12: Check parserOptions usage
Verify that parserOptions.projectService: true correctly enables type-aware linting in this flat config. Otherwise, consider using project: ["./tsconfig.json"] with tsconfigRootDir.

demos/basic-transform-type/package.json (3)

4-4: Add "type": "module" to package
Marking the demo as ESM. Ensure no CJS require calls remain.


13-17: Upgrade and consolidate ESLint and TS dependencies
Switching to @eslint/js and typescript-eslint, upgrading ESLint to 9.23.0 and TS to 5.8.2, matches the modernization across demos.


21-22: Update @types/node
Bumped to ^22.13.13 for Node 22 definitions.

demos/postgresjs-demo/package.json (2)

4-4: Approve ES module adoption.
Explicitly marking the demo as an ES module is correct and aligns with the project-wide migration.


13-17: Verify the consolidated ESLint packages.
Confirm that the new typescript-eslint package covers both parsing and plugin functionality (replacing the previous @typescript-eslint/parser and @typescript-eslint/eslint-plugin) and is compatible with @eslint/js.

demos/prisma/eslint.config.js (2)

1-5: Approve imports and TS-check directive.
The use of // @ts-check alongside typescript-eslint and the SafeQL plugin import is correct and follows the new configuration pattern.


6-20: Approve programmatic ESLint configuration.
The parser, parserOptions, file globs, and SafeQL connections setup (migrationsDir and SQL tag targets) correctly implement the updated linting flow.

demos/typeorm/eslint.config.js (2)

1-5: Approve imports and TS-check directive.
The initial setup with typescript-eslint, SafeQL config import, and // @ts-check aligns with the new ESLint config approach.


6-20: Approve ESLint configuration for TypeORM.
Files pattern, parser settings, and SafeQL connections invocation with databaseUrl and SQL tag targets are applied correctly.

demos/multi-connections/package.json (2)

4-4: Approve ES module adoption.
Adding "type": "module" brings this demo in line with the repository’s ES module standard.


12-16: Verify consolidated ESLint dependencies.
Ensure that typescript-eslint effectively replaces both parser and plugin packages, and that it integrates smoothly with @eslint/js.

demos/vercel-postgres/package.json (3)

4-4: Approve ES module adoption.
Specifying "type": "module" here is correct and consistent with other demos.


13-19: Verify consolidated ESLint dependencies.
Confirm that typescript-eslint provides the necessary parser and plugin functionality in place of the old @typescript-eslint packages when used with @eslint/js.


25-27: Verify database client upgrades.
Ensure bumping @vercel/postgres to 0.10.0 and pg to 8.14.1 doesn’t introduce breaking changes, and that the demo’s setup script still functions correctly.

demos/basic/package.json (2)

4-4: Module type declaration is correct.
Setting "type": "module" ensures ESM usage across the demo.


13-17: Dev dependencies consolidated and upgraded.
Swapping out separate @typescript-eslint parser/plugin for unified typescript-eslint and bumping ESLint, TS, and related tooling versions aligns with the other demos.

demos/basic-migrations-raw/eslint.config.js (2)

1-5: Add TypeScript-aware ESLint setup.
The // @ts-check comment and imports from typescript-eslint and the SafeQL plugin are properly configured.


6-20: ESLint configuration for SafeQL migrations.
The new JavaScript-based config correctly targets src/**/*.ts, enables the TS parser service, and extends SafeQL’s connections rules with the proper migrations directory and query-wrapper patterns.

demos/prisma/package.json (3)

12-12: Update clean script to target dist.
Switching from removing lib to dist matches the new output directory convention.


15-23: Dev dependencies upgraded and unified.
Replacing separate @typescript-eslint packages with typescript-eslint plus @eslint/js, bumping TS/ESLint/tsx/zx versions keeps tooling in sync with other demos.


26-27: Prisma dependencies bumped to 6.5.0.
Locking both @prisma/client and prisma to the same new major version ensures compatibility.

demos/postgresjs-demo/eslint.config.js (2)

1-5: Initialize TS-aware ESLint config.
Adding // @ts-check and importing typescript-eslint and SafeQL configs follows the pattern used across demos.


6-13: Core ESLint settings look solid.
Targeting src/**/*.ts, enabling the TS parser service, and setting the parser to typescript-eslint are all correctly applied.

demos/playground/package.json (3)

4-4: Switch to ESM by setting "type": "module".
This aligns the playground demo with the rest of the project’s module format.


13-18: Upgrade and consolidate dev dependencies.
Replacing separate TypeScript ESLint packages with typescript-eslint and adding @eslint/js, plus bumping TS/ESLint/tsx versions, standardizes tooling.


21-23: Runtime dependencies are in place.
Shared demo packages and the Postgres client remain in dependencies as expected.

demos/postgresjs-custom-types/package.json (2)

4-4: LGTM! ES module declaration added correctly.

The explicit "type": "module" declaration properly enables ES module support for this demo package.


12-17: Verify compatibility of major dependency upgrades.

Several dependencies have been upgraded to newer major versions. Ensure these upgrades don't introduce breaking changes that could affect the demo functionality.

#!/bin/bash
# Description: Check for breaking changes in upgraded dependencies

echo "Checking for potential breaking changes in upgraded dependencies..."

# Check ESLint 9.x breaking changes
echo "ESLint 9.x introduced flat config as default and removed several rules"

# Check TypeScript 5.8.x changes
echo "TypeScript 5.8.x changes need verification"

# Check if there are any usage patterns that might be affected
rg -A 3 -B 3 "eslint|typescript" --type ts --type js
demos/vercel-postgres/eslint.config.js (1)

1-20: LGTM! Well-structured ESLint flat config.

The ESLint configuration properly:

  • Uses the modern flat config format
  • Integrates typescript-eslint and SafeQL plugins correctly
  • Targets appropriate TypeScript files
  • Enables projectService for better TypeScript integration
packages/generate/src/generate.ts (2)

25-25: LGTM! Direct libpg-query import for WebAssembly support.

The change to import libpg-query directly aligns with the migration to WebAssembly builds and removes dependency on native binaries.


264-266: Verify error handling for runtime SQL parsing.

The shift from pre-parsed ASTs to runtime parsing is a significant architectural change. Ensure proper error handling is in place for parsing failures.

#!/bin/bash
# Description: Check for error handling patterns around libpg-query usage

echo "Checking for error handling around libpg-query.parse calls..."
ast-grep --pattern 'parser.parse($_)'

echo "Checking for try-catch blocks around parsing..."
ast-grep --pattern 'try {
  $$$
  parser.parse($_)
  $$$
} catch ($_) {
  $$$
}'
packages/eslint-plugin/package.json (4)

38-38: LGTM! Test output improvement.

The --hideSkippedTests=true flag improves test output readability by hiding skipped tests.


42-42: LGTM! Output directory standardization.

Changing the clean script from lib to dist aligns with the broader standardization effort across packages.


64-64: Clarify purpose of new "quansync" dependency.

The addition of quansync as a new dependency needs clarification on its purpose and usage within the codebase.

#!/bin/bash
# Description: Check usage of quansync in the codebase

echo "Searching for quansync usage..."
rg "quansync" --type ts --type js -A 2 -B 2

echo "Checking imports of quansync..."
ast-grep --pattern 'import $_ from "quansync"'
ast-grep --pattern 'import { $_ } from "quansync"'

72-72: Verify impact of peer dependency version bump.

The peer dependency on @typescript-eslint/utils was bumped from >=7.8.0 to >=8.0.0. This is a breaking change that may affect downstream consumers.

#!/bin/bash
# Description: Check for potential breaking changes in @typescript-eslint/utils v8

echo "Checking current usage of @typescript-eslint/utils..."
rg "@typescript-eslint/utils" --type ts -A 2 -B 2

echo "Looking for imports from @typescript-eslint/utils..."
ast-grep --pattern 'import { $_ } from "@typescript-eslint/utils"'
demos/basic-transform-type/eslint.config.js (1)

1-20: LGTM! Well-structured ESLint config with SafeQL integration.

The configuration properly integrates SafeQL with specific database connection settings and query patterns.

demos/postgresjs-custom-types/eslint.config.js (2)

1-4: LGTM!

The imports are correctly structured with @ts-check directive for type checking in JavaScript files.


6-30: Configuration structure looks good!

The SafeSQL configuration properly handles custom PostgreSQL types with appropriate overrides for timestamptz and null handling options.

demos/multi-connections/eslint.config.js (1)

15-24: Well-structured multi-connection configuration!

The setup properly isolates each database client with its own migrations directory and query method patterns.

demos/big-project/package.json (3)

4-4: ES module configuration added correctly.

The "type": "module" declaration properly configures the package for ES modules.


14-18: Dependencies modernized correctly.

The migration to the consolidated typescript-eslint package and addition of @eslint/js aligns with current ESLint best practices.


22-22: Verify Node.js version compatibility.

The update from @types/node v18 to v22 is a significant jump. Please ensure this aligns with your minimum Node.js version requirements.

#!/bin/bash
# Check for Node.js version requirements in the repository
fd -e json -e md -e yml -e yaml | xargs rg -i "node.*version|engines" -A 2 -B 2
packages/eslint-plugin/src/rules/check-sql.rule.ts (2)

2-2: Import cleanup looks good.

The removal of PostgresError aligns with the simplified parsing flow.


179-181: Good simplification of the parsing flow.

Removing the intermediate parsing step reduces complexity and delegates all SQL parsing to the generate worker, ensuring consistency.

packages/eslint-plugin/src/rules/check-sql.test.ts (2)

9-9: Parser configuration modernized correctly.

The update to use languageOptions with direct parser import follows ESLint's current best practices for flat configurations.

Also applies to: 22-28


1758-1965: Comprehensive JSON/JSONB test coverage!

The test suite thoroughly covers PostgreSQL JSON functions including jsonb_build_object, json_agg, and jsonb_agg with proper type inference validation.

packages/eslint-plugin/src/workers/index.ts (5)

2-2: LGTM! Import changes align with the ES module migration.

The switch from AnyAsyncFn to AnyFn and the addition of fileURLToPath import are consistent with the modernization efforts described in the PR objectives.

Also applies to: 4-4


6-6: LGTM! Local distDir definition replaces the removed import.

The use of fileURLToPath and URL with import.meta.url is the correct approach for ES modules to resolve relative paths.


8-8: LGTM! Type constraint change is consistent with the import update.

The change from AnyAsyncFn<R> to AnyFn<R> aligns with the migration away from async-specific worker functions.


16-16: Verify that the timeout reduction is appropriate.

The timeout was reduced from 5 minutes to 1 minute (80% reduction). Ensure this is sufficient for the worker's operations to prevent premature timeouts in production.

Based on the AI summary mentioning "streamlined worker usage pattern," this reduction may be intentional, but please confirm that 1 minute is adequate for the worker's expected workload.


9-9: ```shell
#!/bin/bash
set -e

Inspect how distDir is defined and used in index.ts

echo "→ distDir declarations in index.ts:"
grep -R "distDir" -n packages/eslint-plugin/src/workers/index.ts || true

echo -e "\n→ Top of index.ts (for context):"
sed -n '1,200p' packages/eslint-plugin/src/workers/index.ts || true

Look for any tsup config to see output directory settings

echo -e "\n→ tsup configuration (if present) in the repo:"
grep -R "tsup" -n .

Check build scripts in package.json to find the build command for this plugin

echo -e "\n→ Build scripts in package.json files:"
grep -R ""build"" -n package.json packages/eslint-plugin/package.json || true


</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Newbie012 and others added 4 commits June 23, 2025 21:18
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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