`prettier-ignore` in YAML seems to apply to all following nodes instead of just the immediate next node
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-ignoreshould 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.
Being the first line # prettier-ignore applies to the entire file in this case, which definitely is a bug.
The prettier ignores the entire map because the comment is parsed as the leading comment of the map.
I found a similar problem that in the following code, both x and y will be ignored. But I think ignoring x only makes more sense.
z:
# prettier-ignore
x:
1
2
3
y:
1
2
3
The same behaviour also appears on arrays.