autofmt: configuration file #9

Open
opened 2025-08-21 14:11:48 -07:00 by clo · 1 comment
Owner

the intent is not to make autofmt a tool like dprint or treefmt, but still a tool that can format any file correctly. this messed up fish's workflow when a formatter was used on package.json on a repo that only uses prettier to format js files. while i think the repo is wrong for this and prettier --write . would format the file, autofmt should be configurable.

the issue is some projects do not format their files at all. we should add these configuration options:

  • reset do not inherit config
  • includeAmbiguousInRepos change the default behavior of autofmt to not pick a default formatter, and defaulting this to false
  • disabledLanguages array of language names to disable formatting on
  • disabledExtensions array of extensions to disable formatting on
  • disabledFiles array of relative glob patterns to disable formatting on

when autofmt looks to format a file, it should read all .autofmt configurations in all parent directories, including past git boundaries, until it reaches one with reset

oh, additionally, formatters should probably be able to specify exclude patterns, like .prettierignore to add more ways to disqualify a file.

the intent is not to make autofmt a tool like dprint or treefmt, but still a tool that can format any file correctly. this messed up fish's workflow when a formatter was used on `package.json` on a repo that only uses prettier to format js files. while i think the repo is wrong for this and `prettier --write .` would format the file, autofmt should be configurable. the issue is some projects do not format their files at all. we should add these configuration options: - `reset` do not inherit config - `includeAmbiguousInRepos` change the default behavior of autofmt to not pick a default formatter, and defaulting this to false - `disabledLanguages` array of language names to disable formatting on - `disabledExtensions` array of extensions to disable formatting on - `disabledFiles` array of relative glob patterns to disable formatting on when autofmt looks to format a file, it should read all `.autofmt` configurations in all parent directories, including past git boundaries, until it reaches one with `reset` oh, additionally, formatters should probably be able to specify exclude patterns, like `.prettierignore` to add more ways to disqualify a file.
Author
Owner

one other criteria, the nix config should exclude .autofmt from being committed to any git repository so that we do not dilute repositories with configuration for a tool that is literally supposed to avoid configuration

one other criteria, the nix config should exclude .autofmt from being committed to any git repository so that we do not dilute repositories with configuration for a tool that is literally supposed to avoid configuration
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: nix/config#9
No description provided.