You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When prettier is used programmatically and throws an exception, this exception contains color codes, On Windows, if it isn't caught, the exception outputs in such a way that the color codes make it to the screen, so it looks like this:
d:\dev\asdf\node_modules\prettier\index.js:23135
throw error;
^
SyntaxError: Invalid character. (1:8)
←[0m←[31m←[1m>←[22m←[39m←[90m 1 | ←[39mlodash ←[33m#←[39m(x as number )←[0m
←[0m ←[90m | ←[39m ←[31m←[1m^←[22m←[39m←[0m
at createError (d:\dev\asdf\node_modules\prettier\parser-typescript.js:1:194)
at.parser [as parse] (d:\dev\asdf\simple.js:7:19)
...
I found that I can pass the --no-color command line argument to my program to turn off those codes, but I'd like to hard code it somehow, and I didn't find a good way to do it.
It even might make sense to disable colors by default and only enable them when prettier is used from CLI.
The text was updated successfully, but these errors were encountered:
You might be able to set the environment variable FORCE_COLOR=0 before require():ing anything. See: https://github.com/chalk/supports-color#info. Pretty ugly solution, but it might get you unblocked for now :)
When prettier is used programmatically and throws an exception, this exception contains color codes, On Windows, if it isn't caught, the exception outputs in such a way that the color codes make it to the screen, so it looks like this:
I found that I can pass the
--no-color
command line argument to my program to turn off those codes, but I'd like to hard code it somehow, and I didn't find a good way to do it.It even might make sense to disable colors by default and only enable them when prettier is used from CLI.
The text was updated successfully, but these errors were encountered: