-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clj-kondo #247
Comments
Adding a Usages given readme example: (require '[meander.epsilon :as m])
(defn favorite-food-info [foods-by-name user]
#_:clj-kondo/ignore
(m/match {:user user
:foods-by-name foods-by-name}
{:user
{:name ?name
:favorite-food {:name ?food}}
:foods-by-name {?food {:popularity ?popularity
:calories ?calories}}}
{:name ?name
:favorite {:food ?food
:popularity ?popularity
:calories ?calories}})) And if you want to get really granular: (require '[meander.epsilon :as m])
(defn favorite-food-info [foods-by-name user]
(m/match {:user user
:foods-by-name foods-by-name}
#_:clj-kondo/ignore
{:user
{:name ?name
:favorite-food {:name ?food}}
:foods-by-name {?food {:popularity ?popularity
:calories ?calories}}}
#_:clj-kondo/ignore
{:name ?name
:favorite {:food ?food
:popularity ?popularity
:calories ?calories}})) There is also the option of adding an extension, though I am not really familiar w/ doing that and haven't invested enough time to understand that process, so will leave it as merely a mention. |
Rough starting point, but courtesy of @borkdude ;; .clj-kondo/meander/epsilon.clj:
(ns meander.epsilon
(:require [clojure.string :as str]
[clojure.walk :as walk]))
(defn collect-vars [expr]
(let [vars (volatile! [])]
(walk/postwalk (fn [x]
(when (and (symbol? x)
(str/starts-with? (str x) "?"))
(vswap! vars conj x))
x)
expr)
@vars))
(defmacro rewrite [expr & exprs]
(let [ret `(do ~expr
~@(map (fn [[lhs rhs]]
`(fn ~(collect-vars lhs)
~rhs))
(partition 2 exprs)))]
;; (prn ret)
ret)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not a bug of meander.
I use meander and clj-kondo.
The meander-templates trigger lots of :unresolved-symbol warnings in clj-kondo.
I am looking for a way to ignore this warnigns by way of clj-kondo config.
Any ideas?
The text was updated successfully, but these errors were encountered: