Fork me on GitHub
#clj-kondo
<
2022-02-14
>
Michaël Salihi14:02:54

Hi, I experience a unresolved var on this line containing this p/-> macro despite the fact that I added promesa.core/-> clojure.core/-> in clj-kondo config: https://github.com/babashka/nbb/blob/main/examples/node-fetch/example.cljs#L20 Any idea?

borkdude15:02:57

@admin055 you need to upgrade promesa in the deps.edn of your project, if you have any, since that's where clj-kondo will get the info from

borkdude15:02:23

or are you talking about editing files in the nbb repo itself?

Michaël Salihi15:02:55

Yes the second one...in the nbb repo so deps.edn already contains the last promesa version.

borkdude15:02:15

What editor are you using and how did you set up clj-kondo with it?

borkdude15:02:25

You may need to restart your editor to trigger linting deps

Michaël Salihi15:02:57

Emacs + LSP but I get the same warning when launching in CLI:

mike@prestancedesign /t/nbb (upd-node-fetch-example)> clj-kondo --lint examples/node-fetch/
examples/node-fetch/example.cljs:20:18: warning: Unresolved var: p/->
linting took 143ms, errors: 0, warnings: 1

borkdude15:02:25

Restart your workspace with lsp-workspace-restart

borkdude15:02:38

and then wait

borkdude15:02:44

and then make an edit

Michaël Salihi15:02:39

Already tested without success, I retry tho.

borkdude15:02:20

I'll also test locally

Michaël Salihi15:02:44

lsp will always align to messages obtained by clj-kondo on the command line, right?

borkdude15:02:27

lsp might be using a slightly older or newer version than you have on the clj-kondo, but in 99% of the cases yes.

borkdude15:02:50

Hmm, removing .clj-kondo/.cache and then doing lsp-workspace-restart fixed it for me

borkdude15:02:26

but then again, now it doesn't report any unresolved var when I type a wrong one

borkdude15:02:29

Hmm, this is weird, when I do a manual:

$ clj-kondo --lint $(clojure -Spath) --dependencies
Downloading: funcool/promesa/6.1.434/promesa-6.1.434.pom from clojars
Downloading: funcool/promesa/6.1.434/promesa-6.1.434.jar from clojars

borkdude15:02:55

then it downloads promesa newer for the first time. I don't know what lsp was analyzing here ...

Michaël Salihi15:02:53

After delete the cache folder, it's solved. 👍

borkdude15:02:58

@UKFSJSM38 this is a mystery to me. could you try this one the nbb project when you have time?

borkdude15:02:20

@admin055 yeah, but you probably have the same problem as I have here: > but then again, now it doesn't report any unresolved var when I type a wrong one

Michaël Salihi15:02:52

No it works for me.

borkdude15:02:22

That's not testing what I said :) Type p/foo

borkdude15:02:31

unresolved var != unresolved symbol

borkdude15:02:46

unresolved var = var from other namespace

Michaël Salihi15:02:58

oh sorry, misreading 🙂

borkdude15:02:10

It's confusing, I know

borkdude15:02:34

I don't think lsp analyzes any dependencies anymore now

borkdude15:02:00

it's done in 1 or 2 seconds which is suspiciously fast

Michaël Salihi15:02:02

Yes indeed, I experience the same bug.

Michaël Salihi15:02:35

Directly with CLI clj-kondo too.

borkdude15:02:57

because you haven't linted deps, that's expected. but normally lsp takes care of that

borkdude15:02:58

after deleting .lsp/.cache and .clj-kondo/.cache and then an lsp-workspace-restart it started working again for me

Michaël Salihi15:02:18

> because you haven't linted deps, that's expected. but normally lsp takes care of that OK understand. That's why you use clj-kondo --lint $(clojure -Spath) --dependencies before

borkdude15:02:52

that's what lsp is normally doing too

borkdude15:02:09

unless it caches stuff, and caching as we all know is hard

ericdallo15:02:17

There is a bug on latest release regarding classpath cache, not sure it's the problem here, but it may worth try the latest master build from #clojure-lsp-builds

👍 2
Michaël Salihi15:02:08

Perfect, thanks for the information. Will try later. 👍

ericdallo15:02:25

It was a bug regarding a huge refactor I did about splitting cli from lib

ericdallo15:02:38

I fixed couple days ago

borkdude15:02:03

Big refactors are sometimes worth it but can also be risky. That's why I hope y'all will try out babashka master before release 😰

ericdallo15:02:03

Hahha yeah, one of the reasons I created #clojure-lsp-builds as well I'm trying to avoid big refractors as well, but that one was on backlog for some months already

👍 1
borkdude15:02:37

#babashka-circleci-builds <--

$ bash <(curl ) --version 0.7.5-SNAPSHOT --dir .
$ ./bb

borkdude15:02:59

This refactor was on the list for 2 years or so ;)

😂 2
🏃 1
Michaël Salihi15:02:13

Thanks both for the support! gratitude

Sam Ritchie21:02:05

are there strong feelings on naming conventions for hook namespaces? I see a few options around, and want to make sure I am properly namespacing here

Sam Ritchie21:02:20

hooks.sicmutils.namespace-where-the-macro-lives seems like a nice option

borkdude21:02:38

as long as the namespace name is unique and starts with or contains your org / lib name to avoid conflicts, it should be good

Sam Ritchie21:02:47

nice, I went with the convention above, thanks!

Sam Ritchie21:02:28

this seems to work, for linting multiple directories - clj-kondo --lint src --lint test . is this the recommended way? I’m setting up a Github Action with https://rymndhng.github.io/2020/04/03/Integrate-clj-kondo-with-Github-Actions/

borkdude21:02:07

@sritchie09 You can do it like this as well: --lint src:test (classpath style, on Windows, use semicolon as path delimiter), or even --lint src test

Sam Ritchie21:02:45

nice. I am going to make CI fail on warnings, hardcore lifestyle

ghadi23:02:18

golang might be your jam

ghadi23:02:50

personally I think failing on unused bindings is too hardcore

Sam Ritchie23:02:06

Oh boy, good point, maybe it's time to relax. If golang becomes my jam I'm switching fields… Recent conversion has my zeal fired up high

😂 1
Noah Bogart23:02:14

I’m all for failing in unused vars