This project uses clj-kondo analysis :)
Hi. Quick question about unused cljs requires! :)) The following seems to elicit a false positive:
[react-autosuggest :as AutoSuggest] > warning: namespace react-autosuggest is required but never used
There's also an erroneous 'Unresolved symbol' in one of the two places AutoSuggest
is passed as a component to https://github.com/lilactown/helix/blob/master/docs/creating-elements.md#-macro $
(???):
($ AutoSuggest > error: Unresolved symbol: AutoSuggest
{:suggestions ...
...
($ AutoSuggest {:getSuggestionValue get-suggestion-value ...
Now, https://www.npmjs.com/package/react-autosuggest (see pic below) kinda suggests that I should be doing [react-autosuggest :refer [Autosuggest]]
or something, not :as
. But making this change (and accounting for AutoSuggest
-> Autosuggest
) breaks things. (Separate issue, but probably because of helix...)
So it could be that react-autosuggest
is just strange (and I should add an inline reader comment or do some other config, say). Or maybe kondo doesn't realise react-autosuggest
is a js module, not a ns? Or something else?Also, my bad if this is more appropriate for #clojurescript! 🙂
Or #helix, for that matter...
@carnunmp Let's start with the first issue
Can you make a full .cljs minimal repro for me?
For sure. On it! 🙂
This seems to do it @borkdude: https://github.com/CarnunMP/kondo-repro
In fact, both the 'required but never used' warning and the 'Unresolved symbol' error show up:
@carnunmp Yeah, this is a known issue. You should use a string namespace when using npm deps.
(ns hello
(:require ["react-autosuggest" :as AutoSuggest]))
(defn x
[]
(AutoSuggest))
This way clj-kondo can distuingish between normal cljs deps and npm deps
🙏
Good to know! Thanks. :)))