This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-26
Channels
- # aleph (9)
- # announcements (31)
- # babashka (23)
- # beginners (35)
- # biff (2)
- # calva (5)
- # cider (10)
- # clara (11)
- # clerk (114)
- # clj-kondo (18)
- # cljdoc (37)
- # clojars (7)
- # clojure (24)
- # clojure-austin (10)
- # clojure-europe (27)
- # clojure-nl (1)
- # clojure-norway (23)
- # clojure-uk (2)
- # clojurescript (18)
- # conjure (2)
- # core-async (6)
- # cursive (21)
- # datomic (3)
- # fulcro (15)
- # introduce-yourself (7)
- # lsp (32)
- # malli (57)
- # meander (5)
- # music (1)
- # nbb (2)
- # off-topic (17)
- # pathom (6)
- # rdf (4)
- # reagent (8)
- # releases (2)
- # shadow-cljs (4)
- # slack-help (23)
- # spacemacs (6)
- # tools-build (32)
Hi everyone, I have a library and I wanna configure clj-kondo on library level so all library consumers will not need to add that configuration into their projects. What I do is ns-level config in library
{:clj-kondo/config '{:lint-as {...}}}
but when this library is used in another project, this config is ignored so I have to copy that into that project config.Hey @U4BEW7F61 - that config only applies to the code being linted there. If you want to export configuration you can do that like this: https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration
If you have a more concrete example of what your project / config looks like, that will help guide you further
thanks @U04V15CAJ, documentation you mentioned completely covers my case
odd… in https://github.com/mentat-collective/Mafs.cljs, when I run
clj-kondo --lint src
I see
src/mafs/debug.cljs:6:22: warning: Unresolved var:
src/mafs/line.cljs:14:14: warning: Unresolved var:
src/mafs/plot.cljs:16:10: warning: Unresolved var:
linting took 40ms, errors: 0, warnings: 3
but when I run on the specific file:
clj-kondo --lint src/mafs/debug.cljs
I see
linting took 13ms, errors: 0, warnings: 0
yes, it seems so, if I pull the var reference outside of defcomponent it works:
m/Debug
(defcomponent TransformWidget
(.-TransformWidget m/Debug))
okay, I’ll check it out!
Linter idea: in test/is
, if the assertion is a list and the function is =
and there are two entries and one of the entries is a data literal, make sure it's in the first position. aka (is (= 4 (+ 2 2)) "this is good")
vs (is (= (+ 2 2) 4) "this is bad")
. maybe allow customization in the linter to say whether to put the literal first or second?
It’s probably been brought up a bunch of times. But is there some concept of “fixing” certain linting mistakes? example: we have some discoruaged vars config like:
:discouraged-vars {my.thing/plus {:message "use our.new.thing/plus instead of my.thing/plus"}
...
}
It would be kinda cool to be able to put in, idk. A default value or even a rewrite-clj function/hook that could be run to “solve” certain linter issues.
Is there somwehre I can learn more about this imaginary mechanism if it exists, and/or the reasons behind not offering it?The fixing can be done by taking the linter output programmatically, taking those locations with you and then write some rewrite-clj code. The same approach is taken in e.g. carve and clojure-lsp
Another small example: https://github.com/babashka/babashka/blob/master/examples/normalize-keywords.clj