Just reviewing the docs on custom defnc and reflecting on this line: ~(merge default-opts opts)
. One major downside to this is that you can't do a partial override of the options, e.g. {:helix/features {:define-factory true}}
will accidentally turn off fast-refresh. I was thinking of instead using ~(assoc (merge default-opts opts) :helix/features (merge (:helix/features default-opts) (:helix/features opts)))
on the basis that all the helix features can be turned off as easily as on (e.g. the replace mode isn't required)
Just spotted https://github.com/lilactown/helix/blob/master/resources/clj-kondo.exports/lilactown/helix/config.edn#L1. This didn't work for us, and we ended up expanding to:
(defn ~name [& ~@args] ~@body)
This fixed the factory usage, where you might have (defnc foo [props ref])
But you're supposed to call it as (foo {:ref …})
which then upsets kondo about missing arguments.
Just one to ponder, no real action.ack, thanks!
I would accept PRs for both of those improvements
I'm still a little fuzzy on the clj-kondo config.
@dominicm @lilactown not sure if is the issue here, but I have two things that help me to make the foreign clj-kondo config works:
1. on the Helix side, make sure resources
is present on classpath
2. on the project client side, use clj-kondo --copy-configs --dependencies --lint "$(clojure -Spath -A:provided:dev)" --parallel
to make kondo copy over the configs
@lilactown You'll need to use hooks. Although for usage via $
clj-kondo only cares that there's a var in place (e.g. it could be expanded to (def name nil)
). It depends how much you care about finding mistakes vs just making the warnings go away 🙂
Regarding location, I might be inclined to just stick the clj-kondo.exports in the src folder tbh. There's no real advantage to separating them out.
it would be pretty cool to add analysis for $
but that’s fraught. not all props are necessary, and & merge obfuscates compile-time analysis
to fix 1
, Helix needs to add resources
here: https://github.com/lilactown/helix/blob/master/deps.edn#L1
ack, i did forget that
I think @dominicm’s point was that even once he was able to use the config I tried to ship with helix, clj-kondo was complaining due to the fact that they're using defnc's factory function feature flag
not sure how to support both tbh