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

[prettier-plugin-sh] Fails in Dockerfile using "RUN if" #292

Closed
barona-mika-vilpas opened this issue Oct 27, 2023 · 4 comments
Closed

[prettier-plugin-sh] Fails in Dockerfile using "RUN if" #292

barona-mika-vilpas opened this issue Oct 27, 2023 · 4 comments
Labels

Comments

@barona-mika-vilpas
Copy link

Hello, just ran into this error:

❯ npx prettier --write node/Dockerfile.template
node/Dockerfile.template
[error] node/Dockerfile.template: SyntaxError: "then" can only be used in an if
[error]   24 |     )
[error]   25 |
[error] > 26 | RUN if [[ x$LATEST_NPM = xtrue ]]; then yarn global add npm@latest; fi
[error]      |                                    ^
[error]   27 |
[error]   28 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
[error]   29 |

Any ideas what might be wrong?

@JounQin
Copy link
Member

JounQin commented Oct 27, 2023

Please provide a runnable reproduction, thx.

@barona-mika-vilpas
Copy link
Author

Here's a minimal reproduction. The readme contains instructions on how to reproduce the error.

https://github.com/barona-mika-vilpas/un-ts-issue-reproduction

@JounQin
Copy link
Member

JounQin commented Nov 9, 2023

Sorry I don't have enough time recently, I'll try to review your reproduction ASAP.

@JounQin
Copy link
Member

JounQin commented Nov 10, 2023

I'm sorry, but actually Dockerfile is not officially supported by mvdan/sh what means only basic and simple Dockerfile usage cases can be handled correctly. We can not do much inside.

@JounQin JounQin closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants