clj-kondo 2025-08-25

Can I make clj-kondo ignore whitespace? I am trying to use clojure-mcp, but the whitespace changes that are introduced by the auto-linting (which seems to be clj-kondo) conflict directly with the way IntelliJ does vertical alignment of maps and comments. I have looked at the docs and can't find anything relating to whitespace, indentation, etc.

clj-kondo has always ignored whitespace, it doesn't do anything with whitespace whatsoever

Hm, strange

I wonder where that is coming from then

maybe it uses cljfmt or some other tool?

Ah! I'll go check. I have zero experience with any of these libs, since I always just relied in IntelliJ's formatting πŸ™‚

well maybe ask in #ai-assisted-coding where the clojure-mcp talk is happening, seems to be the best place to start?

Yeah, you're right (and I did). I just took a wrong turn πŸ™‚

linting doesn’t introduce anything. it lints existing. However, clojure-mcp often reformats lots of buffers. An easy way to fix this is with a linter, or you can compute a diff of non-whitespace changes, commit those, and then revert the remaining changes

> However, clojure-mcp often reformats lots of buffers. An easy way to fix this is with a linter ?

good question. totally meant formatter

πŸ‘ 1

My kondo was reporting error: Unresolved symbol: background and I fixed it by replacing [midje.sweet :refer :all] with [midje.sweet :refer [background]] Is this bug known?

It's a known limitation of clj-kondo. Unless you lint midje.sweet and it has a sane way of defining background, clj-kondo can't know that that namespace contains that var

πŸ‘ 1

how are you using clj-kondo?

can i open a bug asking it in kondo repository and then you answer and close? I searched midje, refer, all in kondo repo and I couldn't find this answer I already knew about this limitation, but I didn't find a closed bug to support my knowledge.

this isn't specific to midje

> how are you using clj-kondo?

I mean, from the command line, editor, what editor, clojure-lsp, intellij?

kondo CLI directly, v2024.11.14

ok. this issue should resolve itself when you lint the dependencies with:

clj-kondo --lint "$(clojure -Spath)" --dependencies --parallel --copy-configs
copy configs is optional, but this is what you would typically invoke when setting up clj-kondo with dependency analysis

I see a cyclic dependency reported (due to :require-macros) in a CLJC file for such ns declaration:

(ns foo.core.util
  (:require [clojure.string :as str])
  #?(:clj (:import [clojure.lang ExceptionInfo])
     :cljs (:require-macros [foo.core.util])))
The code runs fine, so it seems like a buggy flagging on clj-kondo part. Am I missing something?

This is not a clj-kondo linter, but something implemented by #lsp - better to report it over there

πŸ‘πŸ½ 1