Skip to content
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

Allow --debug-check to work with stdin #2013

Merged
merged 2 commits into from
Jun 6, 2017

Conversation

josephfrazier
Copy link
Collaborator

This makes it easier to quickly test formatting code snippets with e.g.

pbpaste | prettier --debug-check

Before, the following would happen:

$ pbpaste | prettier --debug-check
stdin: TypeError: Invalid data, chunk must be a string or buffer, not undefined
    at WriteStream.Socket.write (net.js:693:11)
    at writeOutput (/Users/josephfrazier/workspace/prettier/bin/prettier.js:375:18)
    at getStdin.then.input (/Users/josephfrazier/workspace/prettier/bin/prettier.js:275:7)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)
$

Now, it looks like this:

$ pbpaste | prettier --debug-check
(stdin)
$

This makes it easier to quickly test formatting code snippets with e.g.

    pbpaste | prettier --debug-check

Before, the following would happen:

    $ pbpaste | prettier --debug-check
    stdin: TypeError: Invalid data, chunk must be a string or buffer, not undefined
        at WriteStream.Socket.write (net.js:693:11)
        at writeOutput (/Users/josephfrazier/workspace/prettier/bin/prettier.js:375:18)
        at getStdin.then.input (/Users/josephfrazier/workspace/prettier/bin/prettier.js:275:7)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:169:7)
    $

Now, it looks like this:

    $ pbpaste | prettier --debug-check
    (stdin)
    $
@@ -280,7 +280,7 @@ if (stdin) {
});
} else {
eachFilename(filepatterns, filename => {
if (write || argv["debug-check"]) {
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this? It's useful to know which file the debug check failed on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The filename still gets printed out here. I just now added a test ensuring this: 2b4c09d

@vjeux vjeux merged commit 552ceb3 into prettier:master Jun 6, 2017
@josephfrazier josephfrazier deleted the debug-check-stdin branch June 6, 2017 23:12
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 20, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants