clj-kondo

agorgl 2026-02-10T21:35:57.096249Z

I really don't remember if this worked before, but I get Unresolved var: js/Date. [unresolved-var] style errors on all javascript stuff in my cljs files. Is it some recent regression, or did this never work and I don't remember it?

borkdude 2026-02-10T21:39:54.371329Z

try from the command line

borkdude 2026-02-10T21:40:26.288919Z

$ clj -M:clj-kondo/dev --lint - --lang cljs <<< '(js/Date.)'
linting took 30ms, errors: 0, warnings: 0

borkdude 2026-02-10T21:40:54.989539Z

it's very unlikely that this is a regressions since it's test well in CI

agorgl 2026-02-10T21:47:43.890829Z

you sure the above works?

agorgl 2026-02-10T21:48:09.017909Z

I get :clojure.error/cause "--lint (No such file or directory)"

agorgl 2026-02-10T21:48:18.067419Z

(on the /tmp trace)

borkdude 2026-02-10T21:48:29.454729Z

it works on my machine, I have a dev alias for clj-kondo

borkdude 2026-02-10T21:48:48.516319Z

you can you just use the command line binary to test or whatever other way you have clj-kondo installed

agorgl 2026-02-10T21:49:05.477979Z

I use clj-kondo through clojure-lsp

borkdude 2026-02-10T21:49:43.884729Z

just try this:

clj -Sdeps '{:deps {clj-kondo/clj-kondo {:mvn/version "RELEASE"}}}' -M -m clj-kondo.main --lint

borkdude 2026-02-10T21:50:23.928429Z

are you sure you are not editing a .cljc file?

agorgl 2026-02-10T21:52:47.270719Z

I can reproduce the problem:

> clj -Sdeps '{:deps {clj-kondo/clj-kondo {:mvn/version "RELEASE"}}}' -M -m clj-kondo.main --lang cljs --lint path/to/some/file.cljs
path/to/some/file.cljs:32:37: warning: Unresolved var: js/Date.
path/to/some/file.cljs:35:29: warning: Unresolved var: js/fetch
linting took 92ms, errors: 0, warnings: 2

borkdude 2026-02-10T21:53:47.013579Z

nice that you can repro it. can you make a repro for me, the smallest one possible?

agorgl 2026-02-10T21:55:05.203119Z

I'll try to make one, for now I'm trying previous releases to see if the problem stops

borkdude 2026-02-10T21:55:08.134419Z

do you have an alias like :as js in your file maybe?

agorgl 2026-02-10T21:55:41.633949Z

nop

borkdude 2026-02-10T21:55:46.264179Z

try the repro also outside of your project. it may have to do something with a cache. please don't throw away your cache, then we can't reproduce the issue anymore

borkdude 2026-02-10T21:56:11.836279Z

I'll be back later

agorgl 2026-02-10T21:56:32.088009Z

insteresting thing

agorgl 2026-02-10T21:56:45.250099Z

I have js references above but no warnings on them

agorgl 2026-02-10T21:57:08.993069Z

the only js/* references that have a warning are inside a nxr/register-effect! macro

agorgl 2026-02-10T21:57:15.701449Z

so maybe this is the culpit

borkdude 2026-02-10T21:57:54.633039Z

could be

agorgl 2026-02-10T22:05:49.111319Z

its a cache problem

agorgl 2026-02-10T22:06:51.312569Z

i copied my project folder, did the cli test above, got warnings, purged the .clj-kondo/.cache directory and run again the cli test, no warnings this time

agorgl 2026-02-10T22:11:06.561209Z

It also seems that .clj-kondo/.cache/v1/cljc/ causes it

agorgl 2026-02-10T22:12:11.119919Z

found the exact problematic file too:

agorgl 2026-02-10T22:12:33.632709Z

> cat .clj-kondo/.cache/v1/cljc/.transit.json
["^ ","~:filename",null,"~:clj",["^ "],"~:cljs",["^ "]]

agorgl 2026-02-10T22:12:53.459709Z

if I rm this file, the warnings go away

agorgl 2026-02-10T22:14:03.234979Z

it doesn't really make sense though why a .transit.json file without a namespace in the filename exists, looking at the other files in the same directory

borkdude 2026-02-10T22:21:50.271009Z

seems like a bug somewhere. if you re-initialize clojure-lsp in your project, does the bug get re-introduced?

agorgl 2026-02-10T22:22:18.993259Z

what do you mean by re-initialize clojure-lsp?

borkdude 2026-02-10T22:22:27.727779Z

restart your workspace

agorgl 2026-02-10T22:22:54.823719Z

yes the bug persists across editor restarts

borkdude 2026-02-10T22:23:02.654119Z

also after removing the file I mean

agorgl 2026-02-10T22:23:16.724219Z

let me check

agorgl 2026-02-10T22:24:33.137469Z

no it doesn't re-appear

borkdude 2026-02-10T22:28:42.799729Z

ok, if it does let me know...

agorgl 2026-02-10T22:29:10.085449Z

can I remove the troubling cache file now from my main project?

agorgl 2026-02-10T22:29:15.603289Z

or do you need any more tests?

borkdude 2026-02-10T22:29:34.881699Z

yeah we know enough now

agorgl 2026-02-10T22:29:44.077979Z

maybe you can repro this too now that I have the path and the contents above

agorgl 2026-02-10T22:30:14.552229Z

but I suppose you question still remains why this file was there in the first place

borkdude 2026-02-10T22:30:27.803609Z

yeah, doesn't ring a bell right now