This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-08-01
Channels
- # announcements (4)
- # babashka (12)
- # calva (8)
- # clj-kondo (40)
- # clojure (39)
- # clojure-europe (23)
- # clojure-losangeles (1)
- # clojure-nl (1)
- # clojure-norway (52)
- # clojure-uk (3)
- # community-development (6)
- # cursive (1)
- # datomic (14)
- # devops (1)
- # gratitude (21)
- # humbleui (7)
- # hyperfiddle (7)
- # introduce-yourself (2)
- # java (5)
- # portland-or (4)
- # shadow-cljs (69)
- # tools-deps (4)
- # xtdb (6)
Also a nice addition for the analysis (lsp): @inc
wasn't previously recognized as a call to clojure.core/deref, now it is
cc @UKFSJSM38

Thanks for the update! Came back from vacation to see linting took 4652ms, errors: 972, warnings: 7
haha :face_with_hand_over_mouth: Using mount.lite
with @ to deref the defstates it creates.
<@U04V15CAJ> is there an exclude option for _`:type-mismatch` ? I tried, but doesn't work. `<http://mount.li|mount.li>_te/defstate` is linted as `_clojure.core/_def` but is of type `mount.lite.State` . State is a record of protocol IState, this record also contains IDeref. You can deref it to retrieve the contents.
Example:
_(*deref* db/_datasource_)_
/ @db/datasource
returns:
_{:datasource #_object _[_com.zaxxer.hikari.HikariDataSource
0x30975b87
"HikariDataSource (HikariPool-1)"_]}_
This gets flagged by clj-kondo with: Expected: deref, received: map.clj-kondo(type-mismatch)
yes, you can override type mismatch:
{:linters {:type-mismatch {:namespaces {'clojure.core {'deref {:arities {1 {:args [:any]}}}}}}}}
from the top of my headI think the issue might have arisen from the hooks which make clj-kondo think defstate returns a map, possibly: https://github.com/aroemers/mount-lite/blob/2.x/resources/clj-kondo.exports/functionalbytes/mount-lite/hooks/lite.clj
The point isn't what happens in reality, but what clj-kondo thinks is happening, due to those hooks
you can also try to override the type of defstate
:
{:linters {:type-mismatch {:namespaces {'mount.lite {'defstate {:arities {:varargs {:ret :any}}}}}}}}
@U02CX2V8PJN you can try the version from my PR here: https://github.com/aroemers/mount-lite/pull/31
actually this is a better solution: https://github.com/aroemers/mount-lite/pull/31/commits/a1520a46c1da6195bc37a9e5b2682ee977f5dd66
Maybe @U050RCD9L can merge the PR and do a release?
Linter idea: ability to put minimum version of clj-kondo into config and fail when checked by an older version of clj-kondo. Perhaps add as part of the clj-kondo config linter?
there's a similar mechanism in babashka for the version comparison etc, probably that code can be borrowed/copy-pasted
This would be very welcome. I was confused why a check was failing in CI when it passed locally, and it turned out to be exactly this: CI version of clj-kondo was older than my local one.