helix

https://github.com/Lokeh/helix
dominicm 2021-06-04T08:41:27.098900Z

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)

dominicm 2021-06-04T12:36:54.102500Z

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.

lilactown 2021-06-04T18:09:18.102800Z

ack, thanks!

lilactown 2021-06-04T18:09:47.103200Z

I would accept PRs for both of those improvements

lilactown 2021-06-04T18:09:59.103500Z

I'm still a little fuzzy on the clj-kondo config.

wilkerlucio 2021-06-04T18:47:26.104700Z

@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

dominicm 2021-06-05T07:34:16.105800Z

@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 🙂

dominicm 2021-06-05T07:34:46.106Z

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.

lilactown 2021-06-05T18:23:26.106600Z

it would be pretty cool to add analysis for $

lilactown 2021-06-05T18:24:21.107800Z

but that’s fraught. not all props are necessary, and & merge obfuscates compile-time analysis

wilkerlucio 2021-06-04T18:48:03.104900Z

to fix 1, Helix needs to add resources here: https://github.com/lilactown/helix/blob/master/deps.edn#L1

lilactown 2021-06-04T19:32:11.105200Z

ack, i did forget that

lilactown 2021-06-04T19:33:28.105400Z

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

lilactown 2021-06-04T19:33:35.105600Z

not sure how to support both tbh