diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index c982062165..f2c5de3d16 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -15,6 +15,8 @@ :aliased-namespace-symbol {:level :warning} ;; Disable until it doesn't trigger false positives on rum/defcontext :earmuffed-var-not-dynamic {:level :off} + ;; Disable until we decide to use conj! as recommended in docs + :unused-value {:level :off} :unresolved-symbol {:exclude [goog.DEBUG goog.string.unescapeEntities ;; TODO:lint: Fix when fixing all type hints diff --git a/deps.edn b/deps.edn index 580bb9894d..66a9a8bdf4 100644 --- a/deps.edn +++ b/deps.edn @@ -54,5 +54,5 @@ :main-opts ["-m" "cljs-test-runner.main" "-d" "src/bench" "-n" "frontend.benchmark-test-runner"]} ;; Use :replace-deps for tools. See https://github.com/clj-kondo/clj-kondo/issues/1536#issuecomment-1013006889 - :clj-kondo {:replace-deps {clj-kondo/clj-kondo {:mvn/version "2022.12.08"}} + :clj-kondo {:replace-deps {clj-kondo/clj-kondo {:mvn/version "2023.05.26"}} :main-opts ["-m" "clj-kondo.main"]}}} diff --git a/src/main/frontend/components/shortcut.cljs b/src/main/frontend/components/shortcut.cljs index d4b481b7af..0173c2626e 100644 --- a/src/main/frontend/components/shortcut.cljs +++ b/src/main/frontend/components/shortcut.cljs @@ -35,7 +35,7 @@ :on-click (fn [] (dh/remove-shortcut k) (shortcut/refresh!) - (swap! *keypress (fn [] "")) ;; Clear local state + (swap! *keypress (constantly "")) ;; Clear local state )} "Reset"])]] [:div.cancel-save-buttons.text-right.mt-4 diff --git a/src/main/frontend/db/react.cljs b/src/main/frontend/db/react.cljs index e8115dbaf5..da430e3d49 100644 --- a/src/main/frontend/db/react.cljs +++ b/src/main/frontend/db/react.cljs @@ -52,10 +52,10 @@ (defonce query-state (atom {})) ;; Current dynamic component -(def ^:dynamic *query-component*) +(def ^:dynamic *query-component* nil) ;; Which reactive queries are triggered by the current component -(def ^:dynamic *reactive-queries*) +(def ^:dynamic *reactive-queries* nil) ;; component -> query-key (defonce query-components (atom {})) diff --git a/src/main/frontend/extensions/pdf/toolbar.cljs b/src/main/frontend/extensions/pdf/toolbar.cljs index 7c4d1edee5..4faef3cda2 100644 --- a/src/main/frontend/extensions/pdf/toolbar.cljs +++ b/src/main/frontend/extensions/pdf/toolbar.cljs @@ -21,6 +21,7 @@ (def *area-dashed? (atom ((fnil identity false) (storage/get (str "ls-pdf-area-is-dashed"))))) (def *area-mode? (atom false)) (def *highlight-mode? (atom false)) +#_:clj-kondo/ignore (rum/defcontext *highlights-ctx*) (rum/defc pdf-settings diff --git a/src/main/frontend/modules/outliner/tree.cljs b/src/main/frontend/modules/outliner/tree.cljs index 0307884fc1..fdaee18769 100644 --- a/src/main/frontend/modules/outliner/tree.cljs +++ b/src/main/frontend/modules/outliner/tree.cljs @@ -88,13 +88,16 @@ (defn block-entity->map [e] - {:db/id (:db/id e) - :block/uuid (:block/uuid e) - :block/parent {:db/id (:db/id (:block/parent e))} - :block/left {:db/id (:db/id (:block/left e))} - :block/page (:block/page e) - :block/refs (:block/refs e) - :block/children (:block/children e)}) + (cond-> {:db/id (:db/id e) + :block/uuid (:block/uuid e) + :block/parent {:db/id (:db/id (:block/parent e))} + :block/page (:block/page e)} + (:db/id (:block/left e)) + (assoc :block/left {:db/id (:db/id (:block/left e))}) + (:block/refs e) + (assoc :block/refs (:block/refs e)) + (:block/children e) + (assoc :block/children (:block/children e)))) (defn filter-top-level-blocks [blocks] diff --git a/src/test/frontend/handler/editor_test.cljs b/src/test/frontend/handler/editor_test.cljs index f819c408e4..daba691e75 100644 --- a/src/test/frontend/handler/editor_test.cljs +++ b/src/test/frontend/handler/editor_test.cljs @@ -284,7 +284,7 @@ :block-uuid (:block/uuid block)}]))] (editor/delete-block! test-helper/test-db false)))) -(deftest ^:focus delete-block! +(deftest delete-block! (testing "backspace deletes empty block" (load-test-files [{:file/path "pages/page1.md" :file/content "\n diff --git a/src/test/frontend/modules/outliner/core_test.cljs b/src/test/frontend/modules/outliner/core_test.cljs index 6a7fe15240..85bcef307c 100644 --- a/src/test/frontend/modules/outliner/core_test.cljs +++ b/src/test/frontend/modules/outliner/core_test.cljs @@ -245,7 +245,7 @@ :db/id 147, :block/parent #:db{:id 144}, :block/page #:db{:id 144}}]] - (= blocks (outliner-core/fix-top-level-blocks blocks))))) + (is (= blocks (outliner-core/fix-top-level-blocks blocks)))))) (deftest test-outdent-blocks (testing " @@ -735,41 +735,42 @@ tags:: tag1, tag2 :block/uuid #uuid "62f4b8c6-072e-4133-90e2-0591021a7fea", :block/parent #:db{:id 2333}, :db/id 2334}]] - (= (tree/non-consecutive-blocks->vec-tree blocks) - '({:db/id 2315, - :block/uuid #uuid "62f49b4c-f9f0-4739-9985-8bd55e4c68d4", - :block/parent #:db{:id 2313}, - :block/page #:db{:id 2313}, - :block/level 1, - :block/children - [{:db/id 2316, - :block/uuid #uuid "62f49b4c-aa84-416e-9554-b486b4e59b1b", - :block/parent #:db{:id 2315}, - :block/page #:db{:id 2313}, - :block/level 2, - :block/children - [{:db/id 2317, - :block/uuid #uuid "62f49b4c-f80c-49b4-ae83-f78c4520c071", - :block/parent #:db{:id 2316}, - :block/page #:db{:id 2313}, - :block/level 3, - :block/children - [{:db/id 2318, - :block/uuid #uuid "62f49b4c-8f5b-4a04-b749-68d34b28bcf2", - :block/parent #:db{:id 2317}, - :block/page #:db{:id 2313}, - :block/level 4}]}]} - {:db/id 2333, - :block/uuid #uuid "62f4b8c1-a99b-434f-84c3-011d6afc48ba", - :block/parent #:db{:id 2315}, - :block/page #:db{:id 2313}, - :block/level 2, - :block/children - [{:db/id 2334, - :block/uuid #uuid "62f4b8c6-072e-4133-90e2-0591021a7fea", - :block/parent #:db{:id 2333}, - :block/page #:db{:id 2313}, - :block/level 3}]}]})))) + (is + (= (tree/non-consecutive-blocks->vec-tree blocks) + '({:db/id 2315, + :block/uuid #uuid "62f49b4c-f9f0-4739-9985-8bd55e4c68d4", + :block/parent #:db{:id 2313}, + :block/page #:db{:id 2313}, + :block/level 1, + :block/children + [{:db/id 2316, + :block/uuid #uuid "62f49b4c-aa84-416e-9554-b486b4e59b1b", + :block/parent #:db{:id 2315}, + :block/page #:db{:id 2313}, + :block/level 2, + :block/children + [{:db/id 2317, + :block/uuid #uuid "62f49b4c-f80c-49b4-ae83-f78c4520c071", + :block/parent #:db{:id 2316}, + :block/page #:db{:id 2313}, + :block/level 3, + :block/children + [{:db/id 2318, + :block/uuid #uuid "62f49b4c-8f5b-4a04-b749-68d34b28bcf2", + :block/parent #:db{:id 2317}, + :block/page #:db{:id 2313}, + :block/level 4}]}]} + {:db/id 2333, + :block/uuid #uuid "62f4b8c1-a99b-434f-84c3-011d6afc48ba", + :block/parent #:db{:id 2315}, + :block/page #:db{:id 2313}, + :block/level 2, + :block/children + [{:db/id 2334, + :block/uuid #uuid "62f4b8c6-072e-4133-90e2-0591021a7fea", + :block/parent #:db{:id 2333}, + :block/page #:db{:id 2313}, + :block/level 3}]}]}))))) (comment (dotimes [i 5] diff --git a/src/test/frontend/util/clocktime_test.cljs b/src/test/frontend/util/clocktime_test.cljs index d57ac849a2..481309766d 100644 --- a/src/test/frontend/util/clocktime_test.cljs +++ b/src/test/frontend/util/clocktime_test.cljs @@ -14,4 +14,4 @@ [0, 17, 45, 53], [5, 14, 41, 22], [27, 17, 8, 23]]] - (map #(is (= (clock/s->dhms-util %1) %2)) inputs want))) \ No newline at end of file + (mapv #(is (= (clock/s->dhms-util %1) %2)) inputs want))) \ No newline at end of file