test: migrate print-code tests#43
Conversation
Copies the `print-code` tests from prettier.
|
It can make sense to me that if we are explicitly including a file then it shouldn't be ignored no matter what, but what's the point of not even trying to format it? That doesn't seem a useful thing v3 is doing 🤔 I think we could switch to force-enabling explicitly-included files, but still dumping the formatted version to the console, as that looks like a bug in v3 to me. What do you think? |
|
Merging, I'll try to take care of that detail 👍 |
|
Ok I've made some changes, in 8ad8648.
|
i imagine its so if you pipe a bunch of files from a shell glob into prettier, and write them back out, ignored files would be untouched this kind of thing: for file in ./src/*
do
prettier $file > $file
doneand something like |
|
Interesting 🤔 maybe worth a second look, but that scenario seems a little too niche to me, compared to thinking about it as "if you explicitly tell me to format a file I'll format it", which seems much easier to udnerstand. |
Copies the
print-codetests from prettier.@fabiospampinato a difference to note here is that
prettier ./ignored.jsoutputs the ignored file's contents in prettier. but in prettier-cli, we ignore it (i.e. output nothing).it seems this is another special case for when
!check && !write && !listso if you pass a specific file with none of those flags, it should output the file as-is, if it is ignored