This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-27
Channels
- # aleph (1)
- # announcements (39)
- # aws (11)
- # beginners (58)
- # calva (10)
- # cider (7)
- # clj-kondo (65)
- # cljs-dev (5)
- # clojure (90)
- # clojure-dev (48)
- # clojure-europe (23)
- # clojure-madison (1)
- # clojure-norway (1)
- # clojure-uk (40)
- # clojured (11)
- # clojurescript (20)
- # conjure (12)
- # core-async (4)
- # core-logic (4)
- # cursive (3)
- # datalevin (1)
- # emacs (7)
- # events (2)
- # fulcro (48)
- # introduce-yourself (2)
- # lsp (36)
- # malli (11)
- # missionary (1)
- # off-topic (1)
- # other-languages (72)
- # pathom (4)
- # polylith (13)
- # portal (94)
- # re-frame (14)
- # react (5)
- # releases (1)
- # sci (12)
- # shadow-cljs (29)
- # spacemacs (3)
- # vim (4)
- # xtdb (12)
I might have found a bug Malli’s clj-kondo
type config generation when using :re
schemas. Instead of expecting a string matching a regular expression, clj-kondo
expects an argument to be of regular expression type. Or did I misunderstand something?
the kondo code outputs :regex
for :re
schemas: https://github.com/metosin/malli/blob/a3db330eae029863e9be443cda3a2cafd8f61a33/src/malli/clj_kondo.cljc#L101 and I'm not certain but I think kondo expects a string: https://github.com/clj-kondo/clj-kondo/blob/d9fca2705863e3e604e004ccb942e0b3d2e268ec/src/clj_kondo/impl/types.clj#L20
Unfortunately I deleted this example file already, but I can confirm that I get :regex
in the config, and I agree that this should probably be :string
Having said that, I never worked with clj-kondo
that deeply so I don’t know what ops/types it accepts
looks like the :regex
type in kondo expects a regex:
https://github.com/clj-kondo/clj-kondo/blob/master/doc/types.md
added this to the config:
$ cat .clj-kondo/config.edn
{:linters
{:type-mismatch
{:level :warning
:namespaces {foo {foo {:arities {1 {:args [:regex] :ret :string}}}}}}}}
and then:
$ clj-kondo --lint - <<<'(ns bar (:require [foo :refer [foo]])) (foo "")'
<stdin>:1:45: warning: Expected: regular expression, received: string.
linting took 12ms, errors: 0, warnings: 1
$ clj-kondo --lint - <<<'(ns bar (:require [foo :refer [foo]])) (foo #"")'
linting took 11ms, errors: 0, warnings: 0
I created a PR with a tiny fix for this here: https://github.com/metosin/malli/pull/701
That was fast, thanks 🙂
Why does humanize not have "Wrong!!" message when wrong value is in the first position?
({:forms (d),
:human [["should be a" "should be b" "should be c"]]}
{:forms (a d c),
:human [nil ["should be a" "should be b" "should be c" "Wrong!!"]]})
I created a PR with a tiny fix for this here: https://github.com/metosin/malli/pull/701