-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add new options recoverErrors and singleLine support
#104
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
Conversation
🦋 Changeset detectedLatest commit: 0da3d81 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
WalkthroughThe pull request introduces two new options— Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant TS as getProcessor (TS)
participant GO as process (Go)
participant Parser as Parse (Go)
participant Printer as Print (Go)
Client->>TS: Call getProcessor(recoverErrors, singleLine, variant)
TS->>GO: Invoke process(..., recoverErrors, singleLine, ...)
GO->>Parser: Parse(text, options {RecoverErrors})
GO->>Printer: Print(text, options {SingleLine})
Parser-->>GO: Return parsed file or error
Printer-->>GO: Return formatted text or error
GO-->>TS: Return processed result
TS-->>Client: Return final output
Poem
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
src/processor.tsOops! Something went wrong! :( ESLint: 9.24.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.js 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧬 Code Definitions (1)processor/main.go (2)
⏰ Context from checks skipped due to timeout of 90000ms (7)
🔇 Additional comments (11)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
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. |
|
size-limit report 📦
|
commit: |
📊 Package size report 0.1%↑
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #104 +/- ##
==========================================
+ Coverage 96.15% 96.25% +0.09%
==========================================
Files 4 4
Lines 78 80 +2
Branches 30 32 +2
==========================================
+ Hits 75 77 +2
Misses 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
main.wasmis excluded by!**/*.wasm
📒 Files selected for processing (6)
.changeset/ninety-rings-guess.md(1 hunks)main.go(3 hunks)processor/main.go(4 hunks)processor/structs.go(4 hunks)src/processor.ts(4 hunks)src/types.ts(2 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
processor/main.go (1)
src/types.ts (2)
LangVariant(3-8)LangVariant(10-10)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- 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: 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 (14)
.changeset/ninety-rings-guess.md (1)
1-5: LGTM, good documentation of new features.The changeset entry correctly documents the addition of the two new options:
recoverErrorsandsingleLine. This follows best practices for changelog management.src/types.ts (2)
15-16: Interface updates look good.The
ShParserOptionsinterface has been correctly extended with thestopAtandrecoverErrorsoptions, following the existing pattern for optional properties.
26-26: Interface addition is well structured.The
singleLineoption is properly added to theShPrinterOptionsinterface with the correct type and optional modifier.src/processor.ts (3)
57-59: Parameter additions look good.The
stopAtandrecoverErrorsparameters are correctly added with appropriate default values.
68-69: New singleLine option is well implemented.The
singleLineparameter is correctly added with a default value offalse.
115-120: Parameter handling improved.The refactoring of how
variantis passed to theprocessfunction eliminates redundancy, and the new parameters are correctly passed through to the underlying implementation.Also applies to: 157-161, 169-170
main.go (4)
63-64: Parameter order change and new parameter addition.The function signature has been modified to add
recoverErrors intparameter afterstopAt []byte. The parameter order change ensures consistency with the order in theParserOptionsstruct. This matches the changes inprocessor/main.gowhereRecoverErrorsfield was added to theParserOptionsstruct.
73-73: New option added: singleLine boolean parameter.The
singleLineparameter has been added beforefunctionNextLine, properly aligned with other boolean formatting options. This matches the changes inprocessor/main.gowhereSingleLinefield was added to thePrinterOptionsstruct.
79-84: Updated ParserOptions initialization with new RecoverErrors field.The
parserOptionsstruct initialization has been updated to include the newRecoverErrorsfield, passing the value from the function parameter. The structure remains clean and well-organized.
97-97: Added SingleLine configuration to printerOptions.The
SingleLinefield is now properly initialized with thesingleLineparameter value. This completes the implementation of the new formatting option.processor/main.go (4)
15-20: Updated ParserOptions struct with new RecoverErrors field.The
ParserOptionsstruct has been updated to include a newRecoverErrors intfield. The field ordering is logical with related fields grouped together. This change aligns with thesyntax.RecoverErrorsfunctionality from the mvdan.cc/sh/v3/syntax package.
29-29: Added SingleLine option to PrinterOptions struct.The new
SingleLine boolfield has been added to thePrinterOptionsstruct. This provides control over single-line output formatting in the shell syntax printer.
47-49: Implemented conditional application of RecoverErrors option.The implementation conditionally applies the
RecoverErrorsoption only when the value is non-zero, which is a good practice. This provides flexibility to control the error recovery behavior during parsing.
70-70: Applied SingleLine option in printer configuration.The
SingleLineoption is now properly passed to the underlying syntax printer. This completes the implementation chain from the public API through to the actual syntax printer configuration.
|
@coderabbitai generate docstrings |
✅ Actions performedDocstrings generation started. |
Docstrings generation was requested by @JounQin. * #104 (comment) The following files were modified: * `main.go` * `processor/main.go` * `processor/structs.go` * `src/processor.ts`
|
Note Generated docstrings for this pull request at #105 |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: JounQin <admin@1stg.me>
|
@coderabbitai This project uses |
🧩 Analysis chain🏁 Script executed: Length of output: 4280 🏁 Script executed: Length of output: 2893 @JounQin Thank you for the clarification. I understand this project uses Yarn v4.8.1, and the dependencies are properly configured. I can see the docstrings were successfully generated and committed in PR #105, so the dependency warning was indeed a false positive. Is there anything else you need help with regarding the new ✏️ Learnings added
✅ Actions performedComments resolved. |



Summary by CodeRabbit
recoverErrorsandsingleLinehave been added to enhance functionality.