Upgrade clj-kondo in frontend with new fixes

- Couple tests didn't have an is so nothing was tested
- test-non-consecutive-blocks->vec-tree test was fixed
  by updating block->entity-map to include nil attributes
  as the original test wanted
- Also removed a stray :focus
This commit is contained in:
Gabriel Horner
2023-05-11 16:36:31 -04:00
committed by Tienson Qin
parent 839917dbf8
commit 29ebf73476
9 changed files with 56 additions and 49 deletions

View File

@@ -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

View File

@@ -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"]}}}

View File

@@ -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

View File

@@ -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 {}))

View File

@@ -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

View File

@@ -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]

View File

@@ -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

View File

@@ -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]

View File

@@ -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)))
(mapv #(is (= (clock/s->dhms-util %1) %2)) inputs want)))