Skip to content

Conversation

@derN3rd
Copy link

@derN3rd derN3rd commented Jan 15, 2026

This PR adds support for formatting ClickHouse SQL dialect based on the changes from @mattbasta in the sql-formatter repo (Thanks Matt!)

Closes #495


Important

Adds support for ClickHouse SQL dialect in Prettier SQL plugin by updating sql-formatter and adding ClickHouse as a dialect option.

  • Behavior:
    • Adds support for ClickHouse SQL dialect in index.ts by adding it to the language choices.
    • Updates sql-formatter dependency in package.json to ^15.7.0 to support ClickHouse.
  • Misc:

This description was created by Ellipsis for f303244. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • New Features

    • Added support for the ClickHouse SQL dialect for formatting.
  • Documentation

    • Updated docs to include the new ClickHouse dialect option.
  • Tests

    • Added a ClickHouse-specific test fixture to validate formatting.
  • Chores

    • Bumped sql-formatter dependency to v15.7.0 and added a release changeset.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 15, 2026

🦋 Changeset detected

Latest commit: db8b260

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

This PR includes changesets to release 1 package
Name Type
prettier-plugin-sql Minor

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 15, 2026

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@socket-security
Copy link

socket-security bot commented Jan 15, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedsql-formatter@​15.6.5 ⏵ 15.7.099100100 +195 +6100

View full report

@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

Adds ClickHouse support by bumping sql-formatter to v15.7.0 and registering a new clickhouse dialect in the SQL plugin; includes test fixture, README entry, and a changeset announcing the feature.

Changes

Cohort / File(s) Summary
Dependency
packages/sql/package.json
Bump sql-formatter from ^15.6.5 to ^15.7.0.
Plugin dialects
packages/sql/src/index.ts
Add new dialect choice { value: 'clickhouse', description: 'ClickHouse: https://clickhouse.com' } to options.language.choices.
Documentation
packages/sql/README.md
Add 'clickhouse' to SqlOptions.language examples/description.
Tests & Fixtures
packages/sql/test/fixtures.spec.ts, packages/sql/test/fixtures/495.sql
Add fixture entry and SQL file exercising ClickHouse syntax.
Changeset
.changeset/clickhouse-formatting.md
New changeset announcing minor release and ClickHouse support.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

feature, enhancement

Poem

🐰
I nudged a dialect, soft and bright,
ClickHouse wakes to formatted light.
A hop, a test, a tidy line,
Now queries hop and neatly shine. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding ClickHouse SQL formatting support to the prettier-plugin-sql package.
Linked Issues check ✅ Passed The PR fully addresses issue #495 by updating sql-formatter to v15.7.0 and adding ClickHouse as a dialect option, enabling the requested ClickHouse query formatting support.
Out of Scope Changes check ✅ Passed All changes are directly scoped to enabling ClickHouse support: dependency update, dialect option addition, documentation update, and test fixture addition.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50843c9 and db8b260.

⛔ Files ignored due to path filters (2)
  • packages/sql/test/__snapshots__/fixtures.spec.ts.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .changeset/clickhouse-formatting.md
  • packages/sql/README.md
  • packages/sql/package.json
  • packages/sql/src/index.ts
  • packages/sql/test/fixtures.spec.ts
  • packages/sql/test/fixtures/495.sql
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-04-17T01:50:12.370Z
Learnt from: JounQin
Repo: un-ts/prettier PR: 444
File: packages/sh/test/fixtures/445.sh:1-2
Timestamp: 2025-04-17T01:50:12.370Z
Learning: Files in test fixture directories for the un-ts/prettier project may intentionally contain syntax errors to test how parsers and formatters handle invalid syntax. These should not be flagged as issues requiring correction.

Applied to files:

  • .changeset/clickhouse-formatting.md
  • packages/sql/test/fixtures.spec.ts
📚 Learning: 2025-06-26T03:32:37.551Z
Learnt from: JounQin
Repo: un-ts/prettier PR: 479
File: packages/sh/test/fixtures/.env.development:1-1
Timestamp: 2025-06-26T03:32:37.551Z
Learning: Test fixtures in prettier-plugin-sh may intentionally include edge cases like leading spaces in environment variable values to test parser behavior, even if such formatting would be problematic in production code.

Applied to files:

  • packages/sql/test/fixtures.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (6)
packages/sql/test/fixtures.spec.ts (1)

40-42: LGTM!

The test configuration for ClickHouse follows the established pattern used for other dialect-specific fixtures (e.g., 144 for PostgreSQL, 277 for MySQL). This correctly maps fixture 495.sql to use the clickhouse language option.

.changeset/clickhouse-formatting.md (1)

1-5: Changeset is appropriate for the feature addition.

The minor version bump is correct for adding a new dialect feature. The previous review concerns about missing test coverage and documentation have been addressed in this PR:

  • Test fixture added at packages/sql/test/fixtures/495.sql
  • README updated to include clickhouse in the language options
  • Test spec updated with corresponding parser options
packages/sql/test/fixtures/495.sql (1)

1-9: Good test fixture for ClickHouse dialect.

The fixture appropriately exercises ClickHouse-specific syntax including:

  • ClickHouse data types (DateTime, UInt64, LowCardinality, Array)
  • MergeTree engine with PARTITION BY, ORDER BY, and TTL clauses
  • The toIntervalMonth function

This provides adequate coverage for validating the ClickHouse formatter integration.

packages/sql/README.md (1)

133-133: Documentation correctly updated for ClickHouse support.

The clickhouse dialect is now properly documented in the SqlOptions interface, making it discoverable for users.

packages/sql/package.json (1)

55-55: Dependency specification is invalid: version 15.7.0 does not exist.

The npm package sql-formatter has a latest published version of 15.6.12 (as of January 2026). Version 15.7.0 does not exist in the npm registry, making ^15.7.0 an unpublishable dependency specification. Additionally, ClickHouse is not listed as a supported dialect in sql-formatter. The version bump rationale and PR objective claim about ClickHouse support added in v15.7.0 cannot be verified and appear to be incorrect.

Likely an incorrect or invalid review comment.

packages/sql/src/index.ts (1)

205-208: LGTM! ClickHouse dialect option properly integrated.

The entry structure, description URL, and placement are correct and consistent with other dialect entries. sql-formatter v15.7.0 supports the clickhouse language, as confirmed by the existing test fixtures.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

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

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to f303244 in 56 seconds. Click for details.
  • Reviewed 28 lines of code in 2 files
  • Skipped 1 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/sql/package.json:55
  • Draft comment:
    Dependency update to sql-formatter@15.7.0 is correct and necessary for ClickHouse support. Ensure tests cover the new dialect.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. packages/sql/src/index.ts:202
  • Draft comment:
    Added ClickHouse dialect option in the language choices; this resolves #495. The addition is straightforward.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_cphq3ElQGbJM9X88

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@derN3rd derN3rd force-pushed the feat/add-clickhouse-support branch from f303244 to 50843c9 Compare January 15, 2026 09:25
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: 1

🤖 Fix all issues with AI agents
In @.changeset/clickhouse-formatting.md:
- Line 5: The change adds ClickHouse support in packages/sql/src/index.ts but
lacks tests and documentation; add a ClickHouse test fixture under
packages/sql/test/fixtures/ following the naming and input/output pattern used
by existing dialect fixtures (e.g., postgresql, mysql) to exercise the
ClickHouse formatting option, and update the root README.md to include
ClickHouse in the supported dialects/languages list so the new option (the
ClickHouse dialect added in packages/sql/src/index.ts) is documented.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f303244 and 50843c9.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • .changeset/clickhouse-formatting.md
  • packages/sql/package.json
  • packages/sql/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/sql/package.json
  • packages/sql/src/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
.changeset/clickhouse-formatting.md (1)

1-2: LGTM! Changeset metadata is correct.

The changeset properly declares a minor version bump for prettier-plugin-sql, which is appropriate for adding a new feature (ClickHouse dialect support) according to semantic versioning.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@derN3rd derN3rd force-pushed the feat/add-clickhouse-support branch from 50843c9 to db8b260 Compare January 15, 2026 09:42
@sonarqubecloud
Copy link

@derN3rd
Copy link
Author

derN3rd commented Jan 15, 2026

Also updated the readme now and added a simple test fixture to check if clickhouse formatting is working with some specific clickhouse-only sql functions

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 17, 2026

Open in StackBlitz

prettier-plugin-autocorrect

npm i https://pkg.pr.new/prettier-plugin-autocorrect@496

prettier-plugin-pkg

npm i https://pkg.pr.new/prettier-plugin-pkg@496

prettier-plugin-sh

npm i https://pkg.pr.new/prettier-plugin-sh@496

prettier-plugin-sql

npm i https://pkg.pr.new/prettier-plugin-sql@496

prettier-plugin-toml

npm i https://pkg.pr.new/prettier-plugin-toml@496

commit: db8b260

@codecov
Copy link

codecov bot commented Jan 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.69%. Comparing base (7a4346d) to head (db8b260).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #496   +/-   ##
=======================================
  Coverage   86.69%   86.69%           
=======================================
  Files          10       10           
  Lines         203      203           
  Branches       57       57           
=======================================
  Hits          176      176           
  Misses         26       26           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

[prettier-plugin-sql] Support for Clickhouse

1 participant