Fork me on GitHub
#clj-kondo
<
2022-01-08
>
Mateusz Mazurczak13:01:32

Hi, I use clj-kondo with cursive (clojure-extras). Clj-kondo highlights <! function as an error "Unresolved symbol <!".

borkdude13:01:12

Can you give more context?

Mateusz Mazurczak13:01:34

Whole clojure.core.async library functions are highlighted as unresolved

borkdude13:01:31

ok, let me check how they are defined

Mateusz Mazurczak13:01:58

example: (buffer 5) clj-kondo: Unresolved symbol: buffer

borkdude13:01:13

but how are you importing them

borkdude13:01:33

I need a complete reproduction file to be able to reproduce it locally

borkdude13:01:41

Are you using :refer :all perhaps?

Mateusz Mazurczak13:01:01

Ah yeah, sorry

(ns app.home2.panel
  (:require [app.state.core :as state]
            [app.state.panel :as panel]
            [app.listennotes.search-input-field :as search-podcast]
            [app.audio.upload :as audio-upload]
            [app.view.util :as utils]
            [app.getting-started.wizard :as wizard]
            [app.util :as u]
            [app.util.string :as util-string]
            [cljs-http.client :as http]
            [clojure.string :as str]
            [app.view.colors :as c]
            [ :as home-help])
  (:require-macros [cljs.core.async.macros :refer [go]]))

(defn find-rss-url
  "If the user has provided a website link instead of a RSS feed URL,
   the server tries to find a link to the RSS feed in the website."
  [url]
  (go
    (let [response (<! (http/request
                         {:request-method :post
                          :url "/podcast-import/find-rss-url"
                          :transit-params {:url url}}))]
          (get-in response
              [:body
               :url]))))

borkdude13:01:12

Don't you need to :refer [<!] as well?

☝️ 1
Mateusz Mazurczak16:01:58

Code works without the reference, but this helps with the highlighting error. Thank you very much

borkdude17:01:04

I have no idea why it works without the refer, but you're supposed to do it like this :)

👍 1
Mateusz Mazurczak18:01:20

One more thing in cljs, about js/window.location.hash Some functions from js are not higlighted. (js is not required in any way). But the window.location is highlighted as "cannot be resolved"

Mateusz Mazurczak18:01:33

example: (js/console "smth") <- it's fine (set! js/window.location.hash ..) js/window.location.hash cannot be resolved

borkdude18:01:57

@U0281QDFE1X does it say "clj-kondo" in that message? otherwise it might be coming from Cursive.

borkdude18:01:06

I don't think clj-kondo has a problem with this:

$ clj-kondo --lint - --lang cljs <<< '(set! js/window.location.hash "foo")'
linting took 15ms, errors: 0, warnings: 0

Mateusz Mazurczak18:01:30

Oh right, sorry, it is not clj-kondo

Mateusz Mazurczak18:01:35

Thank you very much for your help

borkdude18:01:36

you can disable the cursive linting separately I think

1