Skip to content

Conversation

@outslept
Copy link
Contributor

@outslept outslept commented Jul 10, 2025

replaced get-stdin with node api & removed camelcase-keys as it has 0 usage across the repo

about get-stdin: e18e/ecosystem-issues#159

p.s. cli tests hang on my machine and then fail after the timeout, I think the problem is in the environment on my part (although I don't know what exactly happened), so I pushed through --no-verify


Important

Replace get-stdin with Node.js API and remove unused camelcase-keys package.

  • Dependencies:
    • Replace get-stdin with node:stream/consumers in src/format-files.js and src/format-files.spec.js.
    • Remove camelcase-keys from package.json as it is unused.
  • Functionality:
    • Update formatStdin() in src/format-files.js to use text(process.stdin) instead of getStdin().
  • Testing:
    • Update tests in src/format-files.spec.js to mock text from node:stream/consumers instead of get-stdin.
  • Contributors:
    • Add "outslept" to .all-contributorsrc and README.md.

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

Summary by CodeRabbit

  • Chores

    • Added "outslept" to the contributors list and README.
    • Removed unused dependencies from the project.
  • Refactor

    • Improved standard input reading by using a native Node.js function.
  • Tests

    • Updated tests to support the new standard input handling method.
    • Added tests verifying behavior for TTY and non-TTY standard input scenarios.

@changeset-bot
Copy link

changeset-bot bot commented Jul 10, 2025

🦋 Changeset detected

Latest commit: af05524

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

This PR includes changesets to release 1 package
Name Type
prettier-eslint-cli 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

@coderabbitai
Copy link

coderabbitai bot commented Jul 10, 2025

Walkthrough

The changes add a new contributor ("outslept") to both the contributors configuration and the README. The codebase removes the camelcase-keys and get-stdin dependencies. Standard input handling is refactored in the code and tests to use Node.js's native stream/consumers module instead of get-stdin.

Changes

Files/Paths Change Summary
.all-contributorsrc, README.md Added "outslept" as a contributor with avatar and links.
package.json Removed camelcase-keys and get-stdin from dependencies.
src/format-files.js Replaced get-stdin with Node.js stream/consumers.text for reading stdin, added conditional logic.
src/format-files.spec.js Updated tests to mock and use stream/consumers.text instead of get-stdin; added TTY behavior tests.

Suggested labels

dependencies

Poem

🐇
A bunny hops with nimble grace,
Welcomes "outslept" to the codebase!
Old dependencies hop away,
Native streams now lead the way.
Contributors grow, the project thrives—
With every change, the spirit survives!
🌱✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 256ceed and af05524.

📒 Files selected for processing (1)
  • src/format-files.spec.js (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/format-files.spec.js
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 10, 2025

This pull request is automatically built and testable in CodeSandbox.

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

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to a0bd63a in 2 minutes and 24 seconds. Click for details.
  • Reviewed 136 lines of code in 5 files
  • Skipped 1 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .all-contributorsrc:288
  • Draft comment:
    New contributor added ('outslept'). Ensure that the contributor’s fields (login, avatar_url, etc.) stay consistent with the project guidelines.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the PR author to ensure consistency with project guidelines, which is similar to asking them to double-check or verify something. It doesn't provide a specific suggestion or point out a specific issue with the code. Therefore, it violates the rules.
2. README.md:289
  • Draft comment:
    Contributor table row added for 'outslept' looks consistent. Double-check the avatar URL and links for correctness.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the PR author to double-check the avatar URL and links, which violates the rule against asking for confirmation or double-checking. It doesn't provide a specific suggestion or point out a clear issue.
3. package.json:52
  • Draft comment:
    Removed unused dependencies (camelcase-keys and get-stdin). This cleanup is good—verify that no indirect usage remains.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify that no indirect usage remains, which violates the rule against asking for confirmation or verification. The first part of the comment is purely informative, which is also against the rules.
4. src/format-files.js:3
  • Draft comment:
    Replaced the get-stdin import with node’s stream consumer API. Using text(process.stdin) is cleaner and removes an extra dependency.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining the change made in the code. It does not provide a suggestion, ask for confirmation, or point out a potential issue. According to the rules, purely informative comments should be removed.
5. src/format-files.spec.js:3
  • Draft comment:
    Updated tests to mock the new text method from 'node:stream/consumers'. The changes correctly simulate stdin input; ensure that error cases (e.g. read failures) are also covered in tests if needed.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_bKnVQCaJJWWT9ziJ

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

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 (2)
.all-contributorsrc (1)

291-299: Remember to bump the contributors-count badge in the README.

A new contributor object is correctly added here, but the badge at the top of README.md still shows all_contributors-21.
Please increment that value to 22 to keep the badge in sync.

README.md (1)

290-292: Keep badge and list in sync after adding a new contributor.

Great to see the new table row!
However, the badge declared earlier in the file still reads all_contributors-21, which will be misleading once this PR is merged.

- [![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors)
+ [![All Contributors](https://img.shields.io/badge/all_contributors-22-orange.svg?style=flat-square)](#contributors)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6fc9e18 and a0bd63a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • .all-contributorsrc (1 hunks)
  • README.md (1 hunks)
  • package.json (0 hunks)
  • src/format-files.js (2 hunks)
  • src/format-files.spec.js (4 hunks)
💤 Files with no reviewable changes (1)
  • package.json
🔇 Additional comments (4)
src/format-files.js (2)

3-3: Good modernization using native Node.js API.

The import change from get-stdin to the native stream/consumers module is appropriate and eliminates an external dependency.


92-92: No Node.js compatibility issues

The project’s package.json specifies "node": "^18.18.0 || ^20.9.0 || >=21.1.0" and .nvmrc is set to 22.15.0, so using stream/consumers (introduced in Node.js 16.7.0) poses no breaking change.

src/format-files.spec.js (2)

3-3: Test mocking correctly updated for the new API.

The mock setup properly replaces the get-stdin mock with the native text function mock, maintaining test coverage.

Also applies to: 17-21


75-76: Test cases properly updated for the new mock.

The test implementations correctly use mockText.mockResolvedValue() instead of the old mockGetStdin.stdin approach, maintaining the same test logic while adapting to the new API.

Also applies to: 81-81, 94-94

@outslept
Copy link
Contributor Author

Oopsie, there is a check missing. Fixing it

The text() function uses or await (const chunk of stream)
which will wait indefinitely for chunks when stdin is a TTY.
get-stdin included TTY detection to return empty string immediately
for terminal contexts. Added the same TTY check to maintain compatibility.
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)
src/format-files.js (1)

94-96: Fix redundant assignment.

The assignment stdinValue = ''; on line 95 is redundant since stdinValue is already initialized to an empty string on line 92.

  if (process.stdin.isTTY) {
-    stdinValue = '';
+    // stdin is a TTY, no piped input available
  } else {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a0bd63a and c57c98a.

📒 Files selected for processing (1)
  • src/format-files.js (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/format-files.js (1)
src/index.js (1)
  • logger (11-11)
🪛 ESLint
src/format-files.js

[error] 95-95: Review this redundant assignment: "stdinValue" already holds the assigned value along all execution paths.

(sonarjs/no-redundant-assignments)

🔇 Additional comments (3)
src/format-files.js (3)

3-3: Good modernization by using native Node.js API.

Replacing the get-stdin package with Node.js native stream/consumers reduces external dependencies and is a good improvement.


97-108: Excellent error handling implementation.

The try/catch block around text(process.stdin) properly addresses the previous review comment about error handling. The implementation correctly:

  • Handles potential errors during stdin reading
  • Logs errors with appropriate context
  • Sets the exit code
  • Returns early with an empty string on error

This is a robust implementation that follows the existing error handling patterns in the codebase.


91-109: Confirmed Node.js Compatibility

The project’s engines.node setting is ^18.18.0 || ^20.9.0 || >=21.1.0, which comfortably exceeds the v16.7.0 requirement for using node:stream/consumers. No changes needed.

@outslept
Copy link
Contributor Author

outslept commented Jul 10, 2025

CLI test return empty stdout/stderr locally on my machine. Process spawns successfully but produces no output. Likely environment-specific issue either only on my end or is platform specific.

Primary OS is Windows 10 with WSL (Ubuntu / Arch) - getting failures on this specific test on all environments. Not sure how to debug further, will be happy if you can suggest ways to deal with this.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jul 10, 2025

Open in StackBlitz

npm i https://pkg.pr.new/prettier-eslint-cli@465

commit: af05524

@JounQin
Copy link
Member

JounQin commented Jul 10, 2025

@outslept Thanks for your contribution first, while CI is broken.

@outslept
Copy link
Contributor Author

outslept commented Jul 10, 2025

@outslept Thanks for your contribution first, while CI is broken.

Resolved linter's warning

@outslept outslept requested a review from JounQin July 10, 2025 15:26
@outslept
Copy link
Contributor Author

outslept commented Jul 10, 2025

I believe this is it, apologize a million times for any inconvenience during the review, but CLI test really stops me :(

@JounQin JounQin merged commit 9fb86bc into prettier:master Jul 10, 2025
9 checks passed
@outslept outslept deleted the replace-dep branch July 10, 2025 17:00
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.

2 participants