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?
try from the command line
$ clj -M:clj-kondo/dev --lint - --lang cljs <<< '(js/Date.)'
linting took 30ms, errors: 0, warnings: 0it's very unlikely that this is a regressions since it's test well in CI
you sure the above works?
I get :clojure.error/cause "--lint (No such file or directory)"
(on the /tmp trace)
it works on my machine, I have a dev alias for clj-kondo
you can you just use the command line binary to test or whatever other way you have clj-kondo installed
I use clj-kondo through clojure-lsp
just try this:
clj -Sdeps '{:deps {clj-kondo/clj-kondo {:mvn/version "RELEASE"}}}' -M -m clj-kondo.main --lintare you sure you are not editing a .cljc file?
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: 2nice that you can repro it. can you make a repro for me, the smallest one possible?
I'll try to make one, for now I'm trying previous releases to see if the problem stops
do you have an alias like :as js in your file maybe?
nop
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
I'll be back later
insteresting thing
I have js references above but no warnings on them
the only js/* references that have a warning are inside a nxr/register-effect! macro
so maybe this is the culpit
could be
its a cache problem
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
It also seems that .clj-kondo/.cache/v1/cljc/ causes it
found the exact problematic file too:
> cat .clj-kondo/.cache/v1/cljc/.transit.json
["^ ","~:filename",null,"~:clj",["^ "],"~:cljs",["^ "]]if I rm this file, the warnings go away
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
seems like a bug somewhere. if you re-initialize clojure-lsp in your project, does the bug get re-introduced?
what do you mean by re-initialize clojure-lsp?
restart your workspace
yes the bug persists across editor restarts
also after removing the file I mean
let me check
no it doesn't re-appear
ok, if it does let me know...
can I remove the troubling cache file now from my main project?
or do you need any more tests?
yeah we know enough now
maybe you can repro this too now that I have the path and the contents above
but I suppose you question still remains why this file was there in the first place
yeah, doesn't ring a bell right now