This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-08
Channels
- # announcements (14)
- # babashka (12)
- # beginners (140)
- # calva (2)
- # cider (22)
- # clj-commons (14)
- # clj-kondo (49)
- # cljdoc (34)
- # clojure (92)
- # clojure-europe (41)
- # clojure-france (2)
- # clojure-new-zealand (2)
- # clojure-nl (2)
- # clojure-norway (60)
- # clojure-uk (17)
- # clojured (2)
- # clojurescript (7)
- # community-development (3)
- # conjure (2)
- # cryogen (13)
- # cursive (4)
- # data-oriented-programming (2)
- # datahike (5)
- # datomic (12)
- # defnpodcast (10)
- # events (2)
- # fulcro (20)
- # gratitude (3)
- # honeysql (4)
- # introduce-yourself (3)
- # jobs (10)
- # lsp (58)
- # malli (12)
- # missionary (19)
- # off-topic (8)
- # pathom (18)
- # podcasts-discuss (1)
- # polylith (41)
- # releases (1)
- # remote-jobs (3)
- # shadow-cljs (52)
- # spacemacs (1)
- # sql (37)
- # xtdb (19)
Am I correct in assuming that :unsorted-required-namespaces
checks ordering of splicing reader conditionals as if they were already spliced. I guess that makes sense...
Is there a way to currently support having one splicing conditional at the end of the require block and have each part of it sorted? E.g.:
(ns some.ns
(:require
[com.fulcrologic.fulcro.components :as comp :refer [defsc]]
#?@(:cljs [[com.fulcrologic.fulcro.dom :as dom]]
:clj [[com.fulcrologic.fulcro.dom-server :as dom]])))
That currently fails the linter because (I think) after splicing it would be out of order
It currently raises warnings for us on clj-kondo v2022.01.15
. I wanted to post the above as an arg to the clj-kondo command but I get an error saying it’s an unparsable ns form (I think because there is no file?)
The unparsable ns form error occurs even if there is a file. This is what I get…
clj-kondo-repro on main [?]
❯ clj-kondo --lint src
src/myname/myapp.clj:0:0: error: Can't parse src/myname/myapp.clj, Unparsable namespace form
linting took 166ms, errors: 1, warnings: 0
…in this repro https://github.com/dcostaras/clj-kondo-reproThere was an issue about reader conditionals awhile back https://github.com/clj-kondo/clj-kondo/issues/80 it could be reopened?
I’ve updated the repro project https://github.com/dcostaras/clj-kondo-repro The behaviour is now:
❯ clj-kondo --lint src
src/myname/myapp.cljc:5:16: warning: Unsorted namespace: com.fulcrologic.fulcro.dom
src/myname/myapp.cljc:6:15: warning: Unsorted namespace: com.fulcrologic.fulcro.dom-server
linting took 215ms, errors: 0, warnings: 2
Could this be configured to not warn in that case… or ideally check the sorting of the parts?@U0VP19K6K if you write:
(ns myname.myapp
(:require
[com.fulcrologic.fulcro.components :refer [defsc]]
[taoensso.timbre :as timbre]
#?(:clj [com.fulcrologic.fulcro.dom-server :as dom])
#?(:cljs [com.fulcrologic.fulcro.dom :as dom])))
then the order doesn't matter, but somehow in the splice that's not been accounted for yet, it seems. we should just fix that to not warnthanks, I’ll open the issue. We’re attempting to turn it on in an existing project so probably wont change all NSs just yet! Thanks borkdude
Well, both. For developer feedback I used lots of (prn (api/sexpr node))
as suggested at https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md
For testing as in QA I would just lint your sources and make sure your macros are used in such a way that should be covered by the linting
But it would be nice to be able to persist a few tests so I don't break the hook later on
That works to some extent but I also want to write tests that would fail the linter for specific reasons
https://github.com/fulcrologic/guardrails/pull/30 in case you're interested what I needed this for. Thanks again for the help!
One more question regarding the dev workflow: using the JVM method you shared above, how can I reload the hook code I'm testing after I make changes without having to restart my repl?