tolitius / mount

managing Clojure and ClojureScript app state since (reset)
Eclipse Public License 1.0
1.23k stars 89 forks source link

Clj-kondo warning on defstate deref. #136

Closed Kaspazza closed 1 day ago

Kaspazza commented 2 months ago

When doing deref on defstate variable clj-kondo throws warning that the deref is done on the return value. Not understanding it is an atom.

(defstate routes
          :start
          (do ["a" "b"]) )

  @routes 

Message: "Expected: deref, received vector. [type-mismatch]

or

(defstate routes
          :start
          (prn "hello"))

  @routes 

Message: "Expected: deref, received nil. [type-mismatch]

tolitius commented 2 months ago

thanks for reporting this and #135

I don't use clj-kondo, and I use vim, so could not really test it

"clj-kondo support" was introduced by these commits: 1, 2, 3

@NoahTheDuke, @rajcspsg can you help?

if we are unable to solve this, I would need to back our those commits, so it does not impact others

NoahTheDuke commented 2 months ago

Yeah I can fix this tomorrow.

tolitius commented 2 months ago

@NoahTheDuke did you have a chance to look at it?

let me know if you did not, I'll revert the "clj-kondo" commits for now until you have time

NoahTheDuke commented 1 week ago

@tolitius my apologies for the delay, I've put up a new PR to handle this and the other issue related to clj-kondo