This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-28
Channels
- # announcements (12)
- # babashka (87)
- # beginners (84)
- # calva (22)
- # circleci (4)
- # clj-kondo (46)
- # cljdoc (6)
- # cljsrn (15)
- # clojure (87)
- # clojure-europe (18)
- # clojure-uk (7)
- # clojurescript (20)
- # community-development (3)
- # conjure (1)
- # cursive (13)
- # datomic (14)
- # events (7)
- # fulcro (27)
- # graphql (31)
- # helix (8)
- # jobs-discuss (1)
- # lsp (43)
- # malli (11)
- # meander (64)
- # off-topic (7)
- # pathom (26)
- # polylith (9)
- # practicalli (2)
- # re-frame (33)
- # reagent (2)
- # reitit (5)
- # releases (2)
- # rewrite-clj (2)
- # shadow-cljs (69)
- # specter (5)
- # sql (1)
- # tools-deps (85)
- # tree-sitter (1)
- # vim (3)
@ps @jimka.issy @dave et al, I have merged the macroexpand feature to master and wrote some docs in the issue here: https://github.com/clj-kondo/clj-kondo/issues/1327#issue-952124466
I just tried it with the latest clojure-lsp, and it works like a charm. Fantastic work! 💯
ah well, I guess I will just release this and then gather some feedback until the next release
clj-kondo produces a duplicate require warning for a babashka script, is that intended?
@martinklepsch can you post that code here?
I'm about to release clj-kondo, so be fast @martinklepsch
Actually I now ran clj-kondo from the CLI and it didn’t complain so I think it’s probably an issue with the action (old version I guess?)
It seems to use the clj-kondo docker image though https://github.com/DeLaGuardo/clojure-lint-action/blob/master/Dockerfile
Just released a new version of clj-kondo with the new macroexpansion feature; https://clojurians.slack.com/archives/C06MAR553/p1627470400150500
set up: i have a macro game.macros/req
, and i’m using potemkin to import-export it into game.core
. It’s anaphoric, so defines a bunch of vars in a let
that are available to the code it wraps: (req (+ (:credits corp) 5))
works because corp
is defined by req
. in my .clj-kondo/config.edn
, i have {:linters {:unresolved-symbol {:exclude [(game.macros/req [corp ...])]
so as to ignore those symbols. if I use (:require [game.macros :refer [req]])
, the linters work correctly. however, if I put in my config.edn {:lint-as {game.core/req game.macros/req}}
, and change the require to be (:require [game.core :refer [req])
, all of the req
calls are flagged as using undefined symbols
short version: how do I make :lint-as
work? it seems that :lint-as
doesn’t check the :linters
rules when determining how to lint as another macro
@nbtheduke Can you post an issue + repro about this?
i’ll see what I can do about a repro, the project this is happening in is pretty big
I think the main issue is that unresolved-symbol doesn't look at lint-as first or so
I gave a read to https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md#macroexpand I'm curious, is clj-kondo macroexpanding arbitrary macros now? (would be happy about that) Any limitations or nuances?
ok that was what I was asking, i.e. is everything macroexpanded or only when integrated with the hook feature
would be out of the question to macroexpand everything? A few of us use clj-kondo in CI, sometimes with vanilla jvm clojure
executing all macros isn't possible since some of them do things at runtime other than a pure transformation
well, even then it might fail in some cases. I think the new feature should get some more exposure first before taking that next step
one could also think of some rewrite-clj script that automatically copies some macros to the config
the new feature should be considered as an "easy" trade-off to the more reliable :analyze-call feature at the cost of less precise location info in lint warnings
for people who don't want to take the time to deal with :analyze-call, or find it daunting
eventually clj-kondo may support it out of the box, but it may also be a little bit of a rabbit hole to have to support it perfectly, so let's see what happens next
sorry borkdude, but the new tools release means :sha is no longer a requirement, https://github.com/clj-kondo/clj-kondo/blob/626978461cbf113c376634cdf034d7262deb429f/test/clj_kondo/deps_edn_test.clj#L27