From b31a98d7627abacd84634fbbfb97b6caf0268cac Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 14 Sep 2022 22:59:57 +0200 Subject: [PATCH] Fix #1807: false positive with map transducer in cljs --- src/clj_kondo/impl/analyzer.clj | 3 ++- test/clj_kondo/invalid_arity_test.clj | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/clj_kondo/impl/analyzer.clj b/src/clj_kondo/impl/analyzer.clj index 21266a0167..6dbd4a584c 100644 --- a/src/clj_kondo/impl/analyzer.clj +++ b/src/clj_kondo/impl/analyzer.clj @@ -1675,7 +1675,8 @@ keep keep-indexed]) arg-count (if (and transducer-eligable? (zero? arg-count)) ;; transducer - (if (and (= 'clojure.core hof-ns-name) + (if (and (or (= 'clojure.core hof-ns-name) + (= 'cljs.core hof-ns-name)) (or (= 'map hof-resolved-name) (= 'mapcat hof-resolved-name))) nil 1) diff --git a/test/clj_kondo/invalid_arity_test.clj b/test/clj_kondo/invalid_arity_test.clj index 6a6f3f74c6..ed2ecda762 100644 --- a/test/clj_kondo/invalid_arity_test.clj +++ b/test/clj_kondo/invalid_arity_test.clj @@ -149,6 +149,7 @@ (is (empty? (lint! "(reduce (fn [acc e]) [1 2 3])"))) (is (empty? (lint! "(sequence (map (fn [_ _])) (range 10) (range 10))"))) (is (empty? (lint! "(sequence (mapcat (fn [_ _])) (range 10) (range 10))"))) + (is (empty? (lint! "(map (fn [_results _cols]))" "--lang" "cljs"))) (assert-submaps '({:file "", :row 1, :col 6, :level :error, :message "clojure.core/inc is called with 2 args but expects 1"})