This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-20
Channels
- # aws (1)
- # babashka (68)
- # beginners (68)
- # braveandtrue (6)
- # calva (4)
- # cider (10)
- # clj-kondo (26)
- # clojure (76)
- # clojure-dev (18)
- # clojure-europe (1)
- # clojure-norway (25)
- # clojure-spec (8)
- # clojure-sweden (7)
- # clojure-uk (3)
- # clojuredesign-podcast (1)
- # clojurescript (11)
- # conjure (29)
- # cursive (31)
- # datomic (29)
- # emacs (12)
- # fulcro (29)
- # graphql (3)
- # helix (2)
- # hoplon (39)
- # hugsql (4)
- # malli (3)
- # off-topic (62)
- # pedestal (8)
- # re-frame (23)
- # reagent (14)
- # rewrite-clj (10)
- # shadow-cljs (18)
- # spacemacs (3)
- # sql (13)
- # xtdb (32)
@borkdude nice, this :clj-kondo/config
will also support regular clj-kondo config? I wonder if as a library author I can already say things like "this custom macro is just like defn", will that be possible using this ns
config?
@wilkerlucio I consider that a different feature: https://github.com/borkdude/clj-kondo/issues/559
@borkdude does your example assume literals? Could it be updated to cancel early or use type inference when it isn't a literal? I think it's critical that the examples are comprehensive.
@dominicm yes, you get the source node as the user writes it. arguments don't get evaluated before you see the source node, that's not how static analysis works
type inference: could be possible, but then I'd need to pass more into the hook function, something like :bindings
where a binding can have a tag
The :analyze-call
hook only gets called when the function is in function position, not as an argument to apply
Here are some docs: https://github.com/borkdude/clj-kondo/blob/macros-sci/doc/config.md#hooks
I want to add more examples of other libraries. In fact I want to make documentation sections for library-specific configs. But this should explain how it works.
@dominicm you're right, the example fails with (dispatch x ...)
or (dispatch (some-fn-producing-a-vector))
, so I'll probably just remove it
well, the example is still useful when: 1) the users passes a vector with a keyword, but the keyword is unqualified
although you get limited feedback, still useful, like with many other cases where static analysis can only get you so far
@borkdude Yeah. You just need to be careful about what you lint, I think carefully applied power matters here.
Updated: https://github.com/borkdude/clj-kondo/blob/master/doc/config.md#custom-lint-warnings
Btw you can also specify the types for dispatch
as :vector
but that doesn't say anything about the contents of the vector
Btw, anyone's open source project is using clj-kondo and you want to share the config, do it here: https://github.com/borkdude/clj-kondo/blob/master/doc/config.md#example-configurations