weavejester / hiccup

Fast library for rendering HTML in Clojure
http://weavejester.github.io/hiccup
Eclipse Public License 1.0
2.68k stars 175 forks source link

clj-kondo exported config #201

Closed borkdude closed 1 year ago

borkdude commented 1 year ago

Hi @weavejester,

Someone in the beginner's channel on Clojurians slack got some clj-kondo warnings from hiccup which can be fixed using configuration:

{:lint-as
 {hiccup.def/defelem clj-kondo.lint-as/def-catch-all
  hiccup.def/defhtml clj-kondo.lint-as/def-catch-all}}

Would you be willing to "export" this config as part of the hiccup dependency so everyone automatically gets the correct linting when using hiccup as a dependency? This will likely improve the beginner experience for those using hiccup + clj-kondo.

Thanks,

Michiel

weavejester commented 1 year ago

Can you explain how to "export" the config? Is it a resource at a known path?

borkdude commented 1 year ago

@weavejester I can prepare a PR for this if you want, to not take any of your time. I just wanted to ask first if you would be open to this.

The docs for this are here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration

weavejester commented 1 year ago

Sure, that sounds reasonable.

Garmelon commented 1 year ago

Wouldn't the :lint-as version fail whenever you pass a map of attributes to the elem? If so, a custom clj-kondo hook might be necessary, but I don't see an easy way of handling multiple-arity defelems due to the way the optional first attribute map argument works.