Because formatting works by parsing YAML into a data structure and re-emitting it, and YAML's data model has no place for comments — they are lexical, not semantic. This is a real limitation to be aware of before formatting a heavily commented file such as a Kubernetes manifest or CI config. Keep a copy of the original.
Does YAML require two-space indentation?
YAML requires consistent indentation of at least one space and forbids tabs, but the exact width is up to you. Two spaces is the near-universal convention and what Kubernetes, GitHub Actions and Docker Compose examples all use.
What is the "Norway problem"?
In YAML 1.1, the unquoted value NO parses as the boolean false — so a country list containing NO for Norway silently becomes false. YAML 1.2 fixed this, but many parsers still follow 1.1. If a value could be read as a boolean, quote it.