This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-22
Channels
- # announcements (4)
- # babashka (1)
- # beginners (35)
- # biff (1)
- # calva (34)
- # clj-kondo (21)
- # clojure (38)
- # clojure-europe (49)
- # clojure-norway (8)
- # clojurescript (12)
- # emacs (21)
- # events (1)
- # fulcro (16)
- # joyride (1)
- # malli (1)
- # nbb (7)
- # observability (2)
- # pathom (4)
- # polylith (6)
- # reagent (4)
- # releases (1)
- # shadow-cljs (16)
- # squint (23)
- # tools-build (7)
Clj-kondo configs
https://github.com/clj-kondo/configs
A repository with clj-kondo configurations for libraries, as dependencies
@alex.sheluchin I think we could add a dependency to that project with community aliases instead of building them into clj-kondo, like you requested. This seems more flexible
So then you can add io.github.clj-kondo/config-bbatsov-clojure-style-guide
to your deps and it will "just work"
I see @seancorfield also accepted a PR in that repo. Do you think that would be a good idea?
@U04V15CAJ Thank you! I think this is a fine approach for my use case. @UEENNMX0T raised a concern about using it in this way when installing clj-kondo as a bin rather than a project dep. Will a bin kondo not pick up on configs installed this way? I'm not sure I fully understand the difficulty there.
I think an automated checker for the style guide would be awesome, if it's possible.
@seancorfield @alex.sheluchin OK, you can try to add:
io.github.clj-kondo/config-bbatsov-clojure-style-guide-aliases {:mvn/version "0.1.1"}
to your project dependencies and then restart your clojure-lsp, or run: clj-kondo --lint $(clojure -Spath) --dependencies --skip-lint --copy-configs
and then you should get a warning like this:I noticed that Alex uses jio
a lot for
so I think there will never be 100% consensus about these things, I'd rather leave it as an optional library than baking it in
The library comes from here: https://github.com/clj-kondo/configs/tree/main/configs/bbatsov/clojure-style-guide-aliases If you want to provide more configurations for other libraries that you don't manage yourself, then this is the place to do so, if the original maintainer doesn't want to have it in their repo
Thanks for the instruction, @U04V15CAJ. I'll probably have time to try it tomorrow. I'm planning on showing a breakdown of aliases per namespace so maybe that will help promote a consensus, but it'll probably never be 100%. That's okay, choice is good :man-shrugging:
We only have a few standard aliases at work, for third party libs (we have quite a few for our own nses):
clojure.data.json json
clojure.spec.alpha s
clojure.string str
com.stuartsierra.component component
exoscale.coax c
next.jdbc jdbc, next.jdbc.result-set rs, next.jdbc.sql sql
ring.util.response resp
And that would override the style guide ones?
:linters
{:consistent-alias
{:aliases
☝️:skin-tone-2: is the fragment above what I posted.@U04V15CAJ works nice 👍 thank you. I guess I can close https://github.com/clj-kondo/clj-kondo/issues/1839 as completed?
Seems to work nicely -- thanks! I was a bit surprised that clojure.data.json
wasn't aliased to json
but it isn't in the guide (only because cheshire.core
is aliased to json
lower down and I didn't want to introduce a conflict when I did that).
@seancorfield @alex.sheluchin OK, you can try to add:
io.github.clj-kondo/config-bbatsov-clojure-style-guide-aliases {:mvn/version "0.1.1"}
to your project dependencies and then restart your clojure-lsp, or run: clj-kondo --lint $(clojure -Spath) --dependencies --skip-lint --copy-configs
and then you should get a warning like this: