eastwood

All things realted to eastwood - the Clojure linter
2018-11-29T13:34:59.000500Z

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

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

2018-11-29T13:35:20.001100Z

which complains about

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

2018-11-29T13:36:15.001700Z

I can't find any example of import

2018-11-29T13:36:21.002Z

any idea about how to do that?

2018-11-29T13:51:44.002600Z

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

2018-11-29T13:52:07.003100Z

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

bronsa 2018-11-29T13:53:17.003700Z

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

bronsa 2018-11-29T13:53:32.004100Z

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

bronsa 2018-11-29T13:53:42.004400Z

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

bronsa 2018-11-29T13:54:14.004600Z

not sure if you have control of that code

2018-11-29T14:18:01.004900Z

ah yes sure I can do that

2018-11-29T14:31:00.005300Z

that worked thanks @bronsa

2018-11-29T14:31:03.005600Z

better than adding an exception

2018-11-29T14:31:16.006200Z

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

bronsa 2018-11-29T14:45:58.007Z

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

2018-11-29T14:58:28.007300Z

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

2018-11-29T14:59:06.007800Z

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

2018-11-29T15:02:02.008300Z

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

bronsa 2018-11-29T15:02:31.008700Z

well

bronsa 2018-11-29T15:02:33.008900Z

I had a typo

bronsa 2018-11-29T15:02:44.009100Z

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

2018-11-29T15:09:18.009400Z

hehe ok thanks

slipset 2018-11-29T16:20:29.010100Z

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