How to use prettier with editorconfig in project.yml task ? #358
-
As a work around, I can repeat all the relevant Recommendations to make it jive with moon better? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@tomdavidson Looks like prettier doesn't support a CLI option to the .editorconfig file and probably assumes it exists in the current working directory. https://prettier.io/docs/en/cli.html I think your best option here is to always run prettier from the workspace root, instead of in each project. https://moonrepo.dev/docs/config/project#runfromworkspaceroot |
Beta Was this translation helpful? Give feedback.
-
Answer: Do not use the Thanks @milesj I just learned that prettier will find the project root in search of the config file and .editorconfig - resolve-config-editorconfig.js - which must be why I haven't ran into this before. If I do not provide the argument to the task, i.e. remove |
Beta Was this translation helpful? Give feedback.
Answer: Do not use the
--config
arg. Let prettier find its own config in project root and then it will also find the .editorconfig file.Thanks @milesj I just learned that prettier will find the project root in search of the config file and .editorconfig - resolve-config-editorconfig.js - which must be why I haven't ran into this before.
If I do not provide the argument to the task, i.e. remove
--config @in(0)
, prettier still finds the project root, the standard config location, and the .editorconfig. Not sure what it is about how prettier finds the root and the moon task, but this is a pretty great 'workaround' for me.