This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-05
Channels
- # announcements (8)
- # asami (70)
- # babashka (28)
- # beginners (163)
- # calva (7)
- # cider (15)
- # clj-kondo (47)
- # cljs-dev (45)
- # clojars (2)
- # clojure (56)
- # clojure-europe (24)
- # clojure-italy (1)
- # clojure-losangeles (2)
- # clojure-nl (4)
- # clojure-spec (2)
- # clojure-uk (53)
- # clojurescript (46)
- # data-oriented-programming (15)
- # data-science (10)
- # datahike (2)
- # defnpodcast (1)
- # depstar (27)
- # emacs (35)
- # figwheel-main (28)
- # fulcro (38)
- # girouette (1)
- # graphql (16)
- # jobs-discuss (3)
- # kaocha (9)
- # keechma (2)
- # leiningen (6)
- # lsp (87)
- # malli (19)
- # membrane (16)
- # pathom (4)
- # re-frame (11)
- # shadow-cljs (25)
- # spacemacs (2)
- # testing (12)
- # tools-deps (14)
- # tree-sitter (4)
- # xtdb (20)
Hey there, trying to read the docs on unresolved-symbol but the link seems to be dead. https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#unrecognized-macros
@jayzawrotny The link should probably go here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md
Thanks, will create a pr for that momentarily. So if I am understanding it right in my ~/.clj-kondo/config.edn I can put the following?
{ :linters {:unresolved-symbol {my-app.utils/current-file [ns-resolve]}}}
:linters
{:unused-import
{:exclude [(my-app.utils [dbg!])]}}
Is there something similar for unused-import? Got a cljs file importing a cljc macro.Can you provide an example? It's unlikely that you will need a config for a referred thing that you actually are using
(ns my-app.utils
(:require-macros
[my-app.utils :refer [dbg!]])
(:require
[cljs.analyzer]))
Ah you want the dgb!
macro available, yes this makes a lot of sense for the config. I do something similar with timbre
@jayzawrotny If that is a .cljc
file then you should use reader conditionals
{:lint-as {kitchen-async.promise/-> clojure.core/->
kitchen-async.promise/let clojure.core/let}
:skip-comments true
:linters
{:unresolved-symbol {:exclude [(my-app.utils/current-file [ns-resolve])
(my-app.utils/dbg! [*file*])]}
:unused-referred-var {:exclude {my-app.utils [dbg!]}}}}
(unless you use self-hosted clojurescript, but even then you can use .clj
for macros)
Clj-kondo assumes code in .cljc
files to be valid for both Clojure and ClojureScript outside conditionals. E.g. future
is unresolved for ClojureScript, hence you write #?(:clj (future :foo) :cljs :foo)
https://code.thheller.com/blog/shadow-cljs/2019/10/12/clojurescript-macros.html#gotcha-4-clj-macros
The key point: > First of all - ClojureScript macros are written in Clojure and run during the ClojureScript compilation on the JVM.
He is not suggesting you need .cljc
, he only writes that you cannot use reader conditionals to achieve a certain goal
btw do you have a sponsorship thing setup for one-off payments? I kind of have an unwritten rule where if I am wasting maintainers time and it turns out to be on me for not understanding or reading the docs: I donate.
If you want to buy me a cup of coffee: https://ko-fi.com/borkdude