This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-03
Channels
- # announcements (1)
- # babashka (31)
- # bangalore-clj (3)
- # beginners (18)
- # bitcoin (2)
- # calva (14)
- # clj-kondo (37)
- # clojure (43)
- # clojure-europe (4)
- # clojurescript (24)
- # data-science (4)
- # datahike (1)
- # datascript (3)
- # datomic (1)
- # fulcro (16)
- # lsp (13)
- # malli (1)
- # meander (7)
- # off-topic (1)
- # polylith (12)
- # re-frame (7)
- # reitit (1)
- # rewrite-clj (46)
- # rum (4)
- # shadow-cljs (15)
- # specter (3)
- # sql (55)
- # tools-deps (20)
Hey @lee have you considered adding clj-kondo hooks in the rewrite-clj lib via the https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration? This way projects that use rewrite-clj would have the hook auto imported with just a :config-paths
configuration in its clj-kondo config edn
Example https://github.com/nubank/state-flow/tree/master/resources/clj-kondo.exports/nubank/state-flow
Not sure if you already did that or use rewrite-clj hooks manually, is just that I searched on the main branch and didn't find any existing hook
I'm saying that because clojure-lsp, clj-kondo etc would benefit of this without the need of add custom hooks manually 😅
I did have a need for https://github.com/lread/rewrite-cljc-playground/commit/09882e1244a8c12879ef8c1e6872724748e7914b when I was using a custom internal version of import-vars, but I’ve no longer any need for that. But, I guessing that you are only referring to exporting config. This is a clj-kondo feature that I was somehow not aware of 😲. I’ll read up.
yes! with that users would just need to add something like:
:config-paths ["clojure-commons/rewrite-clj"]
@U04V15CAJ may know better how to achieve that 🙂
there’s a handful of macros. https://github.com/clj-commons/rewrite-clj/blob/main/.clj-kondo/config.edn
oh, actually I think this is another issue: https://github.com/clj-kondo/clj-kondo/issues/1143
I mean I would get those when I used potemkin import-vars… before I wrote my clj-kondo hooks.
But… custom-zipper-core is an internal ns. You could use *
variants instead. Like next*
instead of next
etc.
So instead of rewrite-clj.custom-zipper.core/append-child
you’d use rewrite-clj.zip/append-child*
I’ve seen this often in code. Rewrite-clj v0 docs were not very clear on the *
variants.
But if you are using anything https://cljdoc.org/d/rewrite-clj/rewrite-clj/1.0.605-alpha/doc/user-guide#_rewrite_clj_apis, lemme know. Often-times code is unnecessarily using internals.
Anytime! I raised an issue about a https://github.com/clj-kondo/clj-kondo/issues/1197 which might help with this kind of thing.
So would exporting the rewrite-clj clj-kondo config be helpful to anyone? Maybe for the macros?
yes, if there are macros/hooks you use on rewrite-clj, they would be helpful exporting the config
No hooks anymore, just macros. Ok, I’ll raise an issue as a reminder to actually do it!
oh, yeah, I forgot about the lint-as macros clojure-lsp has configured for rewrite-clj:
:lint-as {rewrite-clj.zip/edit-> clojure.core/->
rewrite-clj.zip/edit->> clojure.core/->>
rewrite-clj.zip/subedit-> clojure.core/->
rewrite-clj.zip/subedit->> clojure.core/->>
rewrite-clj.zip.subedit/edit-> clojure.core/->
rewrite-clj.zip.subedit/subedit-> clojure.core/->}
this is a really good change IMO as if rewrite-clj create new macros in the future, they would automatically be included on next releases and users would not need to change their :lint-as
config 😄