Fork me on GitHub
#clj-kondo
<
2020-04-20
>
martinklepsch09:04:16

Is there a recommended way to address error: unresolved symbol goog.DEBUG ?

martinklepsch09:04:53

It’s not something you usually require so I’m not sure how to tell clj-kondo that it’s fine

martinklepsch09:04:42

{:linters
  {:unresolved-symbol
    {:exclude [(riemann.streams/streams [where])]}}}
I guess something like this but for just the goog.DEBUG symbol. I’ll give variations of this a try

4
borkdude09:04:30

@U050TNB9F Just adding that symbol to the :exclude vector works

borkdude09:04:57

but I would be happy to support this out of the box. There is also goog.global which I listed.

borkdude09:04:15

Maybe everything that starts with goog. should be not warning about in CLJS or is that too much?

borkdude09:04:57

If you grep the source for goog.global you'll find the spot where this is handled. Feel free to add more there.

martinklepsch09:04:21

I think everything under goog. would be to aggressive since that would not err if goog.abc is used via it’s fully qualified name in namespace A but only require in namespace B

martinklepsch09:04:03

I found multiple places that mention goog.global , would it need to be added to both?

extract/clj_kondo/impl/extract_var_info.clj
58:        special '#{ns js* *target* goog.global}]

src/clj_kondo/impl/var_info_gen.clj
10:  (def cljs-core-syms '#{,,, goog.global ,,,})

borkdude09:04:27

@U050TNB9F Only to the first one. The second one is generated

borkdude09:04:06

You can then run script/extract-var-info to update the second one

juhoteperi09:04:37

I think anything in goog/base.js is accessable like this. In addition to global and DEBUG, LOCALE is probably quite common property: https://github.com/google/closure-library/blob/master/closure/goog/base.js

juhoteperi09:04:30

Though I guess LOCALE is set in :closure-defines so it isn't usually referred in the code