Hi @borkdude
Looks like I cannot disable :unresolved-namespace
linter using namespace meta.
(ns dev.playground
{:clj-kondo/config {:linters {:unresolved-namespace {:level :off}}}})
(clojure.java.shell/sh "whoami")
> warning: Unresolved namespace clojure.java.shell. Are you missing a require?
But the option works when placed in the main config.@serioga I also noticed that myself and created an issue for it: https://github.com/borkdude/clj-kondo/issues/870
Follow up question: why would you like to turn it off?
I have a single file for experiments in my project. So I don't want to see warnings when I check whole project.
@serioga You can also ignore that file with clj-kondo --lint "$(clj -Spath)" --config '{:output {:include-files ["^clojure/test"] :exclude-files ["tap"]}}'
Also I think it would be useful to be able to specify exact namespaces to ignore. Especially those which are preloaded using profiles.clj.
> You can also ignore that file not sure I want to ignore it completely when editing ๐
ok, then you'll have to wait for #870 ๐
no problem ๐
> it would be useful to be able to specify exact namespaces to ignore what do you think about this?
yeah, that makes sense
post it in another issue
so far I didn't need that myself yet though
can you give a good realistic example ?
especially this is annoying inside comment
, where Cursive and clj-kondo cannot agree about used/unused namespace aliaces
you can turn linting off in comment if you want
> can you give a good realistic example ? I'll prepare in the ticket
> turn linting off in comment also bad option, this helps to keep commented code in sync
yes, I prefer to keep it on as well, but personally I don't have any conflicts with unresolved namespaces in comment sections
so I'm curious about your example
Also maybe it would be useful to print linter ID with message. It's tricky to find exact configuration option from the message.
@serioga you can also output as JSON or EDN, this will also print the name of the linter
also, there's a link on config.md
that points to all available linters
Maybe there can be a setting to turn it on, I think I wouldn't like it by default
I know about config.md
.
But having message "Unresolved namespace" I cannot find this text there.
So for me the most reliable way it to dig into source code ๐
> you can also output as JSON or EDN and how to enable EDN output?
ah, found
> you can also output as JSON or EDN well, it's acceptable for debugging
@serioga It is documented at the top of config.md
how to find those names.
It has a link to the source where all these keys are defined.
@borkdude
> It is documented at the top ofย config.mdย how to find those names.
Can you point me to exact text?
The use-case: I see a message warning: Unresolved namespace clojure.java.shell. Are you missing a require?
. How can I find corresponding linter ID from config.md
or linked configuration file?
@serioga "Look at the default configuration for all available options." There is a link in that sentence
Yes, it is liked to https://github.com/borkdude/clj-kondo/blob/master/src/clj_kondo/impl/config.clj
But where is no text Unresolved namespace
there!
My point is that I should guess linter ID from the message, but I cannot find exact text there, which is located in https://github.com/borkdude/clj-kondo/blob/36c0e7ce65521c0b7eb3a09c787ddf7e9b6d4219/src/clj_kondo/impl/linters.clj
But anyway I'm fine with EDN output as workaround
ok, cool
I suppose the first person to get their funky macro shape into kondo wins. The trick is to identify a popular macro that doesn't work in kondo with any existing vars, and then name make a library with (defmacro dominic-rules)
and then add that to kondo. Then when users of the popular library add the macro alias, they will add it as popular/library dominic-rules
. ;)
๐