feat: export commonly-used clj-kondo config
This commit is contained in:
parent
67e8680602
commit
4fa0008d8f
4 changed files with 34 additions and 0 deletions
1
.clj-kondo/config.edn
Normal file
1
.clj-kondo/config.edn
Normal file
|
|
@ -0,0 +1 @@
|
|||
{:config-paths ["../resources/clj-kondo.exports/com/rpl/specter"]}
|
||||
15
README.md
15
README.md
|
|
@ -334,6 +334,21 @@ When using Specter in a project with [clj-kondo](https://github.com/clj-kondo/cl
|
|||
com.rpl.specter/defrichnav clojure.core/defn}}
|
||||
```
|
||||
|
||||
The config is included in the repo and can be [imported as indicated in
|
||||
the clj-kondo
|
||||
documentation](https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#importing):
|
||||
|
||||
```sh
|
||||
clj-kondo --lint "$(clojure -Spath)" --copy-configs --skip-lint
|
||||
```
|
||||
|
||||
or, if using lein,
|
||||
|
||||
```sh
|
||||
clj-kondo --lint "$(lein classpath)" --copy-configs --skip-lint
|
||||
```
|
||||
|
||||
|
||||
# Babashka
|
||||
|
||||
This library is compatible with [babashka](https://babashka.org/) as of specter 1.1.4 and babashka 0.7.8.
|
||||
|
|
|
|||
6
resources/clj-kondo.exports/com/rpl/specter/config.edn
Normal file
6
resources/clj-kondo.exports/com/rpl/specter/config.edn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{:lint-as {com.rpl.specter/defcollector clojure.core/defn
|
||||
com.rpl.specter/defdynamicnav clojure.core/defn
|
||||
com.rpl.specter/defmacroalias clojure.core/def
|
||||
com.rpl.specter/defnav clojure.core/defn
|
||||
com.rpl.specter/defrichnav clojure.core/defn}
|
||||
:hooks {:analyze-call {com.rpl.specter/recursive-path hooks.specter/recursive-path}}}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
(ns hooks.specter
|
||||
(:require [clj-kondo.hooks-api :as api]))
|
||||
|
||||
;; (sp/recursive-path [x y] p ...) ≈ (fn [x y p] ...)
|
||||
(defn recursive-path [{:keys [:node]}]
|
||||
(let [[args self-sym & body] (rest (:children node))
|
||||
new-args (update args :children #(conj % self-sym))
|
||||
new-node (api/list-node
|
||||
(list* (api/token-node 'fn)
|
||||
new-args
|
||||
body))]
|
||||
{:node new-node}))
|
||||
Loading…
Reference in a new issue