electric
electric copied to clipboard
Add clj-kondo config for e/for-by
CA received, thank you @simon-katz Per our DMs, the approach taken is that Kondo uses a mock/fake macroexpansion before linting. The capability has been available in Kondo for a couple years.
A few more details…
The clj-kondo feature is documented at https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md.
I've used the simple approach of a :macroexpand hook. This works pretty well, but one linting message is less than ideal: when e/for-by is called with the wrong number of arguments, the message is (for example) clojure.core/for is called with 1 arg but expects 2 [invalid-arity] — the mention of clojure.core/for is not ideal.
Something more sophisticated is probably possible using an :analyze-call hook.