cljfmt
cljfmt copied to clipboard
Feature request: a configuration file
Having the aliases, indents, and formatting options passed as CLI arguments is not ideal for editor integration and using cljfmt
in multiple projects.
It'd be awesome if cljfmt
could read all options from a single file, which can be specified. By default it could look for .cljfmt.edn
(or similar) in the current directory and each directory up to HOME.
It should use the first file it finds, without any attempt to merge with files higher up the directory tree, so there aren't any surprises due to a user's personal preferences.
This would allow per-project configuration for projects that don't use Leiningen and simplify editor/workflow integration.
I believe you can configure using a file. We have .cljfmt.edn in our project. Its the default file for clojure-lsp and works without set up in emacs. In vscode, you have to tell calva where the file is, but you can also set it to the generic CLOJURE_LSP and it will pick up from clojure-lsp which pick up from .cljfmt.edn.
Thanks, that's good to know. Unfortunately that won't help me, because I use the cljfmt binary for formatting, which also can check/fix whole directories.
I think it would be better if cljfmt read its own configuration file, then LSP probably wouldn't have to implement it.
I'd be open to a PR that would look for a configuration file in the current directory. I'm less sure about looking in HOME or checking parent directories.
Using the command line tool for linting in Emacs will run it in the file's directory, not the project root, so it needs to find the configuration.
And having a global default in one place (HOME) is incredibly useful as well. It would be painful to have to copy (and maintain) files in various project directories.
Would this extend to the lein-cljfmt plugin, or would that need to be a seperate change on that side?
Would this extend to the lein-cljfmt plugin, or would that need to be a seperate change on that side?
No, because Leiningen already has per-project and per-user configurations.