Skip to content

Error: unable to parse Dockerfile: unexpected token comment #12

@akkadaya

Description

@akkadaya

Describe the bug

dprint-plugin-dockerfile version: 0.3.0

Input Code

RUN \
# Print Hello World!
echo 'Hello World!'

Expected Output

RUN \
  # Print Hello World!
  echo 'Hello World!'

Actual Output

❌ Error:

[ERROR] Error formatting text. Error: unable to parse Dockerfile: unexpected token comment

RUN \
# Print Hello World!
echo 'Hello World!'

Additional Information

if I move the comment up or down, it'll work fine but it breaks only when the comment sits under RUN \ directly

# Print Hello World!
RUN \
echo 'Hello World!' \
# Print Hello World!
echo 'Hello World!'

⚠️ BUT, the comment and the subsequent code will not be formatted!
Output:

# Print Hello World!
RUN echo 'Hello World!' \
# Print Hello World!
echo 'Hello World!'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions