Fork me on GitHub
#clj-kondo
<
2020-01-08
>
dharrigan09:01:36

There's quite a common macro called when-let*, as described here:

dharrigan09:01:53

Presently, I get an error from clj-kondo on linting

dharrigan10:01:05

So I'm trying to get clj-kondo to do the right thing

dharrigan10:01:26

i.e., {:lint-as {foo.bar/when-let* clojure.core/let}}

dharrigan10:01:52

that doesn't seem to work (still reports an error that the symbol cannot be resolved)

dharrigan10:01:23

if I change it to clojure.core/when-let then it complains thus error: when-let binding vector requires exactly 2 forms

dharrigan10:01:39

Any suggestions on how to get clj-kondo to do the right thing?

yuhan10:01:33

@dharrigan I have the same macro in my util ns and it's linted as clojure.core/let with no issues

yuhan10:01:53

maybe check for typos?

dharrigan10:01:06

thanks - will check

dharrigan10:01:05

Ah - yes, I forgot - I had joker as well

dharrigan10:01:31

i.e., let g:ale_linters = {'clojure': ['clj-kondo', 'joker']}

dharrigan10:01:41

removing joker worked

🤡 1
practicalli-john22:01:31

I removed joker last year. It's a much better experience with just clj-kondo

dharrigan10:01:59

confirmation that it worked for you, made me look elsewhere 🙂

yuhan10:01:48

I'm pretty sure clj-kondo's features are a superset of joker's by now, there's little reason to have both

dharrigan10:01:23

Yeah, I've removed it 🙂

Cora16:01:16

is there a way to exclude unresolved symbols just within an individual file?

Cora16:01:29

well, just some symbols

Cora16:01:31

(ns nate.babashka.fs-test
  {:clj-kondo/config {:linters {:unresolved-symbol {:exclude [deftest is testing]}}}}
  (:require #?(:clj [clojure.test :as test :refer [deftest is testing]]
               :bb  [spartan.test :as test :refer [deftest is testing]])
            [nate.babashka.fs :as fs]))

(deftest home
  (testing "is a string"
    (is (instance? String (fs/home)))))

Cora16:01:43

I tried quoting them a bunch of different ways with no luck

borkdude16:01:12

I think you can use {:clj-kondo/config {:linters ...}} as namespace metadata. Doesn't work for all linters, but I believe it works for :unresolved-symbol

borkdude16:01:38

oh I responded while not having read your code... sorry 🙂 I see you're already doing that

borkdude16:01:18

you need to quote the metadata value: so '{:linters ...}

Cora16:01:02

ahhhh ok I'll give that a shot, thanks

Cora16:01:34

it worked!

👍 1
borkdude16:01:40

Btw, I haven't got testing yet in spartan.test, but that would be nice. Lint-as should also work here: {:lint-as {spartan.test/deftest clojure.test/deftest}}

borkdude16:01:23

I'm going to add testing right away.

Cora16:01:58

oh, nice, thanks!

Cora17:01:05

yay! 😄

borkdude17:01:20

I'll add thrown? and thrown-with-msg? later today

Cora18:01:01

I'm not familiar with those two