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
Hi.
I updated to 0.17.1 and trying to use new dockerfile parser to format dockerfile.
But it dies with error:
panic: runtime error: index out of range
RuntimeError: unreachable
at main.runtime.runtimePanicAt (wasm://wasm/main-004aad7a:wasm-function[211]:0x10867)
at main.runtime.lookupPanic (wasm://wasm/main-004aad7a:wasm-function[18]:0x1dff)
at main.github.com/reteps/dockerfmt/lib.formatRun (wasm://wasm/main-004aad7a:wasm-function[1788]:0xc012b)
at main.github.com/reteps/dockerfmt/lib.FormatNode (wasm://wasm/main-004aad7a:wasm-function[1780]:0xbe2c2)
at main.(*github.com/reteps/dockerfmt/lib.ParseState).processNode (wasm://wasm/main-004aad7a:wasm-function[1778]:0xbde86)
at main.(*github.com/reteps/dockerfmt/lib.ParseState).processNode (wasm://wasm/main-004aad7a:wasm-function[1778]:0xbdf31)
at main.formatBytes.command_export (wasm://wasm/main-004aad7a:wasm-function[1797]:0xc6475)
at formatDockerfileContents (file:///d:/projects/softvisio-node/cli/node_modules/@reteps/dockerfmt/dist/format.js:20:27)
at async printAstToDoc (file:///d:/projects/softvisio-node/cli/node_modules/prettier/index.mjs:20124:16)
at async coreFormat (file:///d:/projects/softvisio-node/cli/node_modules/prettier/index.mjs:20538:14)
Dockerfile:
RUN \
# cleanup
ls -la
Seems, that such comments syntax is not supported.
So, what I should do? )))
I am confused.
I can help to test it, but I an not familiar with this project internals.
I am just using prettier and this plugin, I don't know, how one package invoke other and with what options.
At least it won't error anymore, this is just a workaround temporarily, the root cause is from the upstream, so the true fix can only happen in the upstream.
Activity
JounQin commentedon Apr 10, 2025
cc @reteps
JounQin commentedon Apr 10, 2025
@zdm Would you like to PR to add a failing test case?
zdm commentedon Apr 10, 2025
Sorry, I am overloaded by 200% with my ongoing work. Will be busy for a month or even more.
JounQin commentedon Apr 10, 2025
Seems fixed with
@reteps/dockerfmtv0.3.2prettier/packages/sh/test/__snapshots__/fixtures.spec.ts.snap
Lines 884 to 888 in 4e1b682
JounQin commentedon Apr 10, 2025
@zdm Please try
prettier-plugin-shv0.17.2zdm commentedon Apr 10, 2025
Still has problems. No errors, but output is corrupted:
become:
JounQin commentedon Apr 10, 2025
@zdm I cann't reproduce it.
prettier/packages/sh/test/__snapshots__/fixtures.spec.ts.snap
Lines 884 to 890 in 85dccbf
What's your dockerfile's name?
chore: update #441 test case
zdm commentedon Apr 10, 2025
Dockerfile, or can bedocketfile, both names are correct.chore: update #441 test case
JounQin commentedon Apr 10, 2025
Please provided reproduction then.
chore: update #441 test case (#443)
zdm commentedon Apr 10, 2025
Plugin version:
0.17.2Source ``dockerfile`:
First run result:
Second run result:
Third run result::
JounQin commentedon Apr 10, 2025
OK... I'll take a look tomorrow.
2 remaining items
reteps commentedon Apr 10, 2025
The formatting for multiline, start comments isn't great, but should be fine. https://github.com/reteps/dockerfmt/blob/main/tests/out/run5.dockerfile
zdm commentedon Apr 10, 2025
i will test when it will be published
JounQin commentedon Apr 10, 2025
You can test it right now by upgrading the upstream package without changes in this repo.
zdm commentedon Apr 10, 2025
I tested.
Works not, with one exception.
It doesn't respect indentation configuration.
Result:
I have 4 spaces indentation configured, but it always make 1 space indent, which is not very readable and breaks prettier behavior.
reteps commentedon Apr 10, 2025
If you can replicate this using https://github.com/reteps/dockerfmt, please file a bug there.
zdm commentedon Apr 10, 2025
So, what I should do? )))
I am confused.
I can help to test it, but I an not familiar with this project internals.
I am just using prettier and this plugin, I don't know, how one package invoke other and with what options.
JounQin commentedon Apr 11, 2025
@zdm Sorry for the confusion, a runnable reproduction repo is required for this. It's hard to tell without debugging.
JounQin commentedon Apr 11, 2025
prettier/packages/sh/test/__snapshots__/fixtures.spec.ts.snap
Lines 884 to 891 in 4444106
Seems indeed not working expected, I'll make a simple reproduction for
dockerfmt.See reteps/dockerfmt#21 (comment)
MoKhajavi75 commentedon Apr 22, 2025
same here
is there a way to disable this for dockerfiles?
JounQin commentedon Apr 22, 2025
@MoKhajavi75 You can set
parser: shto override the default parser withoverridesas https://prettier.io/docs/configuration#configuration-overrides.fix: fallback to sh printer when dockerfmt throws
zdm commentedon May 9, 2025
Just updated and tested
It removes indentation, so it is not fixed
diff after dockerfile parsed was applied:
JounQin commentedon May 9, 2025
At least it won't error anymore, this is just a workaround temporarily, the root cause is from the upstream, so the true fix can only happen in the upstream.