Fork me on GitHub
#clj-kondo
<
2021-12-29
>
Chad kennedy03:12:33

I have a line of code (let [path (.getPath ^object app "userData")] where clj-konda says Unresolved symbol: object. I believe, and correct me if I'm wrong, that object here is the javascript class named object. (The source file is a .cljs file) How can I get clj-kondo to understand that?

seancorfield03:12:21

Shouldn't that be ^Object?

Chad kennedy03:12:20

I really don't know. I'm new to the codebase, and hoping to help by starting small and doing a little linting. 😕 I'm not sure what else object would be in this case. It's not shown in the require at the top of the file.

Chad kennedy03:12:44

Now, this object usage is only occurring in .cljs files within the src/electron/electron folder of the codebase. Maybe object is an electron thing?

seancorfield03:12:25

Yeah, just looking over that code I suspect you're right but clj-kondo doesn't know how to find it...?

Chad kennedy03:12:31

That's correct. I'm getting Unresolved symbol: object

Chad kennedy03:12:36

Interesting. Here, line 72 clj-kondo resolves object fine, or at least doesn't flag an error. But it does flag an error on line 76: https://github.com/logseq/logseq/blob/master/src/electron/electron/search.cljs#L72

Chad kennedy03:12:10

(Same error: Unresolved symbol: object)

Chad kennedy04:12:42

Seeing it work on line 72 here, but not line 76, makes me think it might be a bug in clj-kondo, regardless of what object is in this case. But I am pretty new at all this, so I might be misunderstanding the syntax.

Chad kennedy04:12:38

I confirmed I can replace object with my name on line 72, and I won't get an error

seancorfield04:12:26

So that indicates clj-kondo is just ignoring the context of the type hint in line 72...

borkdude08:12:02

Issue welcome

Yehonathan Sharvit13:12:37

@borkdude What do you think of adding a clj-kondo warning for unsafe usage of read-string (that could be exploited to execute arbitrary code)?

borkdude13:12:16

There is an issue for more general linter for this where you can configure read-string: https://github.com/clj-kondo/clj-kondo/issues/996 Feel free to upvote the issue with a thumbs up

borkdude22:12:53

Cursive users take note! @brcosta has been doing amazing work on integrating clj-kondo with Cursive. See these screenshots! You can try out this plugin by going to preferences > plugins > install from disk https://www.dropbox.com/s/uo6fiquyowa6qe0/clj-stuff-plugin-0.3.0.zip?dl=0 It will likely be renamed to a better name and available in the marketplace within a few days.

🎉 3
🚀 1
1
cursive 1
clj-kondo 1
kenny23:12:27

Cool. What's the difference from the previous clj-kondo integration? Looks like an IntelliJ plugin. Is the source code available online?

borkdude23:12:57

@U083D6HK9 The source code is here: https://github.com/brcosta/clj-stuff-plugin The difference is that this is likely more performant, and less work to set up, but I'll defer to @brcosta for better info on this.

1
brcosta12:01:10

Hey guys! Yes, zero-conf, more performant and now we can make clj-kondo more tightly integrated with Intellij 🙂