diff --git a/src/malli/clj_kondo.cljc b/src/malli/clj_kondo.cljc index 507a08331..4d4190cbc 100644 --- a/src/malli/clj_kondo.cljc +++ b/src/malli/clj_kondo.cljc @@ -162,12 +162,14 @@ ([config] (save! config :clj)) ([config key] + (save! config key nil)) + ([config key options] (let [cfg-file (apply io/file (conj - (get config :clj-kondo-dir-path []) + (get options :clj-kondo-dir-path []) ".clj-kondo" "metosin" (str "malli-types-" (name key)) "config.edn"))] ;; delete the old file if exists (does not throw) (.delete (apply io/file (conj - (get config :clj-kondo-dir-path []) + (get options :clj-kondo-dir-path []) ".clj-kondo" "configs" "malli" "config.edn"))) (io/make-parents cfg-file) (spit cfg-file (with-out-str (fipp/pprint config {:width 120}))) @@ -207,7 +209,7 @@ #?(:clj (defn emit! ([] (emit! {})) - ([options] (->> (collect) (linter-config) (merge options) (save!)) nil))) + ([options] (-> (collect) (linter-config) (save! :clj options)) nil))) (defn collect-cljs ([] (collect-cljs nil)) diff --git a/test/demo.clj b/test/demo.clj index c1d00638c..914ba0a51 100644 --- a/test/demo.clj +++ b/test/demo.clj @@ -33,3 +33,4 @@ :city "Tampere" :zip 33100 :lonlat [61.4858322, 23.7832851]}})) + diff --git a/test/malli/clj_kondo_test.cljc b/test/malli/clj_kondo_test.cljc index ddb829cce..4c15c5c68 100644 --- a/test/malli/clj_kondo_test.cljc +++ b/test/malli/clj_kondo_test.cljc @@ -2,6 +2,8 @@ (:require [clojure.test :refer [deftest is testing]] [malli.clj-kondo :as clj-kondo] [malli.core :as m] + #?@(:clj [[clojure.java.io :as io] + [clojure.edn :as edn]]) [malli.util :as mu])) (def Schema @@ -155,3 +157,10 @@ (testing "regular expressions" (is (= :string (clj-kondo/transform [:re "kikka"])) "the :re schema models a string, clj-kondo's :regex a Pattern object"))) + +#?(:clj + (deftest fix-1083 + (clj-kondo/emit! {:key "value"}) + (let [data (edn/read-string (slurp (io/file ".clj-kondo/metosin/malli-types-clj/config.edn")))] + (is (map? data)) + (is (= [:linters] (keys data))))))