Fork me on GitHub
#helix
<
2021-09-22
>
Bryce Tichit09:09:00

Hello, I started to use Helix last week, the library is amazing ! Anyone know if it's already possible to make emmet output Helix code?

Bryce Tichit09:09:27

I'd write the CSS in Emmet for example and it'd output Helix form corresponding to the HTML

lilactown13:09:44

hmm I don't know of a way of doing that. is there an example of emmet outputting other CLJS code? e.g. reagent?

Bryce Tichit20:09:19

I don't know, just had the idea. It's straight forward to transform html into Helix Dom Functions Tree so technically should be possible to just output the HTML with Emmet and then translate HTML to Helix

Bryce Tichit20:09:36

At least programatically it's possible, then we'd need to implement it in an editor

Bryce Tichit20:09:45

But yeah maybe it's not straight forward

Bryce Tichit20:09:20

I have another question as well, do you know how to configure clj-kondo so he understand that defnc is actually a defn ?

Bryce Tichit20:09:32

Thanks a lot ! Read that already but was too tired looks like 😞 I cannot really figure out how I can config clj-kondo with the lint-as option, just switched to NeoVim and I think that CoC should be the plugin the manages kondo. So would be there for me, still looking !

Bryce Tichit20:09:30

Or maybe I should specify it in the source code?

Bryce Tichit20:09:35

With the linter annotations

Bryce Tichit20:09:22

[email protected] ~/p/tailwind_cljs (master)> tree .clj-kondo/
.clj-kondo/
└── lilactown
    └── helix
        └── config.edn

[email protected] ~/p/tailwind_cljs (master)> bat .clj-kondo/lilactown/helix/config.edn 
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: .clj-kondo/lilactown/helix/config.edn
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ {:lint-as {helix.core/defnc clojure.core/defn
   2   │            helix.core/defhook clojure.core/defn
   3   │            helix.core/fnc clojure.core/fn}}
Looks like the configuration is already there but clj-kondo does not recognize it, maybe I need to change some settings

Bryce Tichit20:09:42

No problem when I feed in the config file directly

[email protected] ~/p/tailwind_cljs (master)> clj-kondo --config ./.clj-kondo/lilactown/helix/config.edn --lint src/main/app/index.cljs
linting took 49ms, errors: 0, warnings: 0
But it does not understand it when the clj-kondo config dir is supplied, here is an example where I force the config dir
[email protected] ~/p/tailwind_cljs (master)> clj-kondo --config-dir ./.clj-kondo --lint src/main/app/index.cljs
src/main/app/index.cljs:7:8: error: Unresolved symbol: Card
src/main/app/index.cljs:7:22: error: Unresolved symbol: span
src/main/app/index.cljs:7:27: error: Unresolved symbol: header
src/main/app/index.cljs:7:34: error: Unresolved symbol: desc
src/main/app/index.cljs:17:8: error: Unresolved symbol: App
linting took 43ms, errors: 5, warnings: 0
It does not understand there that defnc should be linted like defn

dominicm20:09:09

There's a clj-kondo command to run, which will pull in all the kondo configs from your dependencies.

dominicm20:09:32

clj-kondo --lint "<classpath>" --dependencies --parallel --copy-configs

Bryce Tichit21:09:08

Thanks. But this should actually output the configuration in .clj-kondo nope? For Helix the configuration is already in .clj-kondo

dominicm21:09:42

But it's on the classpath, not in your .clj-kondo.

Bryce Tichit21:09:00

Not sure if I understand correctly, sorry new to Clojure 😛

Bryce Tichit21:09:38

classpath just means the source nope? I linted the sources as adviced and with the good options but still nothing. For sure I'm missing something

lilactown23:09:53

@U02342WU2AK you need to make sure you're linking them correctly to your main config.edn. see https://github.com/clj-kondo/config/blob/master/rum/.clj-kondo/config.edn as an example

2
Bryce Tichit07:09:09

Thanks a lot it's working now 😄