This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-25
Channels
- # aleph (18)
- # announcements (7)
- # asami (18)
- # babashka (15)
- # babashka-sci-dev (79)
- # beginners (61)
- # calva (4)
- # clj-kondo (23)
- # cljfx (16)
- # cljs-dev (6)
- # clojure (63)
- # clojure-bay-area (3)
- # clojure-europe (33)
- # clojure-nl (1)
- # clojure-survey (4)
- # clojure-uk (5)
- # clojurescript (37)
- # conjure (1)
- # cursive (8)
- # datahike (7)
- # datalevin (1)
- # datomic (30)
- # emacs (10)
- # events (2)
- # figwheel (2)
- # fulcro (20)
- # google-cloud (1)
- # lsp (6)
- # luminus (4)
- # malli (5)
- # music (3)
- # nextjournal (1)
- # off-topic (9)
- # other-languages (3)
- # pathom (16)
- # polylith (34)
- # re-frame (14)
- # reagent (19)
- # releases (6)
- # sci (2)
- # shadow-cljs (33)
@stefan.van.den.oord is working on a namespace linter that warns when the name of the ns does not match the filename. But for scripts (clojure and babashka) it is fine to use normal dashes in the name. So foo-bar.clj
and (ns foo-bar)
is fine for scripts that you invoke directly with bb foo-bar.clj
, but not for files on the classpath. Any suggestions on how to deal with this? Maybe a heuristic that when there is no "src"
or "test"
in the parent segments, the file isn't on the classpath and can be assumed a script?
Would it make sense to have a different set of default linter configs for that type of use? In other words, invoking clj-kondo slightly differently so that it knows it is running in “scripting mode” and then have different defaults?
No, if you are using clj-kondo in your editor you don't invoke it yourself and that's the primary mode of usage as far as I'm concerned
People could just use #_:clj-kondo/ignore
in this case or just adopt the convention to use underscores in their script file names perhaps.
Might be worth making a test case to see if the ignore annotation works correctly with this linter
shebang is not always present in scripting mode I think.
cat some-text-file-containing-clojure.clj | bb
You're right that a shebang isn't always present, but that would be a way for people to get rid of the warning
i'm writing a hook. what's the best way to debug it?
I was asking the same a while back, check out this thread https://clojurians.slack.com/archives/CHY97NXE2/p1644324979611669
to follow up, I have a macro that creates a private function and then binds the function to public atom, which allows for repl-based testing while keeping the in-code usage through the atom. is it possible to output the {:node node}
in my :analyze-call
hook that ignores the unused-private-var
warning?
oh wait, this is a clojure-lsp issue, i'll work from there. never mind, this is in fact a clj-kondo issue. any ideas on how to fix this?
@nbtheduke Just use the unused private var once in your hook, that will take care of the warning, e.g. (let [_ private-var])
mind if i PM you about this? i don't want to share the code publicly but i'm unsure how to do that with the code i have written