Fork me on GitHub
#clj-kondo
<
2022-09-20
>
Benjamin14:09:07

foo.cljc

(ns foo)
(spit nil nil)

[benj@benj-pc org.sg.sheets-lambda]$ clj-kondo --version 
clj-kondo v2022.09.08
clj-kondo --lint ./src/foo.cljc 
./src/foo.cljc:3:2: error: Unresolved symbol: spit
what about clojure.core functions in cljc files?

borkdude14:09:00

it's unresolved because clj-kondo by default assumes clj + cljs in a .cljc file

Benjamin14:09:25

yea ok I see

borkdude14:09:29

if you intend to write e.g. for bb, then you can use {:cljc {:features [:clj]}} to disable linting for cljs

Benjamin14:09:41

ah totally nice

Noah Bogart15:09:06

If we're sharing about hooks, I'm up to 5! keep finding places where adding one instead of relying on :lint-as makes development better

🎉 2
seancorfield16:09:33

Yeah, I have a bunch of :lint-as settings that I keep squinting at and thinking "Hmm, maybe that should be a hook". I definitely have another macro I'm going to write a hook for (although the red squigglies today are some encouragement to stop using it 🙂 )

😂 2
borkdude16:09:27

For anyone wanting to get more up to speed with hooks, you can do a self-paced "Getting hooked on clj-kondo hooks" workshop here: https://github.com/clj-kondo/hooks-workshop-clojured-2022

borkdude16:09:40

If anyone wants to give that workshop at their company or a conference, feel free

borkdude16:09:40

Btw, if writing :analyze-call hooks for a macro is a bit too much, there is now also the :macroexpand hook which gives less accurate locations for warnings, but still gets rid of false positives by more or less just copying the macro (and simplifying it)

Benjamin16:09:08

(ns org.sg.sheets-lambda.core)
why is this an unparsable ns form?

Benjamin16:09:32

clj-kondo v2022.09.08
`

borkdude16:09:03

Can't repro that

dpsutton16:09:21

❯ echo "(ns org.sg.sheets-lambda.core)" | clj-kondo --lint -
linting took 4ms, errors: 0, warnings: 0

borkdude16:09:38

Perhaps close your editor and open the file again

dpsutton16:09:53

(i always forget how to get the minimal way to check stuff so posting here for @benjamin.schwerdtner)

Benjamin16:09:55

ah maybe there is more caching that .clj-kondo/cache?

Benjamin16:09:15

yea this echo command is great. 0 warns for me too

Benjamin16:09:52

also have it when I invoke with --lint manually

borkdude16:09:02

Close and reopen your editor

Benjamin17:09:50

(ns foo)

(comment
  (require '[lol oh-no :as]))
minimal repro. Lol when there is a garbled require form I guess anywhere in the file. Quality of life issue is that it logs the warning on the top ns form... Maybe the warning could at least mention that require elsewhere in the file can be an issue

borkdude17:09:15

@benjamin.schwerdtner Ah I see. Feel free to post an issue