-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
YAML formatting strips document begin #5013
Copy link
Copy link
Closed
Labels
lang:yamlIssues affecting YAMLIssues affecting YAMLlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!
Milestone
Metadata
Metadata
Assignees
Labels
lang:yamlIssues affecting YAMLIssues affecting YAMLlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!
One thing I've noticed with the new YAML formatting (which is awesome btw!) is that it will strip a standalone (not part of frontmatter) document-separator (
---). For example, you can see it happen in this PR diff (a commit made by Restyled, which runs prettier).I don't have a definitive reference that it's good style to include these document delimiters when they're not strictly necessary, but I tend to include them because:
yamllinthas a rule (by default) that requires them, andI saw a tweet with this justification (paraphrased):
If you concatenate multiple YAML documents into some process, e.g.
cat one.yaml two.yaml | some-processHaving document-separators in the files will ensure they get processed correctly (as multiple documents). Without the separators, you may silently get something unexpected (smashing of objects) or it might just error.
Because of point (1), it's particularly annoying when ALE runs prettier as an auto-fixer, which strips the
---, then it runs yamllint as a linter, which complains about its omission...So, is it intentional to strip it? If so, can an option be added to preserve it?