-
Notifications
You must be signed in to change notification settings - Fork 5
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
Forcing globally installed elm-format #10
Comments
Hi @krksgbr! I see what you're after. How about an env variable called prettier-plugin-elm/src/util.ts Lines 19 to 26 in bbf66dc
↓ export const formatTextWithElmFormat = (text: string): string => {
const customPathToElmFormat = process.env.PRETTIER_PLUGIN_ELM_CUSTOM_PATH_TO_ELM_FORMAT;
return execa.sync(customPathToElmFormat || "elm-format", ["--stdin", "--elm-version=0.19"], {
input: text,
preferLocal: !!customPathToElmFormat,
localDir: __dirname,
stripEof: false,
}).stdout;
}; What you'll then be able to do is: export PRETTIER_PLUGIN_ELM_CUSTOM_PATH_TO_ELM_FORMAT=elm-format
prettier --write "**/*.elm" export PRETTIER_PLUGIN_ELM_CUSTOM_PATH_TO_ELM_FORMAT=/path/to/non-global/elm-format
prettier --write "**/*.elm" I'm happy to consider a PR that introduces this. It'd be great if you could add test coverage to the change. Upgrading dependencies could be also worth it given the opportunity. UPD: Looks like cache must be made aware of the value too. |
Awesome:) |
Cool. I won't be able to release at least for another week and a half, so no rush 😉 |
Hey @kachkaev! In the meantime, I've had a discussion about this with @knuton. After a bit more careful consideration we came to the conclusion that the implementation proposed above would not be as useful for us as I initially thought. Two issues we have with it are:
What do you think of giving preference to the global installation of Specifically:
|
I see. Let’s then close this issue and reopen it if you have further thoughts. |
Hi!
In our project,
elm-format
is installed as anix
package. This means that innix-shell
we need to be able to run the instance ofelm-format
provided bynix
instead of the one installed byprettier-plugin-elm
as a dependency. We'd like to have a way of configuring this behavior. Not sure what the best way would be for passing in configuration, maybe through an environment variable:PRETTIER_PLUGIN_ELM_PREFER_LOCAL=false
? Currently we solve this problem through a fork, but it would be nice to have this supported in the official package. Would you accept a PR for this?The text was updated successfully, but these errors were encountered: