clj-kondo

https://github.com/clj-kondo/clj-kondo
Felipe Marques 2021-05-19T17:21:10.016500Z

Hi, everyone, Is there some lib or rewrite-clj script that performs some basic fixes like remove unused namespaces or remove unused binding reported by clj-kondo?

borkdude 2021-05-19T17:22:05.017200Z

Perhaps there are also girls here :) I think #lsp can possibly help you with that. Unused namespaces for sure.

Felipe Marques 2021-05-19T17:22:46.017600Z

Sorry! 😅 Going to use a more gender neutral term next time!

borkdude 2021-05-19T17:22:52.017900Z

In the future https://github.com/borkdude/carve may also try to do this, but it doesn't currently

borkdude 2021-05-19T17:23:27.018400Z

No worries, I just want to make sure that there can also be girls here :)

Felipe Marques 2021-05-19T17:23:47.018700Z

Cool! Thanks for the info, going to take a lot in it.

Felipe Marques 2021-05-19T17:24:06.018800Z

You're are totally right!

lilactown 2021-05-19T17:42:15.020100Z

I've just started using clj-kondo and I'm trying to figure out how to configure it in our monorepo

lilactown 2021-05-19T17:45:40.022400Z

is there a way for clj-kondo to tell me what config file it is detecting?

borkdude 2021-05-19T17:46:13.022800Z

@lilactown clj-kondo walks up to the first .clj-kondo dir it encounters

1
borkdude 2021-05-19T17:46:48.023200Z

personally I create a .clj-kondo for each project in a mono-repo

lilactown 2021-05-19T17:47:13.023400Z

why is that?

lilactown 2021-05-19T17:47:47.023600Z

we have a lot of projects 😬

borkdude 2021-05-19T17:48:35.023900Z

smaller configs have better startup time :)

borkdude 2021-05-19T17:48:47.024300Z

also we have some projects with overlapping namespaces

borkdude 2021-05-19T17:49:13.024900Z

if that isn't a problem, you can choose to have only one .clj-kondo dir, but this also makes linting your classpaths a bit more complicated I think

lilactown 2021-05-19T17:49:28.025200Z

yeah that's what i'm thinking through rn

borkdude 2021-05-19T17:49:37.025600Z

you could script it using babashka or so

borkdude 2021-05-19T17:50:14.026500Z

you can also put common config into one directory and then refer to it using :config-paths

lilactown 2021-05-19T17:50:26.026700Z

first step is I want editor integrations to work well, since a lot of our jr devs are using VS Code + Calva and running into lots of squigglies due to our custom macros

lilactown 2021-05-19T17:52:18.027800Z

perhaps that's the best; create common configurations for e.g. services, ui, libraries in the top-level and then each project can refer to the appropriate one

lilactown 2021-05-19T17:52:50.028600Z

I suppose for step 2, linting in CI, I would want to run clj-kondo in each sub project, or script it with babashka like you were saying?

borkdude 2021-05-19T17:53:14.029Z

yeah, you can do that, just iterate through the projects.

lilactown 2021-05-19T19:04:38.030400Z

I ended up creating a shared config in our app root:

.clj-kondo/ui/config.edn
and added configs to our ui projects that refer to it via :config-paths . it's working well, and gives us room to add service and api configs later. thanks for the guidance! 😄

👍 1