clj-kondo

https://github.com/clj-kondo/clj-kondo
Karol Wójcik 2021-03-11T07:45:58.285300Z

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

🎉 1
Karol Wójcik 2021-03-11T08:15:18.285500Z

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

borkdude 2021-03-11T08:44:03.285800Z

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

Karol Wójcik 2021-03-11T08:46:35.286Z

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

borkdude 2021-03-11T08:48:22.286200Z

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

Karol Wójcik 2021-03-11T08:49:03.286400Z

Sure! Thank you very much!

gon 2021-03-11T19:57:09.289200Z

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

seancorfield 2021-03-11T20:19:42.289900Z

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

seancorfield 2021-03-11T20:20:52.290400Z

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

gon 2021-03-11T20:59:12.290800Z

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