Fork me on GitHub
#clj-kondo
<
2021-03-11
>
Karol Wójcik07:03:58

@borkdude I just want to say that clj-kondo is amazing. Thank you very much for bringing it up to Clojure 🙂 I've just configured static typing with #malli & #clj-kondo in Clojurescript for one of the apps based on Rum. Looks awesome! Looking forward to more features in that area!

🎉 3
Karol Wójcik08:03:18

@borkdude One question though 😄 I have the following definition

{:lint-as {malli.schema/defn schema.core/defn},
 :linters {:type-mismatch
           {:namespaces
            {view.home-page {usp-banner*
                             {:arities {1 {:args [{:op :keys, :req {:user-id :number}}],
                                           :ret :any}}},
                             usp-banner
                             {:arities {1 {:args [{:op :keys, :req {:user-id :string}}],
                                           :ret :any}}}}}}}}
and invocation:
(defn usp-banner*
  [props]
  nil)

(defn usp-banner
  [props]
  (usp-banner {:user-id (:user-id props)})

(usp-banner {:user-id "SomeUserIdAsString") 
As for now clj-kondo does no report the type incompatibility. Is there a plan to support it in a future? 🙂

borkdude08:03:03

No plans in the immediate future. This is quite hard to do with static analysis without building something like TypeScript

Karol Wójcik08:03:35

Actually this would be quite powerful. Typescript for Clojurescript via clj-kondo. There is a huge potential in it 😄

borkdude08:03:22

You may post an issue for this specific example so I can see what can be done realistically

Karol Wójcik08:03:03

Sure! Thank you very much!

gon19:03:09

I'm wondering if (next coll) over (seq (rest coll)) could be a good suggestion candidate for clj-kondo ...

seancorfield20:03:42

I can't say I've ever seen the latter in code... is that something folks actually do?

gon20:03:12

Well, I know at least one that did it... 😁

seancorfield20:03:52

(I just searched all the OSS projects I have locally and our 110K line codebase at work)