Skip to content

Commit ff45c9a

Browse files
condition: improve a kondo hook
Body and clauses need to be linted separately in `guard`, as the body could reference bindings from outside its scope that should not be shadowed by the condition binding.
1 parent 914fcb7 commit ff45c9a

File tree

1 file changed

+9
-5
lines changed
  • resources/clj-kondo.exports/de.active-group/active-clojure/hooks

1 file changed

+9
-5
lines changed

resources/clj-kondo.exports/de.active-group/active-clojure/hooks/condition.clj

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
[condition & clauses] (:children condition+clauses)]
2121
{:node
2222
(api/list-node
23-
[(api/token-node 'let)
24-
(api/vector-node [condition (api/token-node 'nil)])
23+
(list*
24+
(api/token-node 'do)
2525
(api/list-node
26-
(list*
27-
(api/token-node 'do)
28-
(concat clauses body)))])}))
26+
[(api/token-node 'let)
27+
(api/vector-node [condition (api/token-node 'nil)])
28+
(api/list-node
29+
(list*
30+
(api/token-node 'do)
31+
clauses))])
32+
body))}))

0 commit comments

Comments
 (0)