This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-30
Channels
- # announcements (1)
- # babashka (15)
- # calva (3)
- # cider (1)
- # clj-kondo (16)
- # clj-on-windows (1)
- # cljfx (1)
- # clojure (25)
- # clojure-europe (6)
- # clojure-spec (15)
- # cursive (13)
- # emacs (11)
- # fulcro (2)
- # humbleui (7)
- # introduce-yourself (1)
- # jackdaw (1)
- # off-topic (10)
- # pathom (5)
- # portal (3)
- # re-frame (7)
- # reagent (12)
- # releases (1)
- # shadow-cljs (8)
- # tools-build (18)
- # web-security (10)
Not positive if this is the best channel, but I’ve run into a strangeness with Kondo (via LSP) in Emacs. I’m editing a babashka script and kondo appear to work fine with one exception: I have several require
s in my file, always using the :as [thing]
qualifier. All of my references lint ok with the exception of “io.avisio.ansi” (`(require [io.aviso.ansi :as ansi-colors])`). It functions fine in my code (e.g. (str (ansi-colors/bold-white "Hi, I'm bold!"))
, however I can’t get rid of “unresolved var” linting warnings on every use of ansi-colors/***
in my code. All my other requires lint just fine. I believe I’ve deleted all caches everywhere and this still happens.
Has anyone run into anything similar?
Kondo's static analysis cannot understand that, so it doesn't know those names are defined there
well shoot. Ok - well at least I’m not crazy 🙂
Thanks sir
You can exclude that namespace from unresolved var:
:unresolved-var {:exclude [io.aviso.ansi]}
Yeah I’ll probably give that a shot just to clean it up a bit. Thanks.
This is good to know as I start to develop my own libs to keep them linter friendly.
If you are using clojure-lsp, then you could also generate stubs:
https://clojure-lsp.io/settings/#stub-generation
which emit (declare ..)
or (def ...)
just for the purpose linting/completions
It uses this library: https://github.com/clj-easy/stub
Oooh - I hadn’t heard of that (yes I’m using clojure-lsp), will take a look thanks.
@U04V15CAJ Stubs worked a treat. Thansk!
This also is preventing auto-suggestion / completion (which is my primary pain really).