Fork me on GitHub
Marc O'Morain15:03:02

Is there a way to tell clj-kondo that a macro is like a let binding? We have a macro that adds a binding like this:

(with-temp-file filename
  (foo (bar filename)))
And clj-kondo warns about the unresolved symbol. I can mark this macro as excluded, but is there a more sophisticated approach?


@marc-omorain You can use :lint-as + cljs.test/async (I know, it's weird, but this works)

Cora (she/her)15:03:32

I have literally that same function ๐Ÿ˜‚

๐Ÿ˜€ 4
Marc O'Morain15:03:34

aha, so cljs.test/async has the same pattern, gotcha ๐Ÿ‘

Marc O'Morain15:03:44

We have some macros that expect square braces in the same way, and I lint those as fn

Cora (she/her)15:03:17

I debated just using the fn syntax, myself

Cora (she/her)15:03:35

that library is a work in progress

Marc O'Morain15:03:46

I think Iโ€™ve found a false positive case in clj-kondo, going to reduce it down now

Marc O'Morain15:03:51

(fn unresolved-symbol-x
  [x & {:keys [y]
          :or {y (inc x)}}]
  (+ y x))

Marc O'Morain15:03:32

logging in GH now


what is the issue, can you explain in words first?


I'll check in Clojure if this is supposed to work at all ๐Ÿ˜‰


We have defined a method called zero? in our money lib, but now clj-kondo complains because we overwrite zero? from cljs.core. Is there a way to white list just these occurrences as OK, possibly similar to rubocop's rubocop:disable comments? I'd prefer not to disable this linter globally if possible


@igel The canonical way to do this is to use :refer-clojure :exclude [zero?]


this is supported by clojure / clojurescript itself

Marc O'Morain16:03:00

Clojure 1.10.1
(defn foo [x & {:keys [y] :or {y (inc x)}}]
  (+ y x))
user=> (foo 1 :y 10)
user=> (foo 1)


@marc-omorain I've had more edge cases where people did weird things with or that accidentally worked but were confirmed by the core team as a thing to not rely on, that's why I'm going to ask in #clojure first


@borkdude, Thanks, didn't knew that ๐Ÿ‘

Marc O'Morain17:03:05

@borkdude so pulling circleci/circle up the latest clj-kondo reported 4 issues. 2 legit bugs, that issue above ^, and a weird case of us abusing name-spaces to break a circular dependency between two namespaces, which clj-kondo canโ€™t deal with (which I donโ€™t expect it to deal with).

Marc O'Morain17:03:30

One bug was us passing a vector of 4 items as the last arg to clojure.set/union . The other was genuine broken code that happens to not crash.


@marc-omorain Cool, so all good now? ๐Ÿ™‚


the lsp plugin with intellij doesn't seem to be reading the project's .clj-kondo/config.edn`, is there a way to convince it to do this?


@tanzoniteblack I think this depends on the working directory. so if you edit files within your project while your project is opened in its base directory, then it will probably work


same for VSCode


ah, I had to move the config from the module directory I was working in to the project directory, and then restart intellij before it actually kicked in


if this is something worth documenting for other users, PR welcome