prettier: Errors with `dockerfile` parser

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.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (15 by maintainers)

Commits related to this issue

Most upvoted comments

same here is there a way to disable this for dockerfiles?

@MoKhajavi75 You can set parser: sh to override the default parser with overrides as https://prettier.io/docs/configuration#configuration-overrides.