Skip to content

Conversation

JounQin
Copy link
Member

@JounQin JounQin commented Apr 10, 2025

close #441

Summary by CodeRabbit

  • New Features

    • Introduced an optional setting for Dockerfile formatting that lets you control spacing after redirection operators.
    • Added a command that performs a cleanup operation by listing directory contents in a detailed view.
  • Chores

    • Updated several dependency versions to their latest minor releases.
    • Applied a patch to improve formatting support.

@JounQin JounQin requested a review from Copilot April 10, 2025 13:19
Copy link

coderabbitai bot commented Apr 10, 2025

Walkthrough

This pull request updates several dependency versions and adds a new optional property to control Dockerfile formatting. A changeset entry was added for the prettier-plugin-sh patch and a chore bumped the @reteps/dockerfmt package version. Additionally, a new cleanup command was introduced in a Dockerfile fixture and dependency versions in both the root and package-specific package.json files were incremented.

Changes

File(s) Change Summary
.changeset/many-impalas-beam.md Added a new changeset entry indicating a patch for prettier-plugin-sh and a chore to bump @reteps/dockerfmt to version 0.3.2.
package.json, packages/sh/package.json Updated dependency versions: in package.json, bumped @shikijs/rehype (^3.2.1→^3.2.2), @types/react-dom (^19.1.1→^19.1.2), and vite (^6.2.5→^6.2.6); in packages/sh/package.json, updated @reteps/dockerfmt (^0.2.6→^0.3.2).
packages/sh/src/index.ts Added an optional spaceRedirects?: boolean property to the DockerfilePrintOptions interface, set its default to false within the dockerPrinter’s print method, and passed it to formatDockerfileContents.
packages/sh/test/fixtures/441.Dockerfile Added a command to execute a cleanup operation by listing the current directory contents.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant dockerPrinter
    participant formatDockerfileContents

    User->>dockerPrinter: Call print(options)
    dockerPrinter->>formatDockerfileContents: Format Dockerfile (with spaceRedirects flag)
    formatDockerfileContents-->>dockerPrinter: Return formatted output
    dockerPrinter-->>User: Deliver formatted Dockerfile
Loading

Assessment against linked issues

Objective Addressed Explanation
Fix dockerfile parser errors (#441) Dependency updates and formatting option added; unclear if the parser runtime error is resolved.

Possibly related PRs

Poem

I'm a hopping rabbit through lines of code,
Skipping dependencies on my joyful road.
With a new spaceRedirects flag to guide the way,
I bounce through changes, bright as day.
Code carrots crunching in every commit—hip, hip, hooray!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/sh/src/index.ts

Oops! Something went wrong! :(

ESLint: 9.24.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.js
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

Copy link

@Copilot 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.

Copilot reviewed 2 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (4)
  • package.json: Language not supported
  • packages/sh/package.json: Language not supported
  • packages/sh/test/snapshots/fixtures.spec.ts.snap: Language not supported
  • packages/sh/test/fixtures/441.Dockerfile: Language not supported
Comments suppressed due to low confidence (1)

packages/sh/src/index.ts:117

  • Consider adding test cases to verify the behavior of the new 'spaceRedirects' option to ensure it functions as expected.
spaceRedirects = false,

Copy link

codesandbox-ci bot commented Apr 10, 2025

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.

Copy link
Contributor

github-actions bot commented Apr 10, 2025

📊 Package size report   0.01%↑

File Before After
.changeset/many-impalas-beam.md 79 B
packages/sh/src/index.ts 12.1 kB 0.7%↑12.2 kB
packages/sh/test/__snapshots__/fixtures.spec.ts.snap 28.5 kB 0.5%↑28.6 kB
packages/sh/test/fixtures/441.Dockerfile 31 B
Total (Includes all files) 3.1 MB 0.01%↑3.1 MB
Tarball size 1.1 MB 0.01%↑1.1 MB
Unchanged files
File Size
.changeset/config.json 313 B
.changeset/eight-apricots-give.md 89 B
.changeset/README.md 510 B
.codesandbox/ci.json 38 B
.editorconfig 161 B
.gitattributes 152 B
.github/workflows/autofix.yml 920 B
.github/workflows/ci.yml 1.2 kB
.github/workflows/pkg-pr-new.yml 686 B
.github/workflows/pkg-size.yml 542 B
.github/workflows/release.yml 1.3 kB
.github/workflows/size-limit.yml 762 B
.github/workflows/vercel.yml 1.0 kB
.lintstagedrc.js 48 B
.nvmrc 6 B
.postcssrc.cjs 51 B
.prettierignore 23 B
.prettierrc 24 B
.remarkrc 159 B
.renovaterc 49 B
.simple-git-hooks.js 49 B
.size-limit.json 292 B
.yarn/plugins/plugin-prepare-lifecycle.cjs 202 B
.yarn/releases/yarn-4.8.1.cjs 2.8 MB
.yarnrc.yml 397 B
assets/pkg.svg 15.1 kB
assets/sh.png 14.4 kB
CHANGELOG.md 393 B
docs/App.tsx 1.2 kB
docs/global.css 321 B
docs/index.tsx 211 B
eslint.config.js 516 B
index.html 414 B
LICENSE 1.1 kB
package.json 3.4 kB
packages/autocorrect/CHANGELOG.md 1.9 kB
packages/autocorrect/index.d.cts 63 B
packages/autocorrect/LICENSE 1.1 kB
packages/autocorrect/package.json 1.2 kB
packages/autocorrect/README.md 3.9 kB
packages/autocorrect/src/index.ts 1.4 kB
packages/autocorrect/src/types.ts 78 B
packages/autocorrect/test/__snapshots__/fixtures.spec.ts.snap 4.7 kB
packages/autocorrect/test/fixtures.spec.ts 983 B
packages/autocorrect/test/fixtures/test.css 189 B
packages/autocorrect/test/fixtures/test.go 470 B
packages/autocorrect/test/fixtures/test.html 1.1 kB
packages/autocorrect/test/fixtures/test.md 1.1 kB
packages/autocorrect/test/fixtures/test.py 368 B
packages/autocorrect/test/fixtures/test.rb 234 B
packages/autocorrect/test/fixtures/test0.js 453 B
packages/autocorrect/tsconfig.json 154 B
packages/pkg/CHANGELOG.md 11.4 kB
packages/pkg/index.d.cts 47 B
packages/pkg/LICENSE 16.7 kB
packages/pkg/package.json 1.1 kB
packages/pkg/README.md 6.2 kB
packages/pkg/src/index.ts 1.4 kB
packages/pkg/src/rules/files.ts 1.7 kB
packages/pkg/src/rules/object.ts 899 B
packages/pkg/src/rules/sort.ts 2.4 kB
packages/pkg/src/types.ts 1.0 kB
packages/pkg/src/utils.ts 567 B
packages/pkg/test/__snapshots__/engines.spec.ts.snap 158 B
packages/pkg/test/__snapshots__/files.spec.ts.snap 173 B
packages/pkg/test/__snapshots__/test.spec.ts.snap 2.0 kB
packages/pkg/test/engines.spec.ts 417 B
packages/pkg/test/files.spec.ts 409 B
packages/pkg/test/fixtures/fixture1.json 1.0 kB
packages/pkg/test/fixtures/fixture2.json 863 B
packages/pkg/test/fixtures/fixture3.json 430 B
packages/pkg/test/test.spec.ts 2.3 kB
packages/pkg/tsconfig.json 154 B
packages/sh/CHANGELOG.md 14.2 kB
packages/sh/index.d.cts 45 B
packages/sh/LICENSE 1.1 kB
packages/sh/package.json 1.5 kB
packages/sh/README.md 10.4 kB
packages/sh/test/__snapshots__/shellscript.spec.ts.snap 394 B
packages/sh/test/error.spec.ts 482 B
packages/sh/test/fixtures.spec.ts 843 B
packages/sh/test/fixtures/.dockerignore 108 B
packages/sh/test/fixtures/.nvmrc 6 B
packages/sh/test/fixtures/.properties 177 B
packages/sh/test/fixtures/133.sh 5.2 kB
packages/sh/test/fixtures/162.sh 15.7 kB
packages/sh/test/fixtures/182.sh 1.9 kB
packages/sh/test/fixtures/191.sh 1.7 kB
packages/sh/test/fixtures/278.Dockerfile 32 B
packages/sh/test/fixtures/292.Dockerfile 95 B
packages/sh/test/fixtures/376.Dockerfile 217 B
packages/sh/test/fixtures/384.Dockerfile 51 B
packages/sh/test/fixtures/398.Dockerfile 64 B
packages/sh/test/fixtures/Dockerfile 394 B
packages/sh/test/fixtures/hosts 406 B
packages/sh/test/fixtures/jvm.options 162 B
packages/sh/test/fixtures/no-ext 38 B
packages/sh/test/fixtures/shell.sh 368 B
packages/sh/test/loc-functions.spec.ts 1.2 kB
packages/sh/test/parser.spec.ts 2.1 kB
packages/sh/tsconfig.json 154 B
packages/sql/CHANGELOG.md 11.3 kB
packages/sql/index.d.cts 47 B
packages/sql/LICENSE 1.1 kB
packages/sql/package.json 1.4 kB
packages/sql/README.md 6.9 kB
packages/sql/shim.d.ts 59 B
packages/sql/src/index.ts 13.0 kB
packages/sql/test/__snapshots__/fixtures-eol.spec.ts.snap 756 B
packages/sql/test/__snapshots__/fixtures.spec.ts.snap 2.0 kB
packages/sql/test/__snapshots__/sql.spec.ts.snap 374 B
packages/sql/test/fixtures-eol.spec.ts 1.3 kB
packages/sql/test/fixtures-eol/556.sql 73 B
packages/sql/test/fixtures-eol/557.sql 69 B
packages/sql/test/fixtures-eol/558.sql 69 B
packages/sql/test/fixtures-eol/559.sql 73 B
packages/sql/test/fixtures.spec.ts 1.7 kB
packages/sql/test/fixtures/144.sql 68 B
packages/sql/test/fixtures/233.sql 68 B
packages/sql/test/fixtures/277.sql 88 B
packages/sql/test/fixtures/279.sql 106 B
packages/sql/test/fixtures/291.sql 1.2 kB
packages/sql/test/fixtures/334.sql 15 B
packages/sql/test/fixtures/basic.sql 120 B
packages/sql/test/sql.spec.ts 660 B
packages/sql/tsconfig.json 154 B
packages/toml/CHANGELOG.md 2.0 kB
packages/toml/index.d.cts 49 B
packages/toml/LICENSE 1.1 kB
packages/toml/package.json 1.2 kB
packages/toml/README.md 5.2 kB
packages/toml/src/index.ts 1.3 kB
packages/toml/src/options.ts 2.6 kB
packages/toml/src/types.ts 381 B
packages/toml/test/__snapshots__/fixtures.spec.ts.snap 487 B
packages/toml/test/fixtures.spec.ts 955 B
packages/toml/test/fixtures/comments.toml 87 B
packages/toml/test/fixtures/fixture1.toml 162 B
packages/toml/tsconfig.json 154 B
README.md 6.8 kB
scripts/format.ts 593 B
scripts/languages.ts 3.0 kB
test.js 184 B
test/global.d.ts 41 B
test/tsconfig.json 223 B
tsconfig.base.json 89 B
tsconfig.json 275 B
vercel.json 229 B
vite.config.ts 544 B
vitest.config.ts 541 B

🤖 This report was automatically generated by pkg-size-action

Copy link
Contributor

github-actions bot commented Apr 10, 2025

size-limit report 📦

Path Size
packages/autocorrect/lib/index.js 538 B (0%)
packages/pkg/lib/index.js 447 B (0%)
packages/sh/lib/index.js 3.15 KB (+0.41% 🔺)
packages/sql/lib/index.js 2.4 KB (0%)

Copy link

pkg-pr-new bot commented Apr 10, 2025

Open in StackBlitz

prettier-plugin-autocorrect

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

prettier-plugin-pkg

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

prettier-plugin-sql

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

prettier-plugin-sh

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

prettier-plugin-toml

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

commit: 56a3155

Copy link

codecov bot commented Apr 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.71%. Comparing base (95c608c) to head (1aa35c3).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
packages/sh/src/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #442      +/-   ##
==========================================
- Coverage   86.18%   85.71%   -0.48%     
==========================================
  Files          10       10              
  Lines         181      182       +1     
  Branches       46       47       +1     
==========================================
  Hits          156      156              
- Misses         24       25       +1     
  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.

Copy link

changeset-bot bot commented Apr 10, 2025

🦋 Changeset detected

Latest commit: 1aa35c3

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-sh 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

Copy link

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: 0

🧹 Nitpick comments (1)
package.json (1)

1-115: Verification of @reteps/dockerfmt Update.
The PR title indicates a bump of @reteps/dockerfmt to v0.3.2, yet this file (the root package.json) does not include an update for that dependency. Please confirm that the @reteps/dockerfmt update has been applied in the appropriate location (likely in the packages/sh/package.json file) and that all related changes are properly tracked.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 95c608c and 1aa35c3.

⛔ Files ignored due to path filters (2)
  • packages/sh/test/__snapshots__/fixtures.spec.ts.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • .changeset/many-impalas-beam.md (1 hunks)
  • package.json (2 hunks)
  • packages/sh/package.json (1 hunks)
  • packages/sh/src/index.ts (2 hunks)
  • packages/sh/test/fixtures/441.Dockerfile (1 hunks)
🧰 Additional context used
🪛 Hadolint (2.12.0)
packages/sh/test/fixtures/441.Dockerfile

[error] 1-1: Invalid instruction order. Dockerfile must begin with FROM, ARG or comment.

(DL3061)

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 on macos-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
🔇 Additional comments (10)
packages/sh/test/fixtures/441.Dockerfile (2)

1-3: Intentional test fixture for Dockerfile formatting

This fixture appears to be intentionally created to test the new spaceRedirects formatting capability added in this PR. It provides a simple RUN command with a cleanup operation.

🧰 Tools
🪛 Hadolint (2.12.0)

[error] 1-1: Invalid instruction order. Dockerfile must begin with FROM, ARG or comment.

(DL3061)


1-3:

✅ Verification successful

Note: This fixture doesn't follow Dockerfile best practices

While this is a valid test fixture, note that Hadolint reports it doesn't follow the standard Dockerfile format which requires starting with a FROM, ARG, or comment instruction.

Since this is likely intentional for testing purposes, no changes are needed. However, if you're interested in seeing what Hadolint expects:


🏁 Script executed:

#!/bin/bash
echo 'FROM ubuntu:latest' > test.Dockerfile
echo 'RUN \\' >> test.Dockerfile
echo '    # cleanup' >> test.Dockerfile
echo '    ls -la' >> test.Dockerfile
cat test.Dockerfile

Length of output: 159


Fixture intentionally deviates from Dockerfile best practices for testing

The test fixture in packages/sh/test/fixtures/441.Dockerfile is intentionally kept without a FROM, ARG, or comment instruction. As verified by the provided shell script—which shows a compliant fixture starting with a FROM directive—it’s clear that this deviation is deliberate for testing purposes. No changes are needed.

🧰 Tools
🪛 Hadolint (2.12.0)

[error] 1-1: Invalid instruction order. Dockerfile must begin with FROM, ARG or comment.

(DL3061)

.changeset/many-impalas-beam.md (1)

1-5: Well-structured changeset entry

The changeset entry appropriately documents both the patch for prettier-plugin-sh and the version bump for @reteps/dockerfmt, which aligns with the PR objectives.

packages/sh/package.json (1)

53-53: Version bump implemented correctly

The dependency version for @reteps/dockerfmt has been successfully updated from ^0.2.6 to ^0.3.2 as specified in the PR objective.

packages/sh/src/index.ts (3)

15-16: Good API extension with backward compatibility

Adding an optional property spaceRedirects to the DockerfilePrintOptions interface is a non-breaking change that extends functionality while maintaining backward compatibility.


117-117: Default value set for new option

Setting spaceRedirects = false as the default is appropriate, ensuring existing behavior doesn't change for users who don't explicitly set this option.


123-123: Parameter correctly passed to formatter

The spaceRedirects parameter is properly passed to the formatDockerfileContents function, completing the implementation of this new formatting option.

package.json (3)

43-43: Dependency Version Bump for @shikijs/rehype.
The version is updated from ^3.2.1 to ^3.2.2, which is a minor update. Please ensure there are no breaking changes in this release.


47-47: Dependency Version Bump for @types/react-dom.
The version change to ^19.1.2 is a minor update for improved type definitions. It would be good to run any related type tests to ensure compatibility.


76-76: Dependency Version Bump for Vite.
Vite is bumped from ^6.2.5 to ^6.2.6. As this is a minor update, it should be backwards compatible; however, please verify that the build and development tasks function as expected with this version change.

@JounQin JounQin merged commit dea6b3f into master Apr 10, 2025
34 of 36 checks passed
@JounQin JounQin deleted the chore/bump branch April 10, 2025 13:32
This was referenced Apr 11, 2025
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.

Errors with dockerfile parser
1 participant