Skip to content

feat: add new LangVariant option LangAuto although it's unsupported #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 7, 2025

Conversation

JounQin
Copy link
Member

@JounQin JounQin commented Apr 7, 2025

Summary by CodeRabbit

  • New Features
    • Introduced additional shell language variants, including an experimental auto-detection option.
  • Chores
    • Enhanced linting configurations to enforce a consistent multiline comment style.
    • Updated build scripts and integrated new development tooling.
  • Documentation
    • Expanded and clarified documentation for language variants and configuration options for shell parsing and printing.

@JounQin JounQin requested a review from Copilot April 7, 2025 16:06
Copy link

changeset-bot bot commented Apr 7, 2025

🦋 Changeset detected

Latest commit: 06ff81e

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

This PR includes changesets to release 1 package
Name Type
sh-syntax 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
Contributor

coderabbitai bot commented Apr 7, 2025

Walkthrough

This pull request introduces several codebase updates and documentation improvements. A new language variant option, LangAuto, along with additional variants (LangBash, LangPOSIX, LangMirBSDKorn, LangBats), has been added and documented. The ESLint configuration is extended by importing stylisticJs and enforcing a multiline comment rule. The build script in the package.json has been modified to adjust the TypeScript compilation process and a new dev dependency has been added. Minor changes in src/processor.ts update comments and include an ESLint directive, while extensive documentation updates enhance the parser and printer interfaces.

Changes

File(s) Change Summary
.changeset/gentle-pets-prove.md, src/types.ts Added new language variants including LangAuto, LangBash, LangPOSIX, LangMirBSDKorn, and LangBats; introduced detailed documentation for these and for the parser/printer options.
eslint.config.js Imported stylisticJs from @stylistic/eslint-plugin-js and added a configuration with a plugin and rule enforcing a starred-block style for multiline comments.
package.json Modified the build:tsc script to change TypeScript’s compilation behavior and added @stylistic/eslint-plugin-js (v^4.2.0) to devDependencies.
src/processor.ts Updated inline comments: replaced them with a structured block comment and added an ESLint disable directive on the keepPadding parameter.

Possibly related PRs

Poem

I'm just a bunny with a coder's beat,
Hopping through changes, light on my feet.
With new language variants and rules anew,
My whiskers twitch as I inspect each clue.
Celebrating code with a joyful "peep!" 🐰

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.

eslint.config.js

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)

src/types.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)

src/processor.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

🪧 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

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
Contributor

github-actions bot commented Apr 7, 2025

size-limit report 📦

Path Size
lib/browser.js 121 B (0%)
lib/index.js 378 B (0%)

Copy link
Contributor

@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 4 out of 5 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • package.json: Language not supported

Copy link

pkg-pr-new bot commented Apr 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/sh-syntax@107

commit: 06ff81e

Copy link

socket-security bot commented Apr 7, 2025

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: npm/[email protected]

View full report↗︎

@JounQin JounQin changed the title feat: add new LangAuto LangVariant although it's unsupported feat: add new LangVariant option LangAuto although it's unsupported Apr 7, 2025
Copy link
Contributor

github-actions bot commented Apr 7, 2025

📊 Package size report   0.8%↑

File Before After
lib/index.cjs 6.7 kB 21%↑8.1 kB
lib/types.d.ts 1.8 kB 280%↑7.0 kB
lib/types.js 140 B 12%↑157 B
lib/types.js.map 223 B 9%↑243 B
package.json 3.5 kB 4%↑3.6 kB
Total (Includes all files) 827.8 kB 0.8%↑834.5 kB
Tarball size 303.5 kB 0.8%↑306.0 kB
Unchanged files
File Size
index.d.cts 62 B
lib/browser.d.ts 95 B
lib/browser.js 130 B
lib/browser.js.map 171 B
lib/index.d.ts 709 B
lib/index.js 818 B
lib/index.js.map 950 B
lib/processor.d.ts 707 B
lib/processor.js 3.3 kB
lib/processor.js.map 3.5 kB
lib/shim.d.ts 11 B
lib/shim.js 279 B
lib/shim.js.map 342 B
LICENSE 1.1 kB
main.wasm 780.1 kB
README.md 7.1 kB
vendors/wasm_exec.cjs 16.0 kB
vendors/wasm_exec.d.cts 98 B

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

Copy link

codecov bot commented Apr 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.25%. Comparing base (acfca8e) to head (06ff81e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #107   +/-   ##
=======================================
  Coverage   96.25%   96.25%           
=======================================
  Files           4        4           
  Lines          80       80           
  Branches       32       32           
=======================================
  Hits           77       77           
  Misses          3        3           

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

Co-authored-by: Copilot <[email protected]>
Copy link

sonarqubecloud bot commented Apr 7, 2025

Copy link
Contributor

@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)
package.json (1)

52-52: Modified TypeScript build process.

The build:tsc script has been updated to separate the compilation process into two steps: first compiling without declarations, then generating only the declarations without removing comments. This appears to be related to the GitHub issue mentioned in a previous review.

🧹 Nitpick comments (2)
src/types.ts (2)

39-46: Clarify "[Variant]" in the documentation

The comment "At this time, [Variant] does not support LangAuto" is unclear about what "[Variant]" refers to. It would be more helpful to specify exactly which component or function doesn't support this option.

-   * At this time, [Variant] does not support LangAuto.
+   * At this time, the parser/interpreter does not support LangAuto.

152-153: Inconsistent comment style

All other properties use JSDoc-style comments (/**...*/), but this property uses a single-line comment (//). For consistency, consider using the same JSDoc style as the other properties.

-  // FunctionNextLine will place a function's opening braces on the next line.
+  /**
+   * FunctionNextLine will place a function's opening braces on the next line.
+   */
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between acfca8e and 06ff81e.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • .changeset/gentle-pets-prove.md (1 hunks)
  • eslint.config.js (1 hunks)
  • package.json (2 hunks)
  • src/processor.ts (2 hunks)
  • src/types.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • 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 18 on windows-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: Codacy Static Code Analysis
🔇 Additional comments (9)
.changeset/gentle-pets-prove.md (1)

1-6: LGTM - The changeset file is correctly structured.

The changeset file properly documents the new feature and follows the expected format for a patch release. It clearly indicates that a new LangVariant option called LangAuto is being added, while noting it's unsupported.

src/processor.ts (2)

94-95: Appropriate ESLint directive for deprecated parameter.

The ESLint directive is correctly added to suppress deprecation warnings for the keepPadding parameter, which aligns with its deprecated status in the codebase.


122-126: Improved comment formatting.

The previously inline comment has been properly converted to a starred block comment, providing better readability while maintaining the same explanation about not awaiting the Go runtime promise.

eslint.config.js (2)

2-2: LGTM - New ESLint plugin imported.

The stylistic plugin is correctly imported and will help enforce consistent code style.


9-16: New ESLint configuration for multiline comments.

The new configuration properly sets up the stylistic plugin and enforces the starred-block style for multiline comments, which aligns with the comment formatting changes in the codebase.

package.json (1)

74-74: Added ESLint stylistic plugin dependency.

The addition of @stylistic/eslint-plugin-js as a development dependency aligns with the ESLint configuration changes to enforce consistent multiline comment formatting.

src/types.ts (3)

4-46: Good documentation for language variants

The detailed documentation for all language variants is excellent. Each variant now has a clear description, information about its string representation, and version details where applicable. The new LangAuto option is properly documented with a note about its current limitations.


52-96: Well-documented parser options

The comprehensive documentation for the ShParserOptions interface properties significantly improves code understandability. The examples provided for stopAt and recoverErrors are particularly helpful for developers using this library.


100-151: Clear documentation for printer options

The detailed explanations for all printer options make the API much more user-friendly. The deprecation notice for keepPadding is also well-documented with information about when it will be removed and a reference to the relevant issue.

@JounQin
Copy link
Member Author

JounQin commented Apr 7, 2025

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.

@coderabbitai Didn't I tell you that this repo uses yarn v4? It's totally fine, please stop comment for this afterwards and for new PRs.

Copy link
Contributor

coderabbitai bot commented Apr 7, 2025

Tip

For best results, initiate chat on the files or code changes.

@JounQin Yes, you're right - I have a stored learning that this repository uses Yarn v4.8.1 and that dependency warnings related to the package structure should be ignored as false positives. I apologize for the redundant comment. I'll ensure I don't comment on these package management issues for this PR and future PRs.


🧠 Learnings used
Learnt from: JounQin
PR: un-ts/sh-syntax#0
File: :0-0
Timestamp: 2025-04-07T10:27:22.040Z
Learning: The sh-syntax project uses Yarn v4.8.1 for package management, and dependency warnings related to the package structure should be ignored as false positives.

@JounQin JounQin merged commit 3152cd3 into main Apr 7, 2025
38 checks passed
@JounQin JounQin deleted the feat/LangAuto branch April 7, 2025 16:26
@github-actions github-actions bot mentioned this pull request Apr 7, 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