clj-kondo

https://github.com/clj-kondo/clj-kondo
borkdude 2020-06-21T10:13:43.468900Z

Example config for the Rum library: https://github.com/borkdude/clj-kondo/tree/master/libraries/rum cc @martinklepsch @robert-stuttaford

borkdude 2020-06-21T12:03:15.469100Z

clj-kondo v2020.06.21 introduces a new hooks API which allows writing code to support custom macros https://github.com/borkdude/clj-kondo/releases/tag/v2020.06.21 This work was sponsored by Clojurists Together as part of their Summer of Bugs program. Thanks!

dominicm 2020-06-21T14:21:57.469600Z

Gonna give this a spin, today

dominicm 2020-06-21T16:21:15.470300Z

How do I debug a hook? Like, check the output?

borkdude 2020-06-21T16:25:44.470700Z

@dominicm Try (prn (api/sexpr node))

borkdude 2020-06-21T16:25:49.470900Z

Blogged about the new feature here: https://blog.michielborkent.nl/2020/06/21/clj-kondo-hooks/

yuhan 2020-06-21T19:27:07.477300Z

The new hooks API looks interesting! One thing that wasn't clear to me from reading the documentation was whether clj-kondo treats the auxillary files in .clj-kondo as regular namespaces? Eg. If I write my library and put its macroexpand definitons in .clj-kondo/foo.clj, does that conflict with another library's definitions in the same foo ns? Wondering why this isn't namespaced the conventional way with the library name: https://github.com/borkdude/clj-kondo/blob/master/.clj-kondo/macroexpand/one_of.clj

borkdude 2020-06-21T19:46:47.478400Z

@qythium clj-kondo doesn't execute any other files than those in .clj-kondo and since there can only be one .clj-kondo/foo.clj file at the same time, there isn't any conflict

borkdude 2020-06-21T19:47:26.479100Z

and you can load that file using (require 'foo) or refer to it from the config as foo/foo (assuming it has a function foo). having said that, it's a good habit to use at least two segments in a namespace

lread 2020-06-21T23:09:41.480700Z

Thanks for the new linting power @borkdude! I’ll see if I can get it working on rewrite-cljc’s internal import-vars-with-mods macro!

yuhan 2020-06-21T23:32:35.480900Z

Is this true even when different libraries both have their own .clj-kondo subdirectories?

yuhan 2020-06-21T23:38:55.481100Z

Sorry, maybe I'm misunderstanding the mechanism for 3rd-party libraries to provide hooks - do they all have to be added via PR to the clj-kondo repo? And curated such that libraries/***/.clj-kondo/hooks/common-name.clj does not conflict

yuhan 2020-06-21T23:42:13.482600Z

Also, where does one find the actual API for clj-kondo.hooks-api ? I couldn't find such a namespace defined in the clj-kondo repo, only usages of it.