This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-14
Channels
- # atom-editor (5)
- # babashka (6)
- # beginners (29)
- # calva (16)
- # cider (1)
- # clj-kondo (20)
- # cljs-dev (44)
- # clojure (29)
- # clojure-europe (19)
- # clojure-nl (8)
- # clojure-norway (7)
- # clojure-spec (2)
- # clojure-sweden (1)
- # clojure-uk (56)
- # clojurescript (32)
- # code-reviews (30)
- # conjure (24)
- # cursive (49)
- # datomic (4)
- # fulcro (31)
- # helix (3)
- # instaparse (4)
- # kaocha (100)
- # lambdaisland (2)
- # mid-cities-meetup (1)
- # monads (1)
- # off-topic (42)
- # pathom (13)
- # pedestal (6)
- # portal (5)
- # re-frame (6)
- # reagent (9)
- # reitit (11)
- # remote-jobs (1)
- # rewrite-clj (11)
- # shadow-cljs (44)
- # sql (22)
- # tools-deps (13)
- # uncomplicate (1)
- # xtdb (15)
Hey, I am wondering if the unresolved symbol in the destructuring of the following example is intended ?
(defn foo [x {:keys [y] :or {y x}}]
(list x y))
Is that considered bad style or a bug?It's undefined behaviour: https://github.com/borkdude/clj-kondo/issues/782
(ns foobar
{:clj-kondo/config {}}
(:require [ :as io]))
^ Does not flag io
as an unused namespace. Remove the :clj-kondo/config
metadata and it works:
(ns foobar
#_{:clj-kondo/config {}}
(:require [ :as io]))
I don't see an existing issue for this, shall I go ahead and create one @borkdude?
Never mind. I updated to the most recent clj-kondo
version and the problem went away!
(FYI, the above bug was in the 2020.04.05 version)
@seancorfield Could be an issue with parsing the clj-kondo config. Before it expected quotes like
{:clj-kondo/config '{}}
but this has been relaxed to
{:clj-kondo/config {}}
if your config doesn't contain any symbols.Note that
(ns foobar
{:clj-kondo/config 1}
(:require [ :as io]))
won't give you an error about io being unused either, since the parsing of the config fails, so maybe it's similar to what you had@borkdude I had '
in the real code example. What I posted was just the minimal example of the bug (which has clearly since been fixed).
It was definitely parsing the config correctly: it contained a :lint-as
and without the form, Kondo flagged every use of that macro as an error.
I didn't realize I was on such an old version of Kondo.
(I'm refactoring old test code right now so Kondo is helping me cleanup ns
forms as I swap out uses of an old lib for uses of a new one!)
@seancorfield I think the most exciting new features since 2020.04.05 are hook support (for handling weird macros that don't work with :lint-as
) and linting for clojure.core/format
.
The thing you did for jdbc can now be done in user-land using hooks. The hooks are evaluated using sci (because a GraalVM binary cannot clojure.core/eval
).
Yeah, I haven't had time to look at hooks yet, but they look very interesting.
Here's some examples: https://github.com/borkdude/clj-kondo/tree/master/examples/