This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-24
Channels
- # architecture (4)
- # aws (1)
- # beginners (76)
- # boot (172)
- # cider (17)
- # cljs-dev (10)
- # cljs-experience (24)
- # cljsrn (45)
- # clojure (129)
- # clojure-berlin (1)
- # clojure-finland (1)
- # clojure-italy (8)
- # clojure-seattle-old (1)
- # clojure-sg (1)
- # clojure-spec (31)
- # clojure-uk (28)
- # clojurescript (88)
- # cursive (11)
- # data-science (1)
- # datomic (44)
- # fulcro (48)
- # hoplon (5)
- # jobs (3)
- # jobs-discuss (1)
- # leiningen (6)
- # luminus (42)
- # lumo (17)
- # off-topic (9)
- # om (29)
- # onyx (15)
- # pedestal (7)
- # protorepl (20)
- # re-frame (24)
- # reagent (46)
- # ring-swagger (2)
- # specter (2)
- # sql (3)
- # uncomplicate (58)
- # unrepl (29)
- # yada (5)
@rgdelato Since you're the maintainer of that package, I hope you don't mind questions about it here?
I have the following code:
(api/with-validated-params [::api-spec/reset-new-stats nil]
(act/visit (:user-id-int params) (:pagename params))
(resp/response {})))
and it flags params
as being undeclared -- I've told Joker that api.support/with-validated-params
is a macro but that hasn't helped (the macro introduces that symbol).Hmm. I don't know. Can you be a bit more specific? Where is your .joker
file located and what exactly does it contain?
{:known-macros [api.support/with-validated-params
api/with-validated-params]}
Just in case it didn't understand the ns alias of api.support
to api
, and it's in a parent folder a few levels up from that source file.Looks like a limitation on how :known-macros
works. If I have (api/with-validated-params foo ...)
it won't flag that, but it doesn't understand a macro may introduce new names it seems.
I'll go open an issue on Joker.
I could change the macro to require the symbol name in the vector that is the first argument -- updating the code to
(api/with-validated-params [params ::api-spec/reset-new-stats nil]
(act/visit (:user-id-int params) (:pagename params))
(resp/response {})))
makes the error go away (interestingly, Joker thinks the symbol is a top-level one, and all references to params
pass the linter at that point!)Which means Joker doesn't understand binding-style macros, I suspect...
It's still extremely useful -- it found a bunch of unused namespace requires in the very first file I popped open!
It also spotted an if-let
that should have been just an if
(the introduced local symbol was not used).
I had to create a .joker file for this to work on Windows, but it is now working. Pretty cool.
Does joker understand namespace aliases? I'm getting an error on a keyword using an aliased namespace. Actually, I don't think the namespace even exists, it's clojure.spec.test.check
.
@rgdelato For CLJC files, it appears that linter-joker only runs joker with the --lintclj
option, since it doesn't catch errors in #?(:cljs ...)
blocks. I am able to see CLJS errors if I run with --lintcljs
from the command line.
@rgdelato I tried to hack joker to have a`--cljc` that just ran lint twice, but it seems pretty deeply wired to run exactly once. Seems like it should be possible to run the command line joker twice from linter-joker. I'd be willing to take a shot at that and make a PR if successful. If you have any pointers, please let me know.