Fork me on GitHub
#clj-kondo
<
2021-11-07
>
seancorfield20:11:01

I've just added clj-kondo.exports to next.jdbc -- can someone sanity check that I did it correctly? https://github.com/seancorfield/next-jdbc/commit/99f814bb258a8e11924f6cb9f72274daa04647b8 -- I know that the with-transaction macro is already baked into clj-kondo but this will pave the way for any future macros added to next.jdbc. I am about to move on to Expectations next.

borkdude21:11:41

@seancorfield That looks good. Note that you don't have to duplicate your config. You can refer to your config in the exported directory by adding it to :config-paths in .clj-kondo/config.edn

borkdude21:11:37

:config-paths ["resources/clj-kondo.exports/com.github.seancorfield/next.jdbc"]

borkdude21:11:07

Note that namespaces inside the exported directory should also follow an org/lib structure. Instead of hooks.next-jdbc choose seancorfield.next-jdbc for example, this will ensure that you won't get conflicts with anyone else that writes hooks for this library

seancorfield21:11:51

Ah, I thought the hooks were already "local" to that tree. My bad. As for the "copy", that's what happens when I run clj-kondo --copy-configs --dependencies --lint "$(clojure -Spath)" on the project so I can work within it.

seancorfield21:11:39

(and that seems to be what the documentation suggests you should do, BTW)

seancorfield21:11:23

(updated the next-jdbc hook to .github.seancorfield.next-jdbc)

borkdude21:11:47

Cool. The hooks part isn't really necessary, but doesn't hurt either.

borkdude21:11:09

Clojure-LSP automatically lints the code with those settings so everyone who uses clojure-lsp will receive those configs in their .clj-kondo directory and then can opt in via :config-paths

seancorfield21:11:07

Is the expectation that a project should .gitignore everything in the .clj-kondo folder except config.edn? I'm already ignoring .clj-kondo/.cache in most projects...

borkdude21:11:48

@seancorfield No, just .cache . The config (also imported configs) can be checked in so linting works the same for everyone who runs clj-kondo on it, in CI, etc.

seancorfield22:11:15

OK. And, just to be clear, that means the "duplicated" config since clj-kondo copies it when you run that command (that I showed above).

borkdude22:11:38

You can gitignore that part of your .clj-kondo for your specific project, since its already in your source control, especially when you configure it via :config-paths

borkdude22:11:15

For other users of your library I recommend checking in into their source control in the .clj-kondo dir

seancorfield22:11:43

OK, thanks. That helps clarify things -- but isn't obvious from the docs.

borkdude22:11:20

Feel free to propose/PR some changes to the docs

seancorfield23:11:47

I read it over a few more times and see if I have any suggestions...

🙏 1