prettier / prettier/prettier

Wrong indentation for the last in a series of gradients followed by background-color

Open
#14,385 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lang:css/scss/less
Dominant language
JavaScript
Stars
52.3k
Forks
5k
Avg merge
19h 2m
Merged PRs (30d)
117

Description

Prettier 2.8.4
Playground link

--parser css
--print-width 60
--tab-width 4

Input:

background: linear-gradient(
  to right,
  rgb(119, 59, 210),
  rgba(185, 54, 210, 0)
 ),
 linear-gradient(
  to right,
  rgb(119, 59, 210),
  rgba(136, 60, 210, 0.74074) 33.704%,
  rgba(168, 57, 210, 0.25926) 66.296%,
  rgba(185, 54, 210, 0)
 ),
 linear-gradient(
  to right,
  hsl(263.84, 62.66%, 52.75%),
  hsla(276.93, 62.74%, 52.8%, 0.5) 50%,
  hsla(290.38, 63.41%, 51.76%, 0)
 )
 #0000ff;


Output:

background: linear-gradient(
        to right,
        rgb(119, 59, 210),
        rgba(185, 54, 210, 0)
    ),
    linear-gradient(
        to right,
        rgb(119, 59, 210),
        rgba(136, 60, 210, 0.74074) 33.704%,
        rgba(168, 57, 210, 0.25926) 66.296%,
        rgba(185, 54, 210, 0)
    ),
    linear-gradient(
            to right,
            hsl(263.84, 62.66%, 52.75%),
            hsla(276.93, 62.74%, 52.8%, 0.5) 50%,
            hsla(290.38, 63.41%, 51.76%, 0)
        )
        #0000ff;

Expected behavior:

background: linear-gradient(
        to right,
        rgb(119, 59, 210),
        rgba(185, 54, 210, 0)
    ),
    linear-gradient(
        to right,
        rgb(119, 59, 210),
        rgba(136, 60, 210, 0.74074) 33.704%,
        rgba(168, 57, 210, 0.25926) 66.296%,
        rgba(185, 54, 210, 0)
    ),
    linear-gradient(
        to right,
        hsl(263.84, 62.66%, 52.75%),
        hsla(276.93, 62.74%, 52.8%, 0.5) 50%,
        hsla(290.38, 63.41%, 51.76%, 0)
    )
    #0000ff;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Prettier Playground reproduction using the CSS parser, 60-column print width, and four-space tab width. Trace the CSS formatting path for a series of gradients followed by a background color, then add coverage for this input and verify that the final gradient and color use the expected indentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.