This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-11
Channels
- # adventofcode (33)
- # babashka (1)
- # beginners (11)
- # biff (3)
- # calva (2)
- # cider (24)
- # clj-kondo (9)
- # cljfx (5)
- # clojure (39)
- # clojure-austin (2)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (22)
- # clojure-uk (10)
- # community-development (18)
- # data-science (24)
- # datahike (3)
- # events (3)
- # hyperfiddle (11)
- # lsp (22)
- # malli (3)
- # matrix (1)
- # off-topic (24)
- # other-languages (3)
- # overtone (7)
- # pathom (5)
- # reitit (2)
- # shadow-cljs (34)
- # sql (20)
- # squint (13)
Is it possible in a clj-kondo hook to instruct clj-kondo that a macro parameter is expected to have a certain type?
you can use a hook to check the type of the input and then emit a warning if it doesn't conform
also it is possible to declare types for your macro or function arguments using this: https://github.com/clj-kondo/clj-kondo/blob/master/doc/types.md
> you can use a hook to check the type of the input and then emit a warning if it doesn’t conform Nice, but this wouldn’t work if the macro receives a variable or an expression. > also it is possible to declare types for your macro or function arguments using this This is cool, I’ll try this.
Macro arguments are never evaluated so whatever you pass as a form, that is the type
Exactly, but I’ve seen clj-kondo being able to hint something like
(def x 5)
(format x)
Expected: string, received: positive integer.
for the 2nd line while the macro would only see a symbol.What if it was? I. e. is there no linting on macro arguments similar to how it is done for functions?