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!
$ rg flatten1
src/main/cljs/cljs/core.cljs
5114:(defn- flatten1
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.
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
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.
True. That's already accounted for in the linter, it will let you do that.
totally possible those aren't used anymore but were in the past