Fork me on GitHub
#clj-kondo
<
2021-03-21
>
seancorfield19:03:49

Just noticed this issue:

Can't parse /Developer/workspace/clj-new/src/clj/new/app/deps.edn, No value supplied for key: namespace clj-kondo (syntax)
for this deps.edn file (which is a template in clj-new):
{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.10.3"}}
 :aliases
 {:run-m {:main-opts ["-m" "{{namespace}}"]}
  :run-x {:ns-default {{namespace}} ; complaining about this
          :exec-fn greet
          :exec-args {:name "Clojure"}}
...
This is a Stencil template (but Selmer and others use the same syntax). Not sure if it’s possible to work around this since it’s a parsing issue at the EDN level but I thought I’d mention it in case…

borkdude19:03:02

@seancorfield If the file ends with .edn, clj-kondo will treat it as edn

borkdude19:03:27

you can exclude the file in your config

seancorfield19:03:02

Right, I meant more “Could clj-kondo understand that {{sym}} is a template var and still parse the file?“.

seancorfield19:03:36

Also, while you’re here — I just ran across this:

(ns kondo.reducers
  (:require [clojure.core.reducers :as r]))

(defn map-test []
  (r/map inc [1 2 3 4]))
  ;^ r/map flagged as an unresolved var

borkdude19:03:58

that would require a change in the parser, which imo isn't worth it. the r/map issue will be fixed in the newest clj-kondo which I'm about to release

seancorfield19:03:39

Oh, good timing on my part then 🙂

seancorfield19:03:09

Yeah, I figured it wouldn’t be worth fixing the EDN parse issue. I was just curious if anyone else had run into it.

borkdude19:03:35

I have run into it myself :)

borkdude19:03:25

it's unfortunate that {{ ... }} is invalid EDN in this case

borkdude19:03:31

if only we had some HEREDOC feature in clojure :P (j/k)

seancorfield19:03:05

(which wouldn’t solve that parsing issue but… 🙂 )

borkdude20:03:00

I just had a pain with lein updating the clj-kondo LSP plugin. Turns out I had clj-kondo in my .lein/profiles.clj as well, so it had included an older version for a while.

lein with-profiles -user
fixes this.. facepalm

borkdude20:03:45

Well, here it is then:

borkdude22:03:26

@seancorfield I guess a quick hack for templates would be to str/replace all {{ ... }}s with e.g. nil and then lint it as .edn. But how would you tell clj-kondo that it should do that.