qa

Call out for QA, testing new features in Clojure projects
borkdude 2019-05-31T09:00:57.000900Z

I’m about to release a new version of clj-kondo this weekend with detection for unused bindings (function arguments, let bindings, etc.) I’d appreciate it if someone would test this, since I refactored quite a bit of code…. So if you’re bored… 🙂 The binaries for Mac and Linux can be found at the top comment in this issue: https://github.com/borkdude/clj-kondo/issues/173

john 2019-05-31T14:42:39.004Z

The only thing that confuses me is I can't tell if the missing j refers to the :keys vector or to the structure of the map on the right.

borkdude 2019-05-31T14:43:36.004700Z

the :keys vector

john 2019-05-31T14:43:40.004900Z

And the fact that i is a :i in the :keys vector is a keyword adds a little confusion for me.

john 2019-05-31T14:44:25.005600Z

Huh, I didn't know you could put keywords in there

john 2019-05-31T14:44:50.006200Z

Well, in that case, it makes more sense

borkdude 2019-05-31T14:44:51.006300Z

I was hoping the word destructured would make it clear it was about the :keys vector

john 2019-05-31T14:45:50.007Z

Yeah, I guess I was only thrown off by the :i in keys. I usually do :keys [i] ...

john 2019-05-31T14:46:29.007400Z

So I was expecting i to throw that error before j

borkdude 2019-05-31T14:46:58.007600Z

@john you can even put namespaced keywords there, so:

(let [{:keys [:person/name]} {:person/name "Rich"}] name)

john 2019-05-31T14:48:32.008500Z

yeah, interesting :thinking_face:

borkdude 2019-05-31T14:48:36.008600Z

or:

(let [{:person/keys [name address]} #:person{:name "Rich" :address "Some city"}] [name address])
["Rich" "Some city"]

john 2019-05-31T14:49:21.009Z

oh, I like that... can you have multiple :some-ns/keys instances?

borkdude 2019-05-31T14:49:27.009200Z

yeah 🙂

john 2019-05-31T14:49:30.009400Z

nice!

john 2019-05-31T14:50:43.010400Z

I like that better than having to destructure namespaced keys key by key

john 2019-05-31T14:51:12.010900Z

So to answer your question, given that knowledge, I say the error message makes sense

borkdude 2019-05-31T14:51:33.011100Z

kcool 🙂

borkdude 2019-05-31T16:38:19.012600Z

@stefan.van.den.oord thanks for the feedback. where is this syntax for CLJS documented? (:require ["react-native-view-overflow" :default ViewOverflow])

Stefan 2019-05-31T16:38:58.013Z

It’s from the shadow-cljs user manual: https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages

Stefan 2019-05-31T16:39:08.013300Z

First line in table 1

borkdude 2019-05-31T16:39:23.013500Z

oh shadow-cljs

Stefan 2019-05-31T16:39:50.014Z

:the_horns:

borkdude 2019-05-31T16:39:50.014100Z

how are you using this default? is that like an alias?

Stefan 2019-05-31T16:40:13.014500Z

It’s the equivalent of this in JS: import defaultExport from "module-name"

Stefan 2019-05-31T16:40:37.015300Z

Some 3d party modules export their stuff as default, which is considered old fashioned, but what can you do 😕

borkdude 2019-05-31T16:40:40.015500Z

let me ask the question another way: how can clj-kondo know that you are using the namespace 🙂

Stefan 2019-05-31T16:41:00.015800Z

By detecting that I’m using the ViewOverflow thing.

borkdude 2019-05-31T16:41:10.016200Z

ok, so it’s like :refer in that regard

Stefan 2019-05-31T16:41:17.016500Z

e.g. [:> ViewOverflow ... ]

Stefan 2019-05-31T16:41:24.016700Z

Yeah I guess…

borkdude 2019-05-31T16:41:31.016900Z

ok, I’ll make a different issue for this

borkdude 2019-05-31T16:41:58.017600Z

for now you can add this namespace to the ignored namespace using some config: https://github.com/borkdude/clj-kondo/blob/master/doc/config.md#exclude-required-but-unused-namespace-from-being-reported

👍 1
Stefan 2019-05-31T16:42:08.018100Z

While you’re at it, you may have a look at the other constructs in that table, e.g. :rename, if you don’t support that yet…

borkdude 2019-05-31T16:42:32.018600Z

:rename is standard Clojure, that’s already supported

Stefan 2019-05-31T16:42:37.018800Z

oh ok 🙂

Stefan 2019-05-31T16:43:14.019200Z

Soooo many ways to do things in JS, you gotta love it 😉

borkdude 2019-05-31T16:44:01.019700Z

I wonder why shadow-cljs adds a different thing instead of :refer though

borkdude 2019-05-31T16:44:14.019900Z

you can just use refer I guess?

borkdude 2019-05-31T16:45:16.020100Z

I’ll ask in #clojurescript

Stefan 2019-05-31T16:46:06.020300Z

or ask in #shadow-cljs

borkdude 2019-05-31T16:48:48.020900Z

does your code still work when you use :refer? because then my suggestion would be to just use that and not introduce deviations from standard CLJS

Stefan 2019-05-31T16:53:25.021200Z

No, that doesn’t seem to work…