eastwood 2018-11-29

I'm trying to write an exception for this kind of situation

(:import
   #?@(:cljs [goog.string.format])))

which complains about

utils.cljc:1:1: suspicious-expression: import called with 0 args.  (import) always returns nil.  Perhaps there are misplaced parentheses?

I can't find any example of import

any idea about how to do that?

with something like

(disable-warning
 {:linter :suspicious-expression
  :for-macro 'clojure.core/import
  :within-depth 2
  :reason "in utils.cljc there is a cljs only import"})
I get a NullPointerException

can I just simply skip one namespace or that's not possible?

I'm surprised the ns spec doesn't fail there

can you not just move the reader conditional outside the import?

#?@(:cljs (:import [goog.string.format]))

not sure if you have control of that code

ah yes sure I can do that

better than adding an exception

even though I'd still like to know why I got a NullPointerException and how I could have written it

yeah definitely, I'm afraid I don't really know how disable-warning works

I wrote it, but long enough ago that I don't know why it behaved that way 🙂

Eastwood development for me is a "push back the frontier of exceptions and wrong behavior one onion layer at a time" experience.

that change broke uberjar sadly though @bronsa

[Figwheel] Could not Analyze: nth not supported on this type: Keyword  file:/home/circleci/src/cljc/finops_admin/shared/utils.cljc   line:1  column:1

#?@(:cljs [(:import goog.string.format)])

@andrea.crotti if you wouldn’t mind filing an issue with the disable-warning thing, I’d be very happy!