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

.prettierignore displays no output when running on ignored file breaking editor integrations #3590

Closed
mitermayer opened this issue Dec 27, 2017 · 6 comments
Assignees
Labels
area:cli Issues with Prettier's Command Line Interface locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Milestone

Comments

@mitermayer
Copy link
Member

This may seem at first glance the ideal behaviour, when trying to run the prettie CLI on an ignored file. However for editor integrations such as vim-prettier where it does not have any knowledge about the ignored files from .prettierignore it means it will then wipe all the contents of the ignored file.

see prettier/vim-prettier#92

Would be great if there was an option or any other way to simply print the ignored file as it is instead of just having an empty stdout, other valid options would be display an error or warning message.

@ikatyang, @azz, @suchipi please let me know what are your thoughts around it, happy to submit a PR for this

@mitermayer mitermayer changed the title .prettierignore displays no output when running on ignore file .prettierignore displays no output when running on ignored file breaking editor integrations Dec 27, 2017
@duailibe duailibe added area:cli Issues with Prettier's Command Line Interface type:enhancement A potential new feature to be added, or an improvement to how we print something labels Dec 27, 2017
@duailibe
Copy link
Member

Sounds reasonable to me to warn if the use passed a specific path (i.e. not a glob) of an ignored file

@ikatyang
Copy link
Member

I think adding a warning (only when --stdin-filepath applied) for it should be better, but I'm not sure if it can fix your case since IIRC you seem to use --loglevel silent for vim-prettier?

@azz
Copy link
Member

azz commented Dec 28, 2017

This sounds like a bug.

echo "foo()" > foo.js
echo "foo.js" > .prettierignore
prettier --stdin-filepath=foo.js < foo.js

Should output the contents of foo.js.

Edit: Not limited to stdin.

echo "foo()" > foo.js
echo "foo.js" > .prettierignore
prettier foo.js

Maybe this should output foo.js untouched too?

@azz azz added type:bug Issues identifying ugly output, or a defect in the program and removed type:enhancement A potential new feature to be added, or an improvement to how we print something labels Dec 28, 2017
@azz
Copy link
Member

azz commented Dec 28, 2017

So basically we want two modes:

  • With --write, don't read or write to the ignored file
  • Without --write, read the ignored file and output as-is.

@azz azz added the help wanted We're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue! label Dec 28, 2017
@mitermayer
Copy link
Member Author

@azz I really like your approach!

I think Without --write, read the ignored file and output as-is. is exactly what we need for vim-prettier

@duailibe duailibe removed the help wanted We're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue! label Dec 31, 2017
@duailibe duailibe self-assigned this Dec 31, 2017
@ikatyang ikatyang added the status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! label Dec 31, 2017
@azz azz added this to the 1.10 milestone Jan 7, 2018
@hsribei
Copy link

hsribei commented May 29, 2018

Thank you all for this! <3

@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Aug 27, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:cli Issues with Prettier's Command Line Interface locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

5 participants