prettier / prettier/prettier

`prettier-ignore` in YAML seems to apply to all following nodes instead of just the immediate next node

Open
#13,008 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:comments area:ignore lang:yaml
Dominant language
JavaScript
Stars
52.3k
Forks
5k
Avg merge
19h 2m
Merged PRs (30d)
117

Description

Prettier 2.6.2
Playground link

# Options (if any):
--prose-wrap always

(happens regardless of --prose-wrap setting, but it's easier to see with it set to always)

Input:

# prettier-ignore
x:
  1
  2
  3
y: 
  1
  2
  3

Output:

# prettier-ignore
x:
  1
  2
  3
y: 
  1
  2
  3

Expected behavior:

# prettier-ignore
x:
  1
  2
  3
y: 1 2 3

Personally I think the expected behaviour makes more sense, but it could be the current behaviour is intended in which case I think the documentation could make it more obvious.

Currently it says:

# prettier-ignore should be placed on the line immediately above the ignored node:

which to me implies it'll only affect that node, rather than the nodes after it.

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

Reproduce the YAML case in the linked Prettier Playground and compare the current output with the expected output. Verify whether prettier-ignore should affect only the immediate next node; done means the behavior is corrected or the documentation clearly explains the intended scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, yaml
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.