Skip to content

Commit 18ab3f5

Browse files
committed
Make a shadow sketch template
1 parent 1bcf0e8 commit 18ab3f5

File tree

29 files changed

+2040
-0
lines changed

29 files changed

+2040
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{:hooks {:macroexpand {sci.core/copy-ns sci.core/copy-ns}}}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(ns sci.core)
2+
3+
(defmacro copy-ns
4+
([ns-sym sci-ns]
5+
`(copy-ns ~ns-sym ~sci-ns nil))
6+
([ns-sym sci-ns opts]
7+
`[(quote ~ns-sym)
8+
~sci-ns
9+
(quote ~opts)]))

tmpl/sketch/.clj-kondo/config.edn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{:lint-as {day8.re-frame.tracing/defn-traced clojure.core/defn
2+
day8.re-frame.tracing/fn-traced clojure.core/fn
3+
reagent.core/with-let clojure.core/let}
4+
:linters {}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
{:hooks
3+
{:analyze-call {org.httpkit.server/with-channel httpkit.with-channel/with-channel}}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(ns httpkit.with-channel
2+
(:require [clj-kondo.hooks-api :as api]))
3+
4+
(defn with-channel [{node :node}]
5+
(let [[request channel & body] (rest (:children node))]
6+
(when-not (and request channel) (throw (ex-info "No request or channel provided" {})))
7+
(when-not (api/token-node? channel) (throw (ex-info "Missing channel argument" {})))
8+
(let [new-node
9+
(api/list-node
10+
(list*
11+
(api/token-node 'let)
12+
(api/vector-node [channel (api/vector-node [])])
13+
request
14+
body))]
15+
16+
{:node new-node})))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{:lint-as {malli.experimental/defn schema.core/defn}
2+
:linters {:unresolved-symbol {:exclude [(malli.core/=>)]}}}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{:lint-as
2+
{rewrite-clj.zip/subedit-> clojure.core/->
3+
rewrite-clj.zip/subedit->> clojure.core/->>
4+
rewrite-clj.zip/edit-> clojure.core/->
5+
rewrite-clj.zip/edit->> clojure.core/->>}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{:hooks {:analyze-call {taoensso.encore/defalias taoensso.encore/defalias}}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(ns taoensso.encore
2+
(:require
3+
[clj-kondo.hooks-api :as hooks]))
4+
5+
(defn defalias [{:keys [node]}]
6+
(let [[sym-raw src-raw] (rest (:children node))
7+
src (if src-raw src-raw sym-raw)
8+
sym (if src-raw
9+
sym-raw
10+
(symbol (name (hooks/sexpr src))))]
11+
{:node (with-meta
12+
(hooks/list-node
13+
[(hooks/token-node 'def)
14+
(hooks/token-node (hooks/sexpr sym))
15+
(hooks/token-node (hooks/sexpr src))])
16+
(meta src))}))

tmpl/sketch/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.calva
3+
/.lsp
4+
/.nrepl-*
5+
/.shadow-cljs
6+
/public/dist
7+
/target
8+
node_modules/

0 commit comments

Comments
 (0)