Skip to content

Conversation

JounQin
Copy link
Member

@JounQin JounQin commented Apr 7, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced shell formatting with improved syntax support and error recovery.
    • Introduced new linting capabilities with the addition of the lint-no-undefined-references plugin.
  • Documentation

    • Updated guides with clarified configuration options, support guidelines for specific file types, and deprecation notices for legacy features.
    • Enhanced README documentation for the prettier-plugin-sh project, specifying plugin capabilities and support limitations.
  • Refactor

    • Streamlined parser settings and error handling, along with updated linting rules and build commands to boost overall code quality.
  • Tests

    • Simplified error assertions in test cases to ensure more consistent error reporting.
    • Added new test case to verify error handling for syntax issues in shell scripts.
    • Removed outdated test cases related to experimental features.
  • Chores

    • Updated CI workflow to introduce parallel execution for linting, testing, and type coverage commands.
    • Added a new configuration file to enforce size limits for various JavaScript packages.

Copy link

changeset-bot bot commented Apr 7, 2025

🦋 Changeset detected

Latest commit: 93cf483

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

Copy link

coderabbitai bot commented Apr 7, 2025

Walkthrough

This pull request introduces a series of updates across configuration files, documentation, and code. It adds a new changelog entry, updates linting and build configurations, and adjusts dependency versions. Documentation for shell parser options has been enhanced, with several options made optional and new ones added, while comment styles are standardized across files. Significant refactoring in the shell parser’s error handling flow simplifies interfaces and test assertions.

Changes

File(s) Change Summary
.changeset/spotty-beds-applaud.md, .remarkrc, eslint.config.js, package.json, packages/sh/package.json Added a new patch entry for prettier-plugin-sh; introduced a new linting plugin in .remarkrc; enhanced ESLint configuration with additional plugins and rules; updated build script and devDependencies to remove mvdan-sh and upgrade sh-syntax along with other linting tools.
packages/sh/README.md Updated ShOptions interface: modified properties to be optional, added recoverErrors, minify, singleLine, and functionNextLine; deprecated keepPadding; removed experimentalWasm.
packages/pkg/src/index.ts, packages/pkg/src/rules/files.ts, packages/pkg/src/rules/object.ts, packages/pkg/src/rules/sort.ts, scripts/languages.ts Replaced traditional block comments with JSDoc-style comments and converted single-line comments to multi-line blocks to standardize documentation formatting.
packages/sh/src/index.ts, packages/sh/test/fixtures.spec.ts, packages/sh/test/shellscript.spec.ts Refactored shell parser: restructured ShParserOptions to use partial parser options; removed deprecated error interfaces in favor of a generalized ShSyntaxParseError; streamlined error handling in tests using snapshot matching and simplified import/constants.
packages/sh/test/error.spec.ts Introduced a new test case to verify error handling in the format function for invalid shell commands.
packages/sh/test/shellscript.spec.ts Removed a test file checking fatal parse errors for broken shell scripts.
.github/workflows/ci.yml Modified CI workflow to separate build, lint, and test commands and introduced a memory limit for Node.js.
.size-limit.json Added a new configuration file to specify size limits for various JavaScript packages.

Suggested reviewers

  • JounQin

Poem

I'm a bunny leaping through the code so bright,
Hopping over changes in the soft moonlight.
New plugins and options make the system sing,
Error handling simplified—what a beautiful thing!
With each updated line, my floppy ears do cheer,
Carrots and clean code alike, we hold dear.
Hop on, friends, for changes bring joy this year!


🪧 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

socket-security bot commented Apr 7, 2025

Report too large to display inline

View full report↗︎

Copy link

codesandbox-ci bot commented Apr 7, 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

pkg-pr-new bot commented Apr 7, 2025

Open in StackBlitz

prettier-plugin-autocorrect

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

prettier-plugin-pkg

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

prettier-plugin-sql

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

prettier-plugin-sh

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

prettier-plugin-toml

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

commit: 93cf483

Copy link
Contributor

github-actions bot commented Apr 7, 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.06 KB (+31.74% 🔺)
packages/sql/lib/index.js 2.4 KB (0%)

Copy link
Contributor

github-actions bot commented Apr 7, 2025

📊 Package size report   -0.67%↓

File Before After
.changeset/spotty-beds-applaud.md 189 B
.github/workflows/autofix.yml 917 B 0.3%↑920 B
.github/workflows/ci.yml 1.0 kB 3%↑1.1 kB
.remarkrc 42 B 279%↑159 B
.size-limit.json 292 B
eslint.config.js 216 B 139%↑516 B
package.json 3.6 kB -6.71%↓3.4 kB
packages/pkg/src/index.ts 1.4 kB 0.6%↑1.4 kB
packages/pkg/src/rules/files.ts 1.7 kB 0.5%↑1.7 kB
packages/pkg/src/rules/object.ts 891 B 0.9%↑899 B
packages/pkg/src/rules/sort.ts 2.4 kB 0.3%↑2.4 kB
packages/sh/package.json 1.5 kB -1.81%↓1.5 kB
packages/sh/README.md 4.6 kB 129%↑10.4 kB
packages/sh/src/index.ts 9.8 kB 17%↑11.5 kB
packages/sh/test/__snapshots__/fixtures.spec.ts.snap 56.1 kB -49.9%↓28.1 kB
packages/sh/test/__snapshots__/shellscript.spec.ts.snap 312 B 26%↑394 B
packages/sh/test/error.spec.ts 471 B
packages/sh/test/fixtures.spec.ts 1.5 kB -41.8%↓863 B
packages/sh/test/shellscript.spec.ts 741 B
scripts/languages.ts 2.9 kB 1%↑2.9 kB
Total (Includes all files) 3.1 MB -0.67%↓3.1 MB
Tarball size 1.1 MB 0.2%↑1.1 MB
Unchanged files
File Size
.changeset/config.json 313 B
.changeset/README.md 510 B
.codesandbox/ci.json 38 B
.editorconfig 161 B
.gitattributes 152 B
.github/workflows/pkg-pr-new.yml 686 B
.github/workflows/pkg-size.yml 542 B
.github/workflows/release.yml 1.2 kB
.github/workflows/size-limit.yml 633 B
.github/workflows/vercel.yml 901 B
.lintstagedrc.js 48 B
.nvmrc 6 B
.postcssrc.cjs 51 B
.prettierignore 23 B
.prettierrc 24 B
.renovaterc 49 B
.simple-git-hooks.js 49 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
index.html 414 B
LICENSE 1.1 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/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 13.2 kB
packages/sh/index.d.cts 45 B
packages/sh/LICENSE 1.1 kB
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/146.ini 1.1 kB
packages/sh/test/fixtures/147.cfg 3.3 kB
packages/sh/test/fixtures/148.ini 3.1 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/Dockerfile 394 B
packages/sh/test/fixtures/hosts 406 B
packages/sh/test/fixtures/jvm.options 162 B
packages/sh/test/fixtures/no-ext 37 B
packages/sh/test/fixtures/shell.sh 368 B
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 612 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 7, 2025

Deploy preview for prettier ready!

✅ Preview
https://prettier-3d3hr9f0e-1stg.vercel.app

Built with commit 93cf483.
This pull request is being automatically deployed with vercel-action

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

♻️ Duplicate comments (1)
packages/sh/test/shellscript.spec.ts (1)

14-21: Same snapshot issue applies here

The snapshot test for the experimental Wasm case is also failing for the same reason. The snapshots need to be updated for both test cases.

🧹 Nitpick comments (2)
packages/sh/README.md (2)

15-15: Use clearer phrasing.

The phrase "with powered by" is awkward. Suggest rewriting for clarity.

-This plugin is still under development, its printer just wraps [mvdan-sh][]'s default printer with powered by [sh-syntax][].
+This plugin is still under development; its printer just wraps [mvdan-sh][]'s default printer, which is powered by [sh-syntax][].

18-20: Use “cannot” for more natural phrasing.

-We can not do much on our side.
+We cannot do much on our side.
🧰 Tools
🪛 LanguageTool

[style] ~20-~20: Unless you want to emphasize “not”, use “cannot” which is more common.
Context: ...sage cases can be handled correctly. We can not do much on our side. ## Requirements ...

(CAN_NOT_PREMIUM)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ee79de6 and 62a6ca5.

⛔ Files ignored due to path filters (3)
  • packages/sh/test/__snapshots__/fixtures.spec.ts.snap is excluded by !**/*.snap
  • packages/sh/test/__snapshots__/shellscript.spec.ts.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (14)
  • .changeset/spotty-beds-applaud.md (1 hunks)
  • .remarkrc (1 hunks)
  • eslint.config.js (1 hunks)
  • package.json (3 hunks)
  • packages/pkg/src/index.ts (1 hunks)
  • packages/pkg/src/rules/files.ts (1 hunks)
  • packages/pkg/src/rules/object.ts (1 hunks)
  • packages/pkg/src/rules/sort.ts (1 hunks)
  • packages/sh/README.md (4 hunks)
  • packages/sh/package.json (1 hunks)
  • packages/sh/src/index.ts (7 hunks)
  • packages/sh/test/fixtures.spec.ts (2 hunks)
  • packages/sh/test/shellscript.spec.ts (1 hunks)
  • scripts/languages.ts (1 hunks)
🧰 Additional context used
🪛 LanguageTool
.changeset/spotty-beds-applaud.md

[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: ... --- feat(sh): use sh-syntax without experimental flag, remove mvdan-sh support

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

packages/sh/README.md

[uncategorized] ~16-~16: A comma is probably missing here.
Context: ...inter with powered by [sh-syntax][]. Of course it should just work, but may not match ...

(MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE)


[style] ~20-~20: Unless you want to emphasize “not”, use “cannot” which is more common.
Context: ...sage cases can be handled correctly. We can not do much on our side. ## Requirements ...

(CAN_NOT_PREMIUM)

🪛 GitHub Check: Lint and Test with Node.js 18 on macos-latest
packages/sh/test/shellscript.spec.ts

[failure] 6-6: packages/sh/test/shellscript.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/shellscript.spec.ts:6:3

packages/sh/test/fixtures.spec.ts

[failure] 27-27: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:27:40

🪛 GitHub Check: Lint and Test with Node.js 22 on macos-latest
packages/sh/test/shellscript.spec.ts

[failure] 6-6: packages/sh/test/shellscript.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/shellscript.spec.ts:6:3

packages/sh/test/fixtures.spec.ts

[failure] 27-27: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:27:40

🪛 GitHub Check: Lint and Test with Node.js 18 on windows-latest
packages/sh/test/shellscript.spec.ts

[failure] 6-6: packages/sh/test/shellscript.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/shellscript.spec.ts:6:3

packages/sh/test/fixtures.spec.ts

[failure] 27-27: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:27:40

🪛 GitHub Check: Lint and Test with Node.js 22 on ubuntu-latest
packages/sh/test/shellscript.spec.ts

[failure] 6-6: packages/sh/test/shellscript.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/shellscript.spec.ts:6:3

packages/sh/test/fixtures.spec.ts

[failure] 27-27: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:27:40

🪛 GitHub Check: Lint and Test with Node.js 20 on macos-latest
packages/sh/test/shellscript.spec.ts

[failure] 6-6: packages/sh/test/shellscript.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/shellscript.spec.ts:6:3

packages/sh/test/fixtures.spec.ts

[failure] 27-27: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:27:40

🪛 GitHub Check: Lint and Test with Node.js 18 on ubuntu-latest
packages/sh/test/shellscript.spec.ts

[failure] 6-6: packages/sh/test/shellscript.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/shellscript.spec.ts:6:3

packages/sh/test/fixtures.spec.ts

[failure] 27-27: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:27:40

🪛 GitHub Check: Lint and Test with Node.js 20 on windows-latest
packages/sh/test/shellscript.spec.ts

[failure] 6-6: packages/sh/test/shellscript.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/shellscript.spec.ts:6:3

packages/sh/test/fixtures.spec.ts

[failure] 27-27: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:27:40

🪛 GitHub Check: Lint and Test with Node.js 20 on ubuntu-latest
packages/sh/test/shellscript.spec.ts

[failure] 6-6: packages/sh/test/shellscript.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/shellscript.spec.ts:6:3

packages/sh/test/fixtures.spec.ts

[failure] 27-27: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:27:40

🪛 GitHub Check: Lint and Test with Node.js 22 on windows-latest
packages/sh/test/shellscript.spec.ts

[failure] 6-6: packages/sh/test/shellscript.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/shellscript.spec.ts:6:3

packages/sh/test/fixtures.spec.ts

[failure] 27-27: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:27:40

🪛 GitHub Actions: CI
packages/sh/test/shellscript.spec.ts

[error] 6-6: Snapshot fatal parse error with meaningful message 1 mismatched

packages/sh/test/fixtures.spec.ts

[error] 27-27: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

🪛 markdownlint-cli2 (0.17.2)
packages/sh/README.md

103-103: Hard tabs
Column: 6

(MD010, no-hard-tabs)


149-149: Hard tabs
Column: 6

(MD010, no-hard-tabs)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
🔇 Additional comments (30)
packages/pkg/src/rules/sort.ts (1)

1-8: Standardize Header Comment:
The header comment has been updated to a JSDoc-style format. This improves the consistency of documentation across the codebase without impacting functionality.

packages/pkg/src/rules/object.ts (1)

1-8: Consistent Documentation Format:
The header has been transitioned to JSDoc-style comments, aligning with recent updates in other modules. This change is purely cosmetic and enhances readability.

packages/pkg/src/rules/files.ts (1)

1-8: Update to JSDoc-Style Comments:
The revised header comment using JSDoc format promotes a uniform documentation style across the project. No functional changes are present.

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

1-8: Unified Comment Formatting:
The header now employs JSDoc-style comments, consistent with the refactoring in other files. This improves overall maintainability and clarity in the documentation.

scripts/languages.ts (1)

97-100: Comment formatting updated to follow project style guidelines.

The previously single-line comments have been converted to a multi-line comment block, which aligns with the new ESLint rule @stylistic/js/multiline-comment-style set to starred-block defined in the project's ESLint configuration.

eslint.config.js (2)

2-3: New linting plugins added to enhance code quality.

The addition of @stylistic/eslint-plugin-js and eslint-plugin-tsdoc will improve code style consistency and documentation quality.


10-19: New linting rules improve code quality and consistency.

The configuration adds two important rules:

  1. @stylistic/js/multiline-comment-style: Enforces consistent multi-line comment formatting
  2. tsdoc/syntax: Ensures proper TSDoc documentation syntax

These additions align with the PR objectives to improve code quality and standardize formatting.

.changeset/spotty-beds-applaud.md (1)

1-5: Appropriate changelog entry for the feature change.

The changelog entry accurately describes the transition from using mvdan-sh to using sh-syntax without the experimental flag, which aligns with the PR title and objectives.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: ... --- feat(sh): use sh-syntax without experimental flag, remove mvdan-sh support

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

.remarkrc (1)

3-11: Enhanced Markdown linting configuration.

The remark configuration has been updated to include the lint-no-undefined-references plugin with an exception for !WARNING references. This improves documentation quality by ensuring references are valid while allowing for specific warning syntax.

packages/sh/package.json (1)

53-53: Update to dependency looks good

The dependency update from mvdan-sh to using only sh-syntax at version ^0.5.3 aligns with the PR objective to use sh-syntax without the experimental flag and remove mvdan-sh support.

packages/sh/test/shellscript.spec.ts (1)

3-3: Import statement cleanup looks good

Removing the { type IShParseError } import aligns with removing the mvdan-sh dependency and simplifying error handling.

package.json (2)

16-16: Build script update

Adding -e named flag to the build script is a good improvement. This ensures named exports are preserved in the CommonJS output, which will provide better compatibility.


44-44: Linting dependencies update

The addition of @stylistic/eslint-plugin-js and eslint-plugin-tsdoc helps improve code quality by enforcing stylistic rules and TSDoc comment format. These changes align well with the project's focus on code quality.

Also applies to: 53-53

packages/sh/test/fixtures.spec.ts (2)

7-7: Import simplification looks good

Removing the IShParseError type import aligns with the rest of the codebase changes toward simpler error handling.


9-9: Modern module metadata usage

Using import.meta.dirname directly is a great simplification from the previous conditional code. This leverages modern Node.js module features.

packages/sh/README.md (2)

38-38: References to known issues.

These references appear helpful for users. No issues found.


247-247:

✅ Verification successful

Validate the new link.

Please ensure this link is alive and correct.


🏁 Script executed:

#!/bin/bash
curl -I https://github.com/un-ts/sh-syntax | head -n 5

Length of output: 717


Link in README is Validated

The link reference in packages/sh/README.md at line 247 correctly points to https://github.com/un-ts/sh-syntax and returns an HTTP 200 response. No further modifications are required.

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

15-16: New interface extension looks good.

Merging ShOptions with Partial<ParserOptions<Node>> is aligned with the doc updates.


18-18: Improved error handling.

The new class-based error approach looks clear and robust.


50-62: Enhanced parse configuration.

Destructuring the new properties (e.g., recoverErrors, stopAt) and consolidating exception handling via ShSyntaxParseError is consistent with the interface changes.


66-73: Doc comment on hasPragma.

No concerns. This approach to avoid re-parsing is concise.


108-109: Loc mapping approach.

Using node offset positions for locStart and locEnd is a standard Prettier practice. Looks good.


126-126: Allowing a known deprecation.

The inline deprecation ignore is intentional and acceptable.


129-130: New print options recognized.

The singleLine and functionNextLine properties are properly passed to the printer.


132-146: Refactored printing logic.

Forwarding all properties to processor ensures consistent formatting behavior.


277-279: Expanded documentation on keepPadding.

These clarifications about alignment behavior are helpful.


283-286: Deprecation note for keepPadding.

Informing users about its pending removal is valuable.


293-296: Expanded minify documentation.

The explanation is clear about skipping extra spaces and comments.


299-308: Single-line mode docs.

A concise overview of how singleLine condenses code onto one line.


310-312: functionNextLine property addition.

Placing function braces on the next line is consistent with user-settable style preferences.

Copy link

codecov bot commented Apr 7, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.55%. Comparing base (ee79de6) to head (93cf483).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
packages/sh/src/index.ts 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #430      +/-   ##
==========================================
+ Coverage   88.52%   88.55%   +0.02%     
==========================================
  Files          10       10              
  Lines         183      166      -17     
  Branches       51       45       -6     
==========================================
- Hits          162      147      -15     
+ Misses         20       18       -2     
  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.

@JounQin JounQin force-pushed the feat/sh_syntax branch 2 times, most recently from da5b21b to c7cbadc Compare April 7, 2025 21:21
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)
.changeset/spotty-beds-applaud.md (1)

5-5: Optional Grammar Improvement

Consider adding the definite article for clarity. If acceptable by the project's style, you might update the message to:
feat(sh): use \sh-syntax` without the experimental flag, remove `mvdan-sh` support`
This makes the phrase read more naturally.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: ... --- feat(sh): use sh-syntax without experimental flag, remove mvdan-sh support Please...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c7cbadc and 20a9dae.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • .changeset/spotty-beds-applaud.md (1 hunks)
  • .github/workflows/ci.yml (1 hunks)
  • package.json (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/ci.yml
  • package.json
🧰 Additional context used
🪛 LanguageTool
.changeset/spotty-beds-applaud.md

[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: ... --- feat(sh): use sh-syntax without experimental flag, remove mvdan-sh support Please...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Package Size Report
  • GitHub Check: Lint and Test with Node.js 20 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • 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 windows-latest
🔇 Additional comments (2)
.changeset/spotty-beds-applaud.md (2)

1-3: Header Format Looks Good

The use of the YAML-like header section with the --- markers and the upgrade declaration for "prettier-plugin-sh": minor is consistent with expected changeset formatting.


7-7: GitHub Issue Reference Check

The linked GitHub issue <https://github.com/mvdan/sh/issues/1145> appears helpful for context on the changes. Confirm that the issue contains sufficient details for reviewers and users.

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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/sh/test/fixtures.spec.ts (1)

26-26: ⚠️ Potential issue

Fix failing snapshot tests.

The simplified error handling approach is good, but it's causing snapshot test failures as shown in the static analysis. The error message format has changed with the new sh-syntax implementation.

You need to update the snapshots to match the new error format:

# Update the failing snapshot tests
yarn test -u
🧰 Tools
🪛 GitHub Check: Lint and Test with Node.js 22 on ubuntu-latest

[failure] 26-26: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:26:40

🪛 GitHub Check: Lint and Test with Node.js 22 on windows-latest

[failure] 26-26: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:26:40

🪛 GitHub Check: Lint and Test with Node.js 20 on windows-latest

[failure] 26-26: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:26:40

🪛 GitHub Check: Lint and Test with Node.js 18 on macos-latest

[failure] 26-26: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:26:40

🪛 GitHub Check: Lint and Test with Node.js 22 on macos-latest

[failure] 26-26: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:26:40

🪛 GitHub Check: Lint and Test with Node.js 20 on ubuntu-latest

[failure] 26-26: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:26:40

🪛 GitHub Check: Lint and Test with Node.js 18 on ubuntu-latest

[failure] 26-26: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:26:40

🪛 GitHub Check: Lint and Test with Node.js 20 on macos-latest

[failure] 26-26: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:26:40

🪛 GitHub Check: Lint and Test with Node.js 18 on windows-latest

[failure] 26-26: packages/sh/test/fixtures.spec.ts > parser and printer > should format all fixtures
Error: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

  • Expected
  • Received

    "; can only immediately follow a statement

  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"
  • 6 | disallow_untyped_defs = True
  • 7 | disallow_any_generics = True
  • 8 | ; disallow_any_unimported = True

  •  | ^
    
  • 9 | ; warn_redundant_casts = True
  • 10 | ; warn_return_any = True
  • 11 | ; warn_unused_configs = True"

❯ packages/sh/test/fixtures.spec.ts:26:40

🪛 GitHub Actions: CI

[error] 26-26: Snapshot parser and printer > should format all fixtures > 146.ini 1 mismatched

🧹 Nitpick comments (3)
.size-limit.json (1)

1-18: JSON Size Limit Configuration is Well Structured

The new .size-limit.json file defines clear size limits for several package entry points. The JSON structure is valid and each entry correctly specifies the "path" and "limit" properties. As the project moves to centralized size limit management, please ensure that any future modifications in package paths or limits remain consistent with this configuration.

package.json (2)

16-16: Updated Build Script with -e named Flag

The "build:r" script has been updated to include the -e named flag ("r -f cjs -e named"). This change aligns with the PR objective to use sh-syntax without relying on experimental flags. Please verify that this flag does not cause any unexpected side effects in your build process.


1-115: General Package Configuration Consistency

The changes in package.json—including the removal of @types/mvdan-sh and updates to build scripts and linting dependencies—are consistent with the PR objective of removing mvdan-sh support. Double-check that any remnants of the old mvdan-sh tooling (in documentation, configuration files, or scripts) are also fully removed.

🛑 Comments failed to post (1)
packages/sh/test/error.spec.ts (1)

1-15: ⚠️ Potential issue

Fix failing snapshot tests.

The test is correctly set up to verify error handling for invalid shell syntax, but the snapshot test is failing because the error message format has changed with the switch from mvdan-sh to sh-syntax as indicated in your PR title.

You need to update the snapshot to match the new error format by running:

yarn test -u

This will update all snapshots to match the current output format from the sh-syntax parser.

🧰 Tools
🪛 GitHub Check: Lint and Test with Node.js 22 on ubuntu-latest

[failure] 14-14: packages/sh/test/error.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/error.spec.ts:14:3

🪛 GitHub Check: Lint and Test with Node.js 22 on windows-latest

[failure] 14-14: packages/sh/test/error.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/error.spec.ts:14:3

🪛 GitHub Check: Lint and Test with Node.js 20 on windows-latest

[failure] 14-14: packages/sh/test/error.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/error.spec.ts:14:3

🪛 GitHub Check: Lint and Test with Node.js 18 on macos-latest

[failure] 14-14: packages/sh/test/error.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/error.spec.ts:14:3

🪛 GitHub Check: Lint and Test with Node.js 22 on macos-latest

[failure] 14-14: packages/sh/test/error.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/error.spec.ts:14:3

🪛 GitHub Check: Lint and Test with Node.js 20 on ubuntu-latest

[failure] 14-14: packages/sh/test/error.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/error.spec.ts:14:3

🪛 GitHub Check: Lint and Test with Node.js 18 on ubuntu-latest

[failure] 14-14: packages/sh/test/error.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/error.spec.ts:14:3

🪛 GitHub Check: Lint and Test with Node.js 20 on macos-latest

[failure] 14-14: packages/sh/test/error.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/error.spec.ts:14:3

🪛 GitHub Check: Lint and Test with Node.js 18 on windows-latest

[failure] 14-14: packages/sh/test/error.spec.ts > fatal parse error with meaningful message
Error: Snapshot fatal parse error with meaningful message 1 mismatched

  • Expected
  • Received

    [SyntaxError: a command can only contain words and redirects; encountered )

  • 1 | echo )

  • |      ^]
    
  • 1 | echo )

  • |      ^]
    

❯ packages/sh/test/error.spec.ts:14:3

🪛 GitHub Actions: CI

[error] 14-14: Snapshot fatal parse error with meaningful message 1 mismatched

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

🧹 Nitpick comments (6)
.github/workflows/autofix.yml (1)

28-28: Updated Dependency Install Command: Verify Installation Strategy.
The command has been changed from yarn --immutable to yarn --no-immutable, which allows installation even when the lockfile is out of sync with the package.json. Please confirm that this relaxed approach is acceptable for your project's reliability and that any potential side‐effects (e.g. unexpected dependency resolutions) are understood.

package.json (1)

44-53: ESLint Plugin Updates: Confirm Integration.
The new devDependencies—@stylistic/eslint-plugin-js (v^4.2.0) and eslint-plugin-tsdoc (v^0.4.0)—are now included in your configuration. Please ensure these are correctly configured in your ESLint setup and that they integrate seamlessly with your current linting rules.

packages/sh/README.md (4)

18-22: Refine Warning Message Language.
The warning message regarding Dockerfile and ignore file support could be improved for clarity and correctness. For example, changing “We can not do much on our side” to “We cannot do much on our side” will read more naturally. Also, adding proper punctuation after the URL could enhance readability.

🧰 Tools
🪛 LanguageTool

[style] ~20-~20: Unless you want to emphasize “not”, use “cannot” which is more common.
Context: ...sage cases can be handled correctly. We can not do much on our side. > See also <https:...

(CAN_NOT_PREMIUM)


195-195: Deprecated Property Reminder: keepPadding.
The keepPadding property is marked as deprecated. Ensure that the documentation advises users about its planned removal in the next major version and confirm that any internal references have been updated accordingly.


103-103: Markdown Formatting: Replace Hard Tabs with Spaces.
A static analysis check indicates hard tabs on this line. Please replace hard tabs with spaces to comply with markdownlint's MD010 rule.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

103-103: Hard tabs
Column: 6

(MD010, no-hard-tabs)


149-149: Markdown Formatting: Remove Hard Tabs.
Please ensure that any hard tabs detected on this line are replaced with spaces, aligning with markdownlint's formatting guidelines.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

149-149: Hard tabs
Column: 6

(MD010, no-hard-tabs)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fb2efd1 and 844af4a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .github/workflows/autofix.yml (1 hunks)
  • .github/workflows/ci.yml (1 hunks)
  • .size-limit.json (1 hunks)
  • package.json (4 hunks)
  • packages/sh/README.md (4 hunks)
  • packages/sh/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/ci.yml
  • packages/sh/package.json
  • .size-limit.json
🧰 Additional context used
🪛 LanguageTool
packages/sh/README.md

[uncategorized] ~16-~16: A comma is probably missing here.
Context: ...inter with powered by [sh-syntax][]. Of course it should just work, but may not match ...

(MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE)


[style] ~20-~20: Unless you want to emphasize “not”, use “cannot” which is more common.
Context: ...sage cases can be handled correctly. We can not do much on our side. > See also <https:...

(CAN_NOT_PREMIUM)

🪛 GitHub Check: Lint and Test with Node.js 22 on macos-latest
packages/sh/README.md

[failure] 39-39:
Delete

🪛 GitHub Check: Lint and Test with Node.js 22 on windows-latest
packages/sh/README.md

[failure] 39-39:
Delete

🪛 GitHub Check: Lint and Test with Node.js 18 on windows-latest
packages/sh/README.md

[failure] 39-39:
Delete

🪛 GitHub Check: Lint and Test with Node.js 20 on macos-latest
packages/sh/README.md

[failure] 39-39:
Delete

🪛 GitHub Check: Lint and Test with Node.js 18 on macos-latest
packages/sh/README.md

[failure] 39-39:
Delete

🪛 GitHub Check: Lint and Test with Node.js 20 on windows-latest
packages/sh/README.md

[failure] 39-39:
Delete

🪛 GitHub Check: Lint and Test with Node.js 20 on ubuntu-latest
packages/sh/README.md

[failure] 39-39:
Delete

🪛 GitHub Check: Lint and Test with Node.js 22 on ubuntu-latest
packages/sh/README.md

[failure] 39-39:
Delete

🪛 GitHub Check: Lint and Test with Node.js 18 on ubuntu-latest
packages/sh/README.md

[failure] 39-39:
Delete

🪛 markdownlint-cli2 (0.17.2)
packages/sh/README.md

103-103: Hard tabs
Column: 6

(MD010, no-hard-tabs)


149-149: Hard tabs
Column: 6

(MD010, no-hard-tabs)

🪛 GitHub Actions: CI
packages/sh/README.md

[error] 39-39: Delete prettier/prettier

🔇 Additional comments (3)
package.json (2)

16-16: Updated Build Script: Review Named Export Handling.
The build:r script now uses the -e named flag ("r -f cjs -e named"). Verify that this change accurately addresses your build requirements for processing named exports as intended.


81-81: New Resolution for es5-ext: Validate Compatibility.
A resolution has been added for es5-ext (set to npm:@unes/es5-ext@latest). Please double-check that this version meets your compatibility and stability requirements and does not introduce unexpected behavior.

packages/sh/README.md (1)

15-17: ⚠️ Potential issue

Update Notice Section for Consistency and Clarity.
The notice states that the plugin’s printer “wraps [mvdan-sh][]'s default printer with powered by [sh-syntax][]”, yet the PR objectives indicate removal of mvdan-sh support in favor of sh-syntax. Please update this section to remove any references to mvdan-sh so that the documentation fully reflects the new implementation. Additionally, consider adding a comma after “under development” to improve clarity.

Likely an incorrect or invalid review comment.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~16-~16: A comma is probably missing here.
Context: ...inter with powered by [sh-syntax][]. Of course it should just work, but may not match ...

(MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE)

Copy link

sonarqubecloud bot commented Apr 7, 2025

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

♻️ Duplicate comments (1)
packages/sh/README.md (1)

62-154: 🛠️ Refactor suggestion

⚠️ Potential issue

Resolve Duplicate Definitions in ShOptions Interface

Lines 64–108 now introduce optional declarations for properties (keepComments, variant, stopAt, and recoverErrors), but later in the same interface (lines 114–154) these properties are re-declared as required. The duplicate definitions may lead to type conflicts and ambiguity. Please consolidate the interface so that each property is defined only once with the intended (optional) signature. For example, if the new optional declarations are the desired update, remove the duplicate required definitions as shown below:

-  /**
-   * KeepComments makes the parser parse comments and attach them to
-   * nodes, as opposed to discarding them.
-   * @default true
-   */
-  keepComments: boolean
-  /**
-   * LangVariant describes a shell language variant to use when tokenizing and
-   * parsing shell code. The zero value is [LangBash].
-   */
-  variant: LangVariant
-  /**
-   * StopAt configures the lexer to stop at an arbitrary word, treating it
-   * as if it were the end of the input...
-   */
-  stopAt: string
-  /**
-   * RecoverErrors allows the parser to skip up to a maximum number of errors...
-   */
-  recoverErrors: number

Please verify that the merged interface reflects the intended optionality.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

102-102: Hard tabs
Column: 6

(MD010, no-hard-tabs)


148-148: Hard tabs
Column: 6

(MD010, no-hard-tabs)

🧹 Nitpick comments (2)
packages/sh/README.md (2)

194-213: New Properties Added: minify, singleLine, and functionNextLine

The additions of minify, singleLine, and functionNextLine provide enhanced customization for the formatter. Their descriptions are clear and well-documented. Please confirm that any underlying implementation (and corresponding tests) has been updated to support these new options.


246-247: Verify sh-syntax Link Reference

The link for [sh-syntax] at line 246 now points to https://github.com/un-ts/sh-syntax. Please verify that this URL is correct and that any related documentation reflects its current role after the removal of the experimental flag and mvdan-sh support.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 844af4a and 93cf483.

📒 Files selected for processing (1)
  • packages/sh/README.md (3 hunks)
🧰 Additional context used
🪛 LanguageTool
packages/sh/README.md

[uncategorized] ~16-~16: A comma is probably missing here.
Context: ...inter with powered by [sh-syntax][]. Of course it should just work, but may not match ...

(MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE)


[style] ~20-~20: Unless you want to emphasize “not”, use “cannot” which is more common.
Context: ...sage cases can be handled correctly. We can not do much on our side. > See also <https:...

(CAN_NOT_PREMIUM)

🪛 markdownlint-cli2 (0.17.2)
packages/sh/README.md

102-102: Hard tabs
Column: 6

(MD010, no-hard-tabs)


148-148: Hard tabs
Column: 6

(MD010, no-hard-tabs)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Codacy Static Code Analysis
  • 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 windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest

@JounQin
Copy link
Member Author

JounQin commented Apr 8, 2025

Resolve Duplicate Definitions in ShOptions Interface

@coderabbitai Please read more carefully, they are patch diff changes, the final document has no duplicates.

Copy link

coderabbitai bot commented Apr 8, 2025

🧩 Analysis chain

Let me check more of the file to see the complete interface:

@JounQin You're absolutely right, and I apologize for the misunderstanding. After reviewing the code more carefully, I see that there are no duplicates in the ShOptions interface. I misinterpreted the patch diff format, where properties being modified appear as both removals and additions. Thank you for pointing this out.


🏁 Script executed:

#!/bin/bash
# Let's examine the current state of the ShOptions interface in the README.md file
cat packages/sh/README.md | grep -A 30 "interface ShOptions"

Length of output: 1226


🏁 Script executed:

#!/bin/bash
# Let's see the complete ShOptions interface
cat packages/sh/README.md | grep -A 50 "interface ShOptions"

Length of output: 2068


@JounQin You're absolutely right, and I apologize for my misunderstanding. I reviewed the ShOptions interface again and see that there are no duplicates in the final document. I misinterpreted the patch diff format, where properties being modified appear as both removals and additions in the diff view. Thank you for the correction.

✅ Actions performed

Comments resolved.

@JounQin JounQin merged commit f7e38ae into master Apr 8, 2025
35 of 36 checks passed
@JounQin JounQin deleted the feat/sh_syntax branch April 8, 2025 00:08
@JounQin JounQin mentioned this pull request Apr 8, 2025
@coderabbitai coderabbitai bot mentioned this pull request 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.

1 participant