-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix ignoring entire mapping and sequence. #16756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
651f371 to
5a93610
Compare
commit: |
|
Can anyone review it? |
|
Can anyone review it? |
✅ Deploy Preview for prettier ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
| (parent) => | ||
| hasLeadingComments(parent.node) && | ||
| isPrettierIgnore(parent.node.leadingComments.at(-1)), | ||
| )) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are ignoring mappingItem separately, so the parent is not correctly ignored.
For example, spacing is not preserved.
Prettier pr-16756
Playground link
--parser yamlInput:
# prettier-ignore
abc: 123
def: 456Output:
# prettier-ignore
abc: 123
def: 456
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in this way, I can't ignore the first item in an object separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to understand the original issue better.
Description
Fix bug in #13008. Added a check to determine whether the YAML ignore comment is at the beginning of the file.
Checklist
(If changing the API or CLI) I’ve documented the changes I’ve made (in thedocs/directory).(If the change is user-facing) I’ve added my changes tochangelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.✨Try the playground for this PR✨