This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-23
Channels
- # announcements (11)
- # babashka (35)
- # beginners (110)
- # calva (2)
- # cider (46)
- # clara (5)
- # clj-kondo (29)
- # cljdoc (4)
- # cljsrn (59)
- # clojure (163)
- # clojure-brasil (3)
- # clojure-europe (24)
- # clojure-italy (2)
- # clojure-nl (10)
- # clojure-sweden (1)
- # clojure-uk (36)
- # clojurescript (58)
- # conjure (24)
- # cursive (19)
- # data-science (14)
- # datascript (1)
- # datomic (10)
- # docker (3)
- # expound (6)
- # figwheel-main (17)
- # fulcro (16)
- # graalvm (1)
- # leiningen (9)
- # malli (11)
- # off-topic (22)
- # parinfer (1)
- # pathom (1)
- # re-frame (18)
- # reagent (18)
- # reitit (3)
- # ring (3)
- # shadow-cljs (8)
- # spacemacs (3)
- # specter (79)
- # sql (20)
- # tools-deps (25)
- # vim (4)
- # xtdb (8)
question about future approaches to macros. does the addition of hooks mean that the https://github.com/borkdude/clj-kondo/blob/master/doc/config.md#unrecognized-macros documented here:
Clj-kondo only expands a selected set of macros from clojure.core and some popular community libraries
will not be supported anymore in favor of us developing our own hooks? my question is if i want to contribute by updating or adding new built-in support for a macro, should i be exclusively developing hooks or will built-in support for libraries like compojure continue to be maintained?
@epransky Macros that are already supported will remain supported. Macros that are very common can eventually move from hooks to built-in supported.
Is there a limitation to why we can't write nodes as plain expressions instead of using the api syntax?
@qythium Yes. I've explained it here: https://blog.michielborkent.nl/2020/06/21/clj-kondo-hooks/
Also this is more performant. Going from rewrite-clj -> sexpr -> hook -> sexpr -> rewrite-clj takes more operations than rewrite-clj -> hook -> rewrite-clj
I wonder if hooks docs should link to your blog, it is very helpful. Either that or extracting a few key phrases from the blog to the hooks docs.
Hey! Does the new hooks API allow for allowing for different linting based off of clojure and clojurescript mode? I have a cljc macro for RPC that boils away the body on the cljs side (and instead does an RPC call) and behaves like a defn on the clj side. Since I'm conditionally requiring the clj libraries, lint-as clojure.core/defn
doesn't work for me.
@rschmukler Currently there is nothing to go by in the hook, but I could add a :lang
key that will contain either :clj
or :cljs
if that's helpful
@borkdude that'd be wonderful! It might also be worth including a :lang-via
which could indicate that the file is cljc
. I'm not immediately sure that this is useful at all, so feel free to consider it and ignore it if you can't think of a use case!
@rschmukler In clj-kondo itself I use a ctx
map which has :base-lang
:cljc
and :lang
:cljs
for example
That's perfect
Also, have you considered somehow allowing libraries to communicate with the hooks library directly? It'd be cool if downloading a library via clojars automatically gave me linting, similar to how typescript allows types to be packaged up in NPM modules.... ie. Could library authors somehow get you clj-kondo hooks for free without requiring you modify the config...
Not sure if it's a road you want to go down, but maybe worth thinking about
I have thought about that: https://github.com/borkdude/clj-kondo/issues/559 For now I suggest library authors to post their configs here: https://github.com/borkdude/clj-kondo/tree/master/libraries Maybe eventually we can have some tool which can inspect the classpath and harvest these configs for you
@borkdude currently this is just a reference right? kondo doesn't merge these configs right?
Hmmmmm and now that I'm thinking about it - giving hooks access to the config could be useful then
ie. imagine if a library auto packages itself with hooks, maybe it has its own clj-kondo settings
I'll check out the issues, thanks for the replies! Super excited for the hooks API, I think it could really be something special if the community widely adopts it
@rschmukler Could you maybe add an issue about those extra keys, in case I forget
Will do!