It's possible for files to appear as valid TOML without being TOML. For example the poetry.lock file in many python projects is an internal file format to poetry but is based on TOML.
It's important not to format files that aren't TOML, but this pre-commit hook applies itself to every single file in your commit. If any file accidentally happens to be valid toml then it will get reworked.
In the case of poetry.lock files this creates an incredibly nasty hell because it's already challenging to resolve merge conflicts in these files. Doing so during a rebase requires regeneration of the file; which of course won't be to format. Then you end up with 500 merge conflicts against the next commit that touches it.
I can imagine there would be an unbelievable number of side effects and bugs that could result from this arbitrarily rearranging contents of potentially any file!
Proposed solution
The toml file formatter should only operate on .toml files.
It's possible for files to appear as valid TOML without being TOML. For example the
poetry.lockfile in many python projects is an internal file format to poetry but is based on TOML.It's important not to format files that aren't TOML, but this pre-commit hook applies itself to every single file in your commit. If any file accidentally happens to be valid toml then it will get reworked.
In the case of
poetry.lockfiles this creates an incredibly nasty hell because it's already challenging to resolve merge conflicts in these files. Doing so during a rebase requires regeneration of the file; which of course won't be to format. Then you end up with 500 merge conflicts against the next commit that touches it.I can imagine there would be an unbelievable number of side effects and bugs that could result from this arbitrarily rearranging contents of potentially any file!
Proposed solution
The toml file formatter should only operate on
.tomlfiles.