cljfmt icon indicating copy to clipboard operation
cljfmt copied to clipboard

Support disabling formatting on forms

Open arrdem opened this issue 8 years ago • 1 comments

Most formatting tools provide a way to disable formatting on some expression. For instance various Java and Python tools allow comments at end of line such as # nofmt or # lint: ignore in which case no changes will be made to those lines.

That particular implementation doesn't map well to Clojure, since it's a form oriented language but one could certainly imagine situations where a user really truly thinks they know better than the formatter and wants to disable it for small blocks of code.

I propose that selecting (either by form metadata or a leading/trailing comment) a form to ignore would be the best implementation of this, since it provides the behavior we want (local opt-out) while making it difficult to just tell the linter to go away altogether. The default after all should be code which conforms to the style guide / linter output.

arrdem avatar Jul 27 '16 19:07 arrdem

A clj-kondo style comment form like

#_:cljfmt/ignore
(some-form ...)

would probably be the way to go in 2023.

camsaul avatar Apr 19 '23 00:04 camsaul