Fork me on GitHub
#clj-kondo
<
2020-03-17
>
dani14:03:49

hello! I’m using clj-kondo in vscode via Calva and it doesn’t seem to be picking up the config.edn file inside .clj-kondo in the root of my project, no matter what I put there, the linting I get is always the same, can anyone help me troubleshoot what I’m doing wrong?

borkdude14:03:41

@danimartinprieto clj-kondo looks from the current working directory upwards. VSCode set the current working directory to the workspace or directory that you are editing. If you are editing files outside your workspace, then clj-kondo won't be able to find the config.

dani14:03:32

mmm, it turns out vscode had opened as a workspace the parent folder of my project, I’ve closed it and open with vscode exactly the root of my project and now it works

dani14:03:37

thank you very much!

dani14:03:59

I have a follow up question… I have a macro that does this (it’s not important what it does, actually)

(defmacro defstyles [sym styles]
  "Takes a clojure map an creates a react-native StyleSheet from it without runtime clj->js conversion"
  `(let [s# (.create (.-StyleSheet (js/require "react-native")) ~(make-styles styles))]
     (defn ~sym [k#]
       (goog.object/get s# (name k#)))))
and every time I use it, it says the symbol it defines is unresolved… I’ve tried excluding that macro in the config file but it doesn’t work
:unresolved-symbol {:exclude [(my.macro.namespace/defstyles)]}

dani14:03:49

I’m not sure I’m doing it properly

dani14:03:21

the unresolved symbol is not the macro itself, but what I define with it, so in this example: (defstyles styles …) styles is marked as unresolved and that’s what I want to avoid adding the exclude

dani14:03:47

I’ve solved it doing :lint-as {my.macro-namespace/defstyles clj-kondo.lint-as/def-catch-all} please let me know if there is a better way!

borkdude14:03:44

maybe linting as clojure.core/def also works

dani15:03:22

but it’s preferred? I have to say I’m learning clojure so…

dani15:03:10

it seems it also work :thumbsup:

borkdude15:03:35

it will give you more accurate results. catch-all is the last resort

dani15:03:56

makes sense, and thank you for your help ❤️

borkdude15:03:04

np, enjoy! 🙂

dani15:03:14

and for creating the linter, actually, lol

dani15:03:20

(I just saw it)