This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-16
Channels
- # announcements (3)
- # babashka (25)
- # beginners (71)
- # calva (18)
- # clj-kondo (52)
- # cljs-dev (94)
- # cljsrn (12)
- # clojure (33)
- # clojure-europe (52)
- # clojure-nl (2)
- # clojure-uk (27)
- # clojurescript (18)
- # clojureverse-ops (4)
- # datomic (64)
- # deps-new (27)
- # depstar (5)
- # events (5)
- # fulcro (5)
- # graalvm (12)
- # graalvm-mobile (82)
- # helix (2)
- # introduce-yourself (1)
- # juxt (5)
- # lsp (10)
- # malli (7)
- # missionary (1)
- # off-topic (41)
- # pathom (69)
- # pedestal (6)
- # re-frame (4)
- # reagent (8)
- # releases (9)
- # remote-jobs (8)
- # shadow-cljs (3)
- # sql (46)
- # tools-deps (44)
- # uncomplicate (1)
- # vim (83)
I'm using clojure-lsp for the first time, and I've noticed it triggers something (clj-kondo, I assume) which writes out clj-kondo settings into the current project directory, namely .clj-kondo/com.wsscode/pathom/config.edn
and .clj-kondo/com.wsscode/async/config.edn
. This happens when I run clojure-lsp clean-ns
and .lsp/sqlite.db
does not exist. I already have settings for com.wsscode.pathom in .clj-kondo/config.edn
. I wonder if this behavior is correct, and which of these duplicate settings takes precedent when running clj-kondo (which I do frequently on its own on the command-line and via emacs and flycheck.el)? Should I remove my settings and check-in those under com.wsscode? Is there a recommended best-practice? Or is this a clojure-lsp problem and better asked in #lsp?
@tvaughan This happens when you run clj-kondo with :copy-configs true
. The copied config isn't actually activated until you hook it into your config.edn explicitly
I'm not saying I don't want to. I'm ignorant of this setting. I'm simply confused and looking for clarification on how to handle these duplicate settings
Oh, I got it, it didn't change the .clj-kondo/config.edn but the .clj-kondo/com.wsscode/pathom/config.edn
yeah, that is expected indeed to make clj-kondo understand pathom macros in your code
If removing the copied configs is the right choice, how do I prevent this from happening for other people on the team?
@UKFSJSM38 no, you also want to version hook code
you should check that stuff into git so your team mates are using the same hook code
but it's a choice everyone can make for them selves. I'm in favor of checking it into git
Ah... this might solve a mystery for me, I noticed that during dev of rewrite-clj, I will sometimes see rewrite-clj's configs copied under rewrite-clj's .clj-kondo dir. I'm using Calva these days so it is probably lsp -> clj-kondo with :copy-configs doing this...
so it doesn't hurt necessarily, but those configs are coming from the libraries themselves, so they are likely better than what you have figured out on your own :)
Yes and no. They cover a couple of things I don't have in my settings, but I've also added a hook which is better
I could although I didn't write the hook. Someone shared it on slack and I played beta tester. Been working well for me since
perhaps it was @UCFG3SDFV?
(wasn't me, sorry)
(ns hooks.fulcro
""
{:author "Adam Helins"}
(:require
[clj-kondo.hooks-api :as hook]))
(defn defmutation
[{:keys [node]}]
(let [[_call
sym
& arg+] (:children node)
docstring (first arg+)
[[param+
& fn-like+]
docstring-2] (if (hook/string-node? docstring)
[(rest arg+)
docstring]
[arg+
nil])]
{:node (hook/list-node (concat [(hook/token-node 'defn)
sym]
(when docstring-2
[docstring-2])
[param+
(hook/vector-node (map #(let [[_sym
arg+
& body] (:children %)]
(hook/list-node (list* (hook/token-node 'fn)
arg+
body)))
fn-like+))]))}))
Oh yeah, sorry it seems I didn't see your OP, I thought it was about something else. How can I help you? I haven't done any Fulcro in a while but at that time it was working quite well, at least I didn't have any obvious issue.
Likewise, it’s working well for me too. I think the only issue now is if this hook should be submitted to fulcro or clj-kondo (no clue how this works)
You can read here how it works: https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration
Perhaps @U066U8JQJ can also help you as he has done this before for certain libraries and I think he is involved in fulcro as well...?
Thanks @borkdude. @UCFG3SDFV I’d be happy to make the submission on your behalf if that’s ok with you. Which license would you like to use?
@tvaughan Perfectly fine, it's not much so feel free to rewrite what you want and use any license, I'll trust your judgement 🙂
I didn't PR it because I wasn't sure it was good enough beyond my own workflow and then went to work on something else, haven't been involved with Fulcro since then
@UCFG3SDFV Sounds good 👍
I hadn't create any hooks yet, but Pathom 3 and some libs export the kondo config, the main issue I had when I tried to do that was because I forgot to add resources to the source paths, with that correct it's been working fine