Fork me on GitHub
#cljs-dev
<
2019-10-02
>
borkdude15:10:24

I'm writing an "unused private var" linter in kondo right now and testing it on CLJS. It seems there are quite some unused ones:

$ rg extend-object!
src/main/cljs/cljs/core.cljs
3015:(defn- extend-object!

4
😱 4
borkdude15:10:23

$ rg flatten1
src/main/cljs/cljs/core.cljs
5114:(defn- flatten1

borkdude17:10:45

I'm surprised a lot of these private fns aren't used anywhere: https://github.com/clojure/clojurescript/blob/a760439b5084937a556712d6ee056e95f4f075c7/src/main/cljs/cljs/pprint.cljs#L169 Like set-max-column. I must be overseeing something.

borkdude18:10:06

The challenge in this linter is that some private fns defined in .cljc/.cljs may be used in .cljs/.cljc, so it's not just a matter of checking all defs/calls in one file

dmarjenburgh12:10:14

You can also access a private var by using the Var directly, instead of resolving it through a symbol. E.g. (#'some.lib/a-private-fn 1 2 3), which can be called from anywhere.

parrot 4
borkdude12:10:54

True. That's already accounted for in the linter, it will let you do that.

thheller18:10:30

totally possible those aren't used anymore but were in the past