metosin / malli

High-performance data-driven data specification library for Clojure/Script.
Eclipse Public License 2.0
1.46k stars 208 forks source link

Add clj-kondo support for cljs function schemas #827

Closed dvingo closed 1 year ago

dvingo commented 1 year ago

Figured out a way to piggy-back on the shadow-cljs implementation in order to get the cljs schemas in a browser access to the filesystem so kondo config can be saved!

One question this brings up is when you're running malli.dev/start! from both clj and cljs the last one to write the file will win. I'm not sure a good solution other than attempting to perform a merge with the existing schemas instead of overwriting them.

https://github.com/metosin/malli/issues/828

dvingo commented 1 year ago

hmm, just realized there is an annoying issue with this approach. when you don't add the hook you'll see a shadow-cljs warning:

2023-01-28 10:54:31.730 - WARNING] :shadow.cljs.devtools.server.worker.impl/unhandled-op - {:op :malli.clj-kondo/write-config, :build-id :main, :data {:linters {:unresolved-symbol {:exclude [(malli.core/=>)]}, :type-mismatch {:namespaces {co.app.model {make-entity {:arities

I have another approach I can try, where the build hook can use cljs-eval to ask the browser for the kondo data. I suppose going with that approach will be better then to not have to deal with this warning.

dvingo commented 1 year ago

closing in favor of https://github.com/metosin/malli/pull/829