Browse Source

fix: stop shadowing vars for rest of frontend

Follow up to 5ff364ba1e5b7c7facece100a77c7d54f9736777
Gabriel Horner 1 year ago
parent
commit
70383cd813
41 changed files with 258 additions and 260 deletions
  1. 9 10
      .clj-kondo/config.edn
  2. 3 3
      src/electron/electron/utils.cljs
  3. 2 2
      src/main/frontend/commands.cljs
  4. 3 3
      src/main/frontend/common/search_fuzzy.cljs
  5. 2 2
      src/main/frontend/components/block.cljs
  6. 3 3
      src/main/frontend/components/file_sync.cljs
  7. 2 2
      src/main/frontend/db/query_dsl.cljs
  8. 7 7
      src/main/frontend/extensions/calc.cljc
  9. 6 6
      src/main/frontend/extensions/code.cljs
  10. 2 2
      src/main/frontend/extensions/html_parser.cljs
  11. 24 24
      src/main/frontend/extensions/srs.cljs
  12. 4 4
      src/main/frontend/extensions/video/youtube.cljs
  13. 2 2
      src/main/frontend/extensions/zotero.cljs
  14. 9 9
      src/main/frontend/extensions/zotero/api.cljs
  15. 14 14
      src/main/frontend/extensions/zotero/extractor.cljs
  16. 5 5
      src/main/frontend/extensions/zotero/setting.cljs
  17. 2 2
      src/main/frontend/fs.cljs
  18. 2 2
      src/main/frontend/fs/capacitor_fs.cljs
  19. 2 2
      src/main/frontend/fs/nfs.cljs
  20. 2 2
      src/main/frontend/fs/node.cljs
  21. 24 24
      src/main/frontend/fs/sync.cljs
  22. 4 4
      src/main/frontend/handler/export/text.cljs
  23. 3 4
      src/main/frontend/handler/page.cljs
  24. 2 2
      src/main/frontend/handler/plugin.cljs
  25. 5 5
      src/main/frontend/handler/user.cljs
  26. 2 2
      src/main/frontend/handler/whiteboard.cljs
  27. 2 2
      src/main/frontend/mixins.cljs
  28. 3 3
      src/main/frontend/mobile/mobile_bar.cljs
  29. 2 2
      src/main/frontend/modules/instrumentation/sentry.cljs
  30. 28 28
      src/main/frontend/ui.cljs
  31. 10 10
      src/main/frontend/util.cljc
  32. 2 2
      src/main/frontend/util/clock.cljs
  33. 30 30
      src/main/frontend/util/cursor.cljs
  34. 2 2
      src/main/frontend/worker/db/migrate.cljs
  35. 3 3
      src/main/frontend/worker/db_worker.cljs
  36. 3 3
      src/main/frontend/worker/rtc/core.cljs
  37. 2 2
      src/main/frontend/worker/search.cljs
  38. 2 2
      src/main/logseq/api.cljs
  39. 8 8
      src/test/frontend/modules/outliner/core_test.cljs
  40. 5 5
      src/test/frontend/test/helper.cljs
  41. 11 11
      src/test/frontend/worker/undo_redo_test.cljs

+ 9 - 10
.clj-kondo/config.edn

@@ -4,16 +4,7 @@
  ;; :used-underscored-binding is turned off for components because of false positive
  ;; for rum/defcs and _state.
  {all-components
-  {:linters {:used-underscored-binding {:level :off}
-             ;; TODO: Apply this to all of frontend
-             :shadowed-var {:level :warning
-                            ;; FIXME: Remove most of these as shadowing core fns isn't a good practice
-                            :exclude [t name binding type uuid key val time fn ex-data list
-                                      keys vals sort-by namespace count parents int? hash subs
-                                      load-file exists? rest object? min max class array range string? delay?
-                                      new var re-pattern update iter ns char resolve sequence identity
-                                      dispatch-fn identity comp max-key vec meta next delay str vector list? chars
-                                      chunk test]}}}
+  {:linters {:used-underscored-binding {:level :off}}}
   ;; false positive with match/match and _
   frontend.handler.paste {:linters {:used-underscored-binding {:level :off}}}
   frontend.db {:linters {:aliased-namespace-symbol
@@ -23,6 +14,14 @@
  {:path-invalid-construct/string-join {:level :info}
   :regex-checks/double-escaped-regex {:level :warning}
   :aliased-namespace-symbol {:level :warning}
+  :shadowed-var {:level :warning
+                 :exclude [key val name binding type uuid
+                           ;; FIXME: Remove the shadowed below as shadowing core fns isn't a good practice
+                           ;; FIXME: At least remove the first two lines as they have few uses
+                           re-pattern sequence dispatch-fn comp vec delay chunk
+                           fn t ex-data list int? hash range
+                           time sort-by namespace count parents exists? min
+                           new var ns resolve identity next meta vals keys exists?]}
   ;; 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

+ 3 - 3
src/electron/electron/utils.cljs

@@ -209,10 +209,10 @@
 
 (defn save-proxy-settings
   "Save proxy settings to configs.edn"
-  [{:keys [type host port test] :or {type "system"}}]
+  [{test' :test :keys [type host port] :or {type "system"}}]
   (if (or (= type "system") (= type "direct"))
-    (cfgs/set-item! :settings/agent {:type type :test test})
-    (cfgs/set-item! :settings/agent {:type type :protocol type :host host :port port :test test})))
+    (cfgs/set-item! :settings/agent {:type type :test test'})
+    (cfgs/set-item! :settings/agent {:type type :protocol type :host host :port port :test test'})))
 
 (defn should-read-content?
   "Skip reading content of file while using file-watcher"

+ 2 - 2
src/main/frontend/commands.cljs

@@ -839,8 +839,8 @@
   (prn "No handler for step: " type))
 
 (defn handle-steps
-  [vector format]
-  (doseq [step vector]
+  [vector' format]
+  (doseq [step vector']
     (handle-step step format)))
 
 (defn exec-plugin-simple-command!

+ 3 - 3
src/main/frontend/common/search_fuzzy.cljs

@@ -31,9 +31,9 @@
 (defn score
   [oquery ostr]
   (let [query (clean-str oquery)
-        str (clean-str ostr)]
+        s (clean-str ostr)]
     (loop [q (seq (char-array query))
-           s (seq (char-array str))
+           s (seq (char-array s))
            mult 1
            idx MAX-STRING-LENGTH
            score' 0]
@@ -41,7 +41,7 @@
         ;; add str-len-distance to score, so strings with matches in same position get sorted by length
         ;; boost score if we have an exact match including punctuation
         (empty? q) (+ score'
-                      (str-len-distance query str)
+                      (str-len-distance query s)
                       (if (<= 0 (.indexOf ostr oquery)) MAX-STRING-LENGTH 0))
         (empty? s) 0
         :else (if (= (first q) (first s))

+ 2 - 2
src/main/frontend/components/block.cljs

@@ -3267,10 +3267,10 @@
   [config {:keys [name content checkbox items number] :as _list}]
   (let [content (when-not (empty? content)
                   (match content
-                    [["Paragraph" i] & rest]
+                    [["Paragraph" i] & rest']
                     (vec-cat
                      (map-inline config i)
-                     (markup-elements-cp config rest))
+                     (markup-elements-cp config rest'))
                     :else
                     (markup-elements-cp config content)))
         checked? (some? checkbox)

+ 3 - 3
src/main/frontend/components/file_sync.cljs

@@ -645,7 +645,7 @@
               (js/setTimeout (fn [] (set-content-ready? true)) 100))
 
             ;; without cache
-            (let [load-file (fn [repo-url file]
+            (let [load-file' (fn [repo-url file]
                               (-> (fs-util/read-repo-file repo-url file)
                                   (p/then
                                    (fn [content]
@@ -657,11 +657,11 @@
                 (async/go
                   (let [downloaded-path (async/<! (file-sync-handler/download-version-file graph-uuid file-uuid version-uuid true))]
                     (when downloaded-path
-                      (load-file repo-url downloaded-path))))
+                      (load-file' repo-url downloaded-path))))
 
                 ;; read local content
                 (when-let [relative-path (:relative-path selected-page)]
-                  (load-file repo-url relative-path)))))))
+                  (load-file' repo-url relative-path)))))))
      [selected-page])
 
     (rum/use-effect!

+ 2 - 2
src/main/frontend/db/query_dsl.cljs

@@ -707,8 +707,8 @@ Some bindings in this fn:
                                        #(sort-by % (fn [m prop] (get-in m [:block/properties prop]))))})))))))
 
 (defn query-contains-filter?
-  [query filter-name]
-  (string/includes? query (str "(" filter-name)))
+  [query' filter-name]
+  (string/includes? query' (str "(" filter-name)))
 
 (comment
   ;; {{query (and (page-property foo bar) [[hello]])}}

+ 7 - 7
src/main/frontend/extensions/calc.cljc

@@ -1,5 +1,5 @@
 (ns frontend.extensions.calc
-  (:refer-clojure :exclude [eval])
+  (:refer-clojure :exclude [eval numerator denominator])
   (:require [clojure.string :as str]
             [frontend.util :as util]
 
@@ -135,9 +135,9 @@
 (defn can-fix?
   "Check that number can render without loss of all significant digits,
    and that the absolute value is less than 1e21."
-  [num places]
-  (or (.isZero num )
-    (let [mag (.abs num)
+  [num' places]
+  (or (.isZero num' )
+    (let [mag (.abs num')
           lower-bound (-> (bn/BigNumber 0.5) (.shiftedBy (- places)))
           upper-bound (bn/BigNumber 1e21)]
       (and (-> mag (.isGreaterThanOrEqualTo lower-bound))
@@ -146,9 +146,9 @@
 (defn can-fit?
   "Check that number can render normally within the given number of digits.
    Tolerance allows for leading zeros in a decimal fraction."
-  [num digits tolerance]
-  (and (< (.-e num) digits)
-       (.isInteger (.shiftedBy num (+ tolerance digits)))))
+  [num' digits tolerance]
+  (and (< (.-e num') digits)
+       (.isInteger (.shiftedBy num' (+ tolerance digits)))))
 
 (defn format-base [val base]
   (let [sign (.-s val)

+ 6 - 6
src/main/frontend/extensions/code.cljs

@@ -520,16 +520,16 @@
    :did-update (fn [state]
                  (let [next-theme (get-theme!)
                        last-theme @(:last-theme state)
-                       editor (some-> state :editor-atom deref)]
-                   (when (and editor (not= next-theme last-theme))
+                       editor' (some-> state :editor-atom deref)]
+                   (when (and editor' (not= next-theme last-theme))
                      (reset! (:last-theme state) next-theme)
-                     (.setOption editor "theme" next-theme)))
+                     (.setOption editor' "theme" next-theme)))
                  (reset! (:code-options state) (last (:rum/args state)))
                  (when-not (:file? (first (:rum/args state)))
                    (let [code (nth (:rum/args state) 3)
-                         editor @(:editor-atom state)]
-                     (when (and editor (not= (.getValue editor) code))
-                       (.setValue editor code))))
+                         editor' @(:editor-atom state)]
+                     (when (and editor' (not= (.getValue editor') code))
+                       (.setValue editor' code))))
                  state)}
   [state _config id attr code _theme _options]
   [:div.extensions__code

+ 2 - 2
src/main/frontend/extensions/html_parser.cljs

@@ -33,8 +33,8 @@
         block-pattern (if (= format :markdown)
                         "#"
                         (config/get-block-pattern format))
-        map-join (fn [children & {:keys [list?]}]
-                   (let [opts' (if list?
+        map-join (fn [children & {list?' :list?}]
+                   (let [opts' (if list?'
                                  (let [level (inc (or (:level opts) 0))]
                                    (assoc opts :level level))
                                  opts)]

+ 24 - 24
src/main/frontend/extensions/srs.cljs

@@ -70,7 +70,7 @@
   "any number between 0 and 1 (the greater it is the faster the changes of the OF matrix)"
   0.5)
 
-(defn- learning-fraction []
+(defn- get-learning-fraction []
   (if-let [learning-fraction (:srs/learning-fraction (state/get-config))]
     (if (and (number? learning-fraction)
              (< learning-fraction 1)
@@ -79,11 +79,11 @@
       learning-fraction-default)
     learning-fraction-default))
 
-(def of-matrix (persist-var/persist-var nil "srs-of-matrix"))
+(def srs-of-matrix (persist-var/persist-var nil "srs-of-matrix"))
 
 (def initial-interval-default 4)
 
-(defn- initial-interval []
+(defn- get-initial-interval []
   (if-let [initial-interval (:srs/initial-interval (state/get-config))]
     (if (and (number? initial-interval)
              (> initial-interval 0))
@@ -147,7 +147,7 @@
 (defn- get-of [of-matrix n ef]
   (or (get-in of-matrix [n ef])
       (if (<= n 1)
-        (initial-interval)
+        (get-initial-interval)
         ef)))
 
 (defn- set-of [of-matrix n ef of]
@@ -162,25 +162,25 @@
     (* (get-of of-matrix n ef)
        (interval (- n 1) ef of-matrix))))
 
-(defn- next-ef
+(defn- get-next-ef
   [ef quality]
   (let [ef* (+ ef (- 0.1 (* (- 5 quality) (+ 0.08 (* 0.02 (- 5 quality))))))]
     (if (< ef* 1.3) 1.3 ef*)))
 
-(defn- next-of-matrix
+(defn- get-next-of-matrix
   [of-matrix n quality fraction ef]
   (let [of (get-of of-matrix n ef)
         of* (* of (+ 0.72 (* quality 0.07)))
         of** (+ (* (- 1 fraction) of) (* of* fraction))]
     (set-of of-matrix n ef of**)))
 
-(defn next-interval
+(defn calc-next-interval
   "return [next-interval repeats next-ef of-matrix]"
   [_last-interval repeats ef quality of-matrix]
   (assert (and (<= quality 5) (>= quality 0)))
   (let [ef (or ef 2.5)
-        next-ef (next-ef ef quality)
-        next-of-matrix (next-of-matrix of-matrix repeats quality (learning-fraction) ef)
+        next-ef (get-next-ef ef quality)
+        next-of-matrix (get-next-of-matrix of-matrix repeats quality (get-learning-fraction) ef)
         next-interval (interval repeats next-ef next-of-matrix)]
 
     (if (< quality 3)
@@ -272,15 +272,15 @@
                                                    (string/starts-with? query-string "["))
                                          (page-ref/->page-ref (string/trim query-string))
                                          query-string)
-                          {:keys [query sort-by rules]} (query-dsl/parse query-string {:db-graph? (config/db-based-graph? repo)})
-                          query* (util/concat-without-nil
+                          {query* :query :keys [sort-by rules]} (query-dsl/parse query-string {:db-graph? (config/db-based-graph? repo)})
+                          query** (util/concat-without-nil
                                   [['?b :block/refs '?br] ['?br :block/name card-hash-tag]]
-                                  (if (coll? (first query)) query [query]))]
-                      (when-let [query (query-dsl/query-wrapper query*
-                                                                {:blocks? true
-                                                                 :block-attrs [:db/id :block/properties]})]
+                                  (if (coll? (first query*)) query* [query*]))]
+                      (when-let [query' (query-dsl/query-wrapper query**
+                                                                 {:blocks? true
+                                                                  :block-attrs [:db/id :block/properties]})]
                         (let [result (query-react/react-query repo
-                                                              {:query (with-meta query {:cards-query? true})
+                                                              {:query (with-meta query' {:cards-query? true})
                                                                :rules (or rules [])}
                                                               (merge
                                                                {:use-cache? use-cache?}
@@ -330,7 +330,7 @@
         last-ef (or (when-let [v (get props card-last-easiness-factor-property)]
                       (util/safe-parse-float v)) 2.5)
         [next-interval next-repeats next-ef of-matrix*]
-        (next-interval last-interval repeats last-ef score @of-matrix)
+        (calc-next-interval last-interval repeats last-ef score @srs-of-matrix)
         next-interval* (if (< next-interval 0) 0 next-interval)
         next-schedule (tc/to-string (t/plus (tl/local-now) (t/hours (* 24 next-interval*))))
         now (tc/to-string (tl/local-now))]
@@ -349,7 +349,7 @@
   (let [block (.-block card)
         result (get-next-interval card score)
         next-of-matrix (:next-of-matrix result)]
-    (reset! of-matrix next-of-matrix)
+    (reset! srs-of-matrix next-of-matrix)
     (save-block-card-properties! (db/pull (:db/id block))
                                  (select-keys result
                                               [card-last-interval-property
@@ -617,7 +617,7 @@
                           (when-not @*preview-mode?
                             (operation-card-info-summary!
                              review-records review-cards card-query-block)
-                            (persist-var/persist-save of-matrix)))]
+                            (persist-var/persist-save srs-of-matrix)))]
         [:div.flex-1.cards-review {:style (when modal? {:height "100%"})}
          [:div.flex.flex-row.items-center.justify-between.cards-title
           [:div.flex.flex-row.items-center
@@ -632,9 +632,9 @@
                 [:span {:style {:margin-top 2}}
                  (svg/caret-down)]]])
             (fn [{:keys [toggle-fn]}]
-              (cards-select {:on-chosen (fn [query]
-                                          (let [query' (if (= query (t :flashcards/modal-select-all)) "" query)]
-                                            (reset! query-atom query')
+              (cards-select {:on-chosen (fn [query']
+                                          (let [query'' (if (= query' (t :flashcards/modal-select-all)) "" query')]
+                                            (reset! query-atom query'')
                                             (toggle-fn)))}))
             {:modal-class (util/hiccup->class
                            "origin-top-right.absolute.left-0.mt-2.ml-2.rounded-md.shadow-lg")})]
@@ -822,5 +822,5 @@
       (js/setTimeout f 1000)
       (when (nil? @*due-cards-interval)
         ;; refresh every hour
-        (let [interval (js/setInterval f (* 3600 1000))]
-          (reset! *due-cards-interval interval))))))
+        (let [interval' (js/setInterval f (* 3600 1000))]
+          (reset! *due-cards-interval interval'))))))

+ 4 - 4
src/main/frontend/extensions/video/youtube.cljs

@@ -122,13 +122,13 @@ Remember: You can paste a raw YouTube url as embedded video on mobile."
       nil)))
 
 
-(defn parse-timestamp [timestamp]
+(defn parse-timestamp [timestamp']
   (let [reg #"^(?:(\d+):)?([0-5]?\d):([0-5]?\d)$"
         reg-number #"^\d+$"
-        timestamp (str timestamp)
-        total-seconds (some-> (re-matches reg-number timestamp)
+        timestamp'' (str timestamp')
+        total-seconds (some-> (re-matches reg-number timestamp'')
                               util/safe-parse-int)
-        [_ hours minutes seconds] (re-matches reg timestamp)
+        [_ hours minutes seconds] (re-matches reg timestamp'')
         [hours minutes seconds] (map #(if (nil? %) 0 (util/safe-parse-int %)) [hours minutes seconds])]
     (cond
       total-seconds

+ 2 - 2
src/main/frontend/extensions/zotero.cljs

@@ -384,7 +384,7 @@
       :on-click
       (fn []
         (p/let [_ (setting/remove-profile @profile*)]
-          (reset! profile* (setting/profile)))))]])
+          (reset! profile* (setting/get-profile)))))]])
 
 (rum/defcs add-all-items <
   (rum/local nil ::progress)
@@ -447,7 +447,7 @@
 (rum/defcs settings
   <
   (rum/local (setting/all-profiles) ::all-profiles)
-  (rum/local (setting/profile) ::profile)
+  (rum/local (setting/get-profile) ::profile)
   rum/reactive
   {:should-update
    (fn [old-state _new-state]

+ 9 - 9
src/main/frontend/extensions/zotero/api.cljs

@@ -2,8 +2,8 @@
   (:require [camel-snake-kebab.core :as csk]
             [camel-snake-kebab.extras :as cske]
             [cljs-http.client :as http]
-            [cljs.core.async
-             :refer [<! >! alt! chan close! go go-loop timeout]]
+            [cljs.core.async :as async
+             :refer [<! >! alt! chan close! go go-loop]]
             [clojure.string :as str]
             [frontend.util :as util]
             [frontend.extensions.zotero.setting :as setting]))
@@ -26,7 +26,7 @@
   (let [out (chan)]
     (go-loop [last-val nil]
       (let [val   (if (nil? last-val) (<! in) last-val)
-            timer (timeout ms)]
+            timer (async/timeout ms)]
         (alt!
           in ([v] (if v
                     (recur v)
@@ -56,17 +56,17 @@
           :start)
          "0")))))
 
-(defn results-count [headers]
+(defn get-results-count [headers]
   (-> (cske/transform-keys csk/->kebab-case-keyword headers)
       :total-results
       util/safe-parse-int))
 
 ;; "/users/475425/collections?v=3"
 (defn get*
-  ([config api]
-   (get* config api nil))
-  ([config api query-params]
-   (go (let [{:keys [api-version base type type-id api-key timeout]} config
+  ([config' api]
+   (get* config' api nil))
+  ([config' api query-params]
+   (go (let [{:keys [api-version base type type-id api-key timeout]} config'
              {:keys [success body headers] :as response}
              (<! (http/get (str base
                                 (if (= type :user)
@@ -84,7 +84,7 @@
            (let [result     (cske/transform-keys csk/->kebab-case-keyword body)
                  next-start (parse-start headers :next)
                  prev-start (parse-start headers :prev)
-                 results-count (results-count headers)]
+                 results-count (get-results-count headers)]
              (cond-> {:result result}
                next-start
                (assoc :next next-start)

+ 14 - 14
src/main/frontend/extensions/zotero/extractor.cljs

@@ -21,11 +21,11 @@
     (when citation
       (string/trim (string/replace citation "Citation Key: " "")))))
 
-(defn title [item] (-> item :data :title))
+(defn ->title [item] (-> item :data :title))
 
-(defn item-key [item] (:key item))
+(defn ->item-key [item] (:key item))
 
-(defn page-name [item]
+(defn ->page-name [item]
   (let [page-title
         (case (item-type item)
           "case"
@@ -35,14 +35,14 @@
           "statute"
           (-> item :data :name-of-act)
           ;; default use title
-          (title item))
+          (->title item))
         citekey (citation-key item)]
     (if (and (setting/setting :prefer-citekey?)
              (not (string/blank? citekey)))
       (str (setting/setting :page-insert-prefix) citekey)
       (str (setting/setting :page-insert-prefix) page-title))))
 
-(defn authors [item]
+(defn ->authors [item]
   (let [creators (-> item :data :creators)
         authors
         (into []
@@ -53,7 +53,7 @@
               creators)]
     (distinct authors)))
 
-(defn tags [item]
+(defn ->tags [item]
   (let [tags
         (->> (-> item :data :tags)
              (mapv (fn [{:keys [tag]}] (string/trim tag)))
@@ -115,11 +115,11 @@
        ", "
        (markdown-link "Web library" (web-link item))))
 
-(defn properties [item]
+(defn ->properties [item]
   (let [type    (item-type item)
         fields  (schema/fields type)
-        authors (authors item)
-        tags    (tags item)
+        authors (->authors item)
+        tags    (->tags item)
         links   (zotero-links item)
         date    (date->journal item)
         data    (-> item :data
@@ -133,7 +133,7 @@
                                 :item-type (page-ref/->page-ref type))
                          (dissoc :creators :abstract-note)
                          (rename-keys {:title :original-title})
-                         (assoc :title (page-name item)))]
+                         (assoc :title (->page-name item)))]
     (->> data
          (remove (comp (fn [v] (or (string/blank? v) (empty? v))) second))
          (into {}))))
@@ -157,7 +157,7 @@
       (str
        (markdown-link title (local-link item))
        " "
-       (zotero-imported-file-macro (item-key item) filename))
+       (zotero-imported-file-macro (->item-key item) filename))
       "linked_file"
       (str
        (markdown-link title (local-link item))
@@ -167,14 +167,14 @@
       (str
        (markdown-link title url)
        " "
-       (zotero-imported-file-macro (item-key item) filename))
+       (zotero-imported-file-macro (->item-key item) filename))
       "linked_url"
       (markdown-link title url))))
 
 (defmethod extract :default
   [item]
-  (let [page-name  (page-name item)
-        properties (properties item)
+  (let [page-name  (->page-name item)
+        properties (->properties item)
         abstract-note (-> item :data :abstract-note)]
     {:page-name  page-name
      :properties properties

+ 5 - 5
src/main/frontend/extensions/zotero/setting.cljs

@@ -27,17 +27,17 @@
         default #{"default"}]
     (if (empty? profiles) default profiles)))
 
-(defn profile []
+(defn get-profile []
   (let [profile (storage/get :zotero/setting-profile)]
     (if (and profile (contains? (all-profiles) profile))
       profile
       (first (all-profiles)))))
 
 (defn api-key []
-  (get (storage/get :zotero/api-key-v2) (profile)))
+  (get (storage/get :zotero/api-key-v2) (get-profile)))
 
 (defn set-api-key [key]
-  (let [profile (profile)
+  (let [profile (get-profile)
         api-key-map (storage/get :zotero/api-key-v2)]
     (storage/set :zotero/api-key-v2 (assoc api-key-map profile key))))
 
@@ -57,14 +57,14 @@
     (config-handler/set-config! :zotero/settings-v2 settings)))
 
 (defn set-setting! [k v]
-  (let [profile (profile)
+  (let [profile (get-profile)
         new-settings (update (sub-zotero-config)
                              profile
                              #(assoc % k v))]
     (config-handler/set-config! :zotero/settings-v2 new-settings)))
 
 (defn setting [k]
-  (let [profile (profile)]
+  (let [profile (get-profile)]
     (-> (sub-zotero-config)
         (get profile)
         (get k (get default-settings k)))))

+ 2 - 2
src/main/frontend/fs.cljs

@@ -234,12 +234,12 @@
   ([fpath]
    (util/p-handle
     (stat fpath)
-    (fn [stat] (not (nil? stat)))
+    (fn [stat'] (not (nil? stat')))
     (fn [_e] false)))
   ([dir path]
    (util/p-handle
     (stat dir path)
-    (fn [stat] (not (nil? stat)))
+    (fn [stat'] (not (nil? stat')))
     (fn [_e] false))))
 
 (defn asset-href-exists?

+ 2 - 2
src/main/frontend/fs/capacitor_fs.cljs

@@ -145,7 +145,7 @@
                                 (concat (rest dirs) files-dir)))))]
     (js->clj result :keywordize-keys true)))
 
-(defn- contents-matched?
+(defn- <contents-matched?
   [disk-content db-content]
   (when (and (string? disk-content) (string? db-content))
     (p/resolved (= (string/trim disk-content) (string/trim db-content)))))
@@ -232,7 +232,7 @@
               disk-content (or disk-content "")
               repo-dir (config/get-local-dir repo)
               db-content (or old-content (db/get-file repo rpath) "")
-              contents-matched? (contents-matched? disk-content db-content)]
+              contents-matched? (<contents-matched? disk-content db-content)]
         (->
          (p/let [result (<write-file-with-utf8 fpath content)
                  mtime (-> (js->clj stat :keywordize-keys true)

+ 2 - 2
src/main/frontend/fs/nfs.cljs

@@ -249,11 +249,11 @@
           (p/let [local-file (.getFile file-handle)
                   disk-content (.text local-file)
                   db-content (db/get-file repo path)
-                  contents-matched? (contents-matched? disk-content db-content)]
+                  contents-matched?' (contents-matched? disk-content db-content)]
             (if (and
                  (not (string/blank? db-content))
                  (not (:skip-compare? opts))
-                 (not contents-matched?)
+                 (not contents-matched?')
                  (not (contains? #{"excalidraw" "edn" "css"} ext))
                  (not (string/includes? path "/.recycle/")))
               (state/pub-event! [:file/not-matched-from-disk path disk-content content])

+ 2 - 2
src/main/frontend/fs/node.cljs

@@ -12,7 +12,7 @@
             [promesa.core :as p]
             [logseq.common.path :as path]))
 
-(defn- contents-matched?
+(defn- <contents-matched?
   [disk-content db-content]
   (when (and (string? disk-content) (string? db-content))
     (p/resolved (= (string/trim disk-content) (string/trim db-content)))))
@@ -38,7 +38,7 @@
                                             nil))))
               disk-content (or disk-content "")
               db-content (or old-content (db/get-file repo rpath) "")
-              contents-matched? (contents-matched? disk-content db-content)]
+              contents-matched? (<contents-matched? disk-content db-content)]
         (->
          (p/let [result (ipc/ipc "writeFile" repo file-fpath content)
                  mtime (gobj/get result "mtime")]

+ 24 - 24
src/main/frontend/fs/sync.cljs

@@ -542,11 +542,11 @@
    (partition-filetxns n)))
 
 (defn- filepath+checksum->diff
-  [index {:keys [relative-path checksum user-uuid graph-uuid]}]
+  [index {relative-path' :relative-path :keys [checksum user-uuid graph-uuid]}]
   {:post [(s/valid? ::diff %)]}
   {:TXId (inc index)
    :TXType "update_files"
-   :TXContent [[(util/string-join-path [user-uuid graph-uuid relative-path]) nil checksum]]})
+   :TXContent [[(util/string-join-path [user-uuid graph-uuid relative-path']) nil checksum]]})
 
 (defn filepath+checksum-coll->partitioned-filetxns
   "transducer.
@@ -1451,14 +1451,14 @@
          (= #{:value :expired-at} (set (keys v)))]}
   (swap! *get-graph-salt-memoize-cache conj [graph-uuid v]))
 
-(defn <get-graph-salt-memoize [remoteapi graph-uuid]
+(defn <get-graph-salt-memoize [remoteapi' graph-uuid]
   (go
     (let [r          (get @*get-graph-salt-memoize-cache graph-uuid)
           expired-at (:expired-at r)
           now        (tc/to-long (t/now))]
       (if (< now expired-at)
         r
-        (let [r (<! (<get-graph-salt remoteapi graph-uuid))]
+        (let [r (<! (<get-graph-salt remoteapi' graph-uuid))]
           (or (guard-ex r)
               (do (swap! *get-graph-salt-memoize-cache conj [graph-uuid r])
                   r)))))))
@@ -1469,11 +1469,11 @@
          (= #{:public-key :encrypted-private-key} (set (keys v)))]}
   (swap! *get-graph-encrypt-keys-memoize-cache conj [graph-uuid v]))
 
-(defn <get-graph-encrypt-keys-memoize [remoteapi graph-uuid]
+(defn <get-graph-encrypt-keys-memoize [remoteapi' graph-uuid]
   (go
     (or (get @*get-graph-encrypt-keys-memoize-cache graph-uuid)
         (let [{:keys [public-key encrypted-private-key] :as r}
-              (<! (<get-graph-encrypt-keys remoteapi graph-uuid))]
+              (<! (<get-graph-encrypt-keys remoteapi' graph-uuid))]
           (when (and public-key encrypted-private-key)
             (swap! *get-graph-encrypt-keys-memoize-cache conj [graph-uuid r]))
           r))))
@@ -1514,12 +1514,12 @@
   (go-loop []
     (if @*paused
       {:pause true}
-      (let [{:keys [timeout val]}
+      (let [{timeout' :timeout :keys [val]}
             (async/alt! ch ([v] {:val v})
                         (timeout 1000) {:timeout true})]
         (cond
           val val
-          timeout (recur))))))
+          timeout' (recur))))))
 
 
 
@@ -1943,14 +1943,14 @@
 
 (defn local-changes-revised-chan-builder
   "return chan"
-  [local-changes-chan rename-page-event-chan]
+  [local-changes-chan' rename-page-event-chan]
   (let [*rename-events (atom #{})
         ch (chan 1000)]
     (go-loop []
       (let [{:keys [rename-event local-change]}
             (async/alt!
              rename-page-event-chan ([v] {:rename-event v}) ;; {:repo X :old-path X :new-path}
-             local-changes-chan ([v] {:local-change v}))]
+             local-changes-chan' ([v] {:local-change v}))]
         (cond
           rename-event
           (let [repo-dir (config/get-repo-dir (:repo rename-event))
@@ -2197,13 +2197,13 @@
 (defn- <ensure-set-env&keys
   [graph-uuid *stopped?]
   (go-loop []
-    (let [{:keys [change timeout]}
+    (let [{timeout' :timeout :keys [change]}
           (async/alt! (get-graph-pwd-changed-chan graph-uuid) {:change true}
                       (timeout 10000) {:timeout true})]
       (cond
         @*stopped? nil
         change (<! (<set-env&keys config/FILE-SYNC-PROD? graph-uuid))
-        timeout (recur)))))
+        timeout' (recur)))))
 
 ;;; ### chans to control sync process
 (def full-sync-chan
@@ -2268,7 +2268,7 @@
   [graph-uuid]
   (swap! *resume-state dissoc graph-uuid))
 
-(defn sync-state
+(defn new-sync-state
   "create a new sync-state"
   []
   {:post [(s/valid? ::sync-state %)]}
@@ -2403,7 +2403,7 @@
   if local-txid != remote-txid, return {:need-sync-remote true}"))
 
 (defrecord ^:large-vars/cleanup-todo
- Remote->LocalSyncer [user-uuid graph-uuid base-path repo *txid *txid-for-get-deletion-log *sync-state remoteapi
+ Remote->LocalSyncer [user-uuid graph-uuid base-path repo *txid *txid-for-get-deletion-log *sync-state remoteapi'
                       ^:mutable local->remote-syncer *stopped *paused]
   Object
   (set-local->remote-syncer! [_ s] (set! local->remote-syncer s))
@@ -2442,7 +2442,7 @@
   (<sync-remote->local! [_]
     (go
       (let [r
-            (let [diff-r (<! (<get-diff remoteapi graph-uuid @*txid))]
+            (let [diff-r (<! (<get-diff remoteapi' graph-uuid @*txid))]
               (or (guard-ex diff-r)
                   (let [[diff-txns latest-txid min-txid] diff-r]
                     (if (> (dec min-txid) @*txid) ;; min-txid-1 > @*txid, need to remote->local-full-sync
@@ -2479,7 +2479,7 @@
 
   (<sync-remote->local-all-files! [this]
     (go
-      (let [remote-all-files-meta-c      (<get-remote-all-files-meta remoteapi graph-uuid)
+      (let [remote-all-files-meta-c      (<get-remote-all-files-meta remoteapi' graph-uuid)
             local-all-files-meta-c       (<get-local-all-files-meta rsapi graph-uuid base-path)
             remote-all-files-meta-or-exp (<! remote-all-files-meta-c)]
         (if (or (storage-exceed-limit? remote-all-files-meta-or-exp)
@@ -2500,7 +2500,7 @@
                 sorted-diff-remote-files
                 (sort-by
                  (sort-file-metadata-fn :recent-days-range recent-10-days-range) > diff-remote-files)
-                remote-txid-or-ex       (<! (<get-remote-txid remoteapi graph-uuid))
+                remote-txid-or-ex       (<! (<get-remote-txid remoteapi' graph-uuid))
                 latest-txid             (:TXId remote-txid-or-ex)]
             (if (or (instance? ExceptionInfo remote-txid-or-ex) (nil? latest-txid))
               (do (put-sync-event! {:event :get-remote-graph-failed
@@ -2641,7 +2641,7 @@
          local-files-meta-map))))
 
 (defrecord ^:large-vars/cleanup-todo
-  Local->RemoteSyncer [user-uuid graph-uuid base-path repo *sync-state remoteapi
+  Local->RemoteSyncer [user-uuid graph-uuid base-path repo *sync-state remoteapi'
                        ^:mutable rate *txid *txid-for-get-deletion-log
                        ^:mutable remote->local-syncer stop-chan *stopped *paused
                        ;; control chans
@@ -2739,7 +2739,7 @@
 
               (need-reset-local-txid? r*) ;; TODO: this cond shouldn't be true,
               ;; but some potential bugs cause local-txid > remote-txid
-              (let [remote-txid-or-ex (<! (<get-remote-txid remoteapi graph-uuid))
+              (let [remote-txid-or-ex (<! (<get-remote-txid remoteapi' graph-uuid))
                     remote-txid             (:TXId remote-txid-or-ex)]
                 (if (or (instance? ExceptionInfo remote-txid-or-ex) (nil? remote-txid))
                   (do (put-sync-event! {:event :get-remote-graph-failed
@@ -2778,9 +2778,9 @@
 
   (<sync-local->remote-all-files! [this]
     (go
-      (let [remote-all-files-meta-c      (<get-remote-all-files-meta remoteapi graph-uuid)
+      (let [remote-all-files-meta-c      (<get-remote-all-files-meta remoteapi' graph-uuid)
             local-all-files-meta-c       (<get-local-all-files-meta rsapi graph-uuid base-path)
-            deletion-logs-c              (<get-deletion-logs remoteapi graph-uuid @*txid-for-get-deletion-log)
+            deletion-logs-c              (<get-deletion-logs remoteapi' graph-uuid @*txid-for-get-deletion-log)
             remote-all-files-meta-or-exp (<! remote-all-files-meta-c)
             deletion-logs-or-exp         (<! deletion-logs-c)]
         (cond
@@ -2873,7 +2873,7 @@
 
 (defrecord ^:large-vars/cleanup-todo
     SyncManager [user-uuid graph-uuid base-path *sync-state
-              ^Local->RemoteSyncer local->remote-syncer ^Remote->LocalSyncer remote->local-syncer remoteapi
+              ^Local->RemoteSyncer local->remote-syncer ^Remote->LocalSyncer remote->local-syncer remoteapi'
               ^:mutable ratelimit-local-changes-chan
               *txid *txid-for-get-deletion-log
               ^:mutable state ^:mutable remote-change-chan ^:mutable *ws *stopped? *paused?
@@ -2949,7 +2949,7 @@
           remote->local
           (let [txid
                 (if (true? remote->local)
-                  (let [r (<! (<get-remote-txid remoteapi graph-uuid))]
+                  (let [r (<! (<get-remote-txid remoteapi' graph-uuid))]
                     (when-not (guard-ex r) {:txid (:TXId r)}))
                   remote->local)]
             (when (some? txid)
@@ -3399,7 +3399,7 @@
                    (<! (<connectivity-testing)))
         (reset! *sync-starting false)
         (try
-          (let [*sync-state                 (atom (sync-state))
+          (let [*sync-state                 (atom (new-sync-state))
                 current-user-uuid           (<! (user/<user-uuid))
               ;; put @graph-uuid & get-current-repo together,
               ;; prevent to get older repo dir and current graph-uuid.

+ 4 - 4
src/main/frontend/handler/export/text.cljs

@@ -66,10 +66,10 @@
                        "[X]" "[ ]")
                      ""))
         current-level (get *state* :current-level 1)
-        indent (when (> current-level 1)
+        indent' (when (> current-level 1)
                  (indent (dec current-level) 0))
         items* (block-list items :in-list? true)]
-    (concatv [indent number* checkbox* space]
+    (concatv [indent' number* checkbox* space]
              content*
              [(newline* 1)]
              items*
@@ -87,10 +87,10 @@
   [properties]
   (when-not (get-in *state* [:export-options :remove-properties?])
     (let [level (dec (get *state* :current-level 1))
-          indent (indent-with-2-spaces level)]
+          indent' (indent-with-2-spaces level)]
       (reduce
        (fn [r [k v]]
-         (conj r indent (raw-text k "::") space (raw-text v) (newline* 1)))
+         (conj r indent' (raw-text k "::") space (raw-text v) (newline* 1)))
        [] properties))))
 
 (defn- block-example

+ 3 - 4
src/main/frontend/handler/page.cljs

@@ -129,10 +129,9 @@
 (defn toggle-favorite! []
   ;; NOTE: in journals or settings, current-page is nil
   (when-let [page-name (state/get-current-page)]
-    (let [favorited? (favorited? page-name)]
-      (if favorited?
-        (<unfavorite-page! page-name)
-        (<favorite-page! page-name)))))
+    (if (favorited? page-name)
+      (<unfavorite-page! page-name)
+      (<favorite-page! page-name))))
 
 (defn rename!
   [page-uuid-or-old-name new-name & {:as _opts}]

+ 2 - 2
src/main/frontend/handler/plugin.cljs

@@ -391,10 +391,10 @@
 
 (defn- create-local-renderer-register
   [type *providers]
-  (fn [pid key {:keys [subs render] :as opts}]
+  (fn [pid key {subs' :subs :keys [render] :as opts}]
     (when-let [key (and key (keyword key))]
       (register-plugin-resources pid type
-        (merge opts {:key key :subs subs :render render}))
+        (merge opts {:key key :subs subs' :render render}))
       (swap! *providers conj pid)
       #(swap! *providers disj pid))))
 

+ 5 - 5
src/main/frontend/handler/user.cljs

@@ -203,13 +203,13 @@
   (state/pub-event! [:user/fetch-info-and-graphs]))
 
 (defn ^:export login-with-username-password-e2e
-  [username password client-id client-secret]
+  [username' password client-id client-secret]
   (let [text-encoder (new js/TextEncoder)
         key          (.encode text-encoder client-secret)
         hasher       (new crypt/Sha256)
         hmacer       (new crypt/Hmac hasher key)
-        secret-hash  (.encodeByteArray ^js crypt/base64 (.getHmac hmacer (str username client-id)))
-        payload      {"AuthParameters" {"USERNAME"    username,
+        secret-hash  (.encodeByteArray ^js crypt/base64 (.getHmac hmacer (str username' client-id)))
+        payload      {"AuthParameters" {"USERNAME"    username',
                                         "PASSWORD"    password,
                                         "SECRET_HASH" secret-hash}
                       "AuthFlow"       "USER_PASSWORD_AUTH",
@@ -235,9 +235,9 @@
 
 (defn upgrade []
   (let [base-upgrade-url "https://logseqdemo.lemonsqueezy.com/checkout/buy/13e194b5-c927-41a8-af58-ed1a36d6000d"
-        user-uuid (user-uuid)
+        user-uuid' (user-uuid)
         url (cond-> base-upgrade-url
-              user-uuid (str "?checkout[custom][user_uuid]=" (name user-uuid)))]
+              user-uuid' (str "?checkout[custom][user_uuid]=" (name user-uuid')))]
     (println " ~~~ LEMON: " url " ~~~ ")
     (js/window.open url)))
   ; (js/window.open

+ 2 - 2
src/main/frontend/handler/whiteboard.cljs

@@ -118,8 +118,8 @@
                          (remove string/blank?)
                          (set))
         new-orders (when (seq created-ids)
-                     (let [max-key (last (sort (map :block/order (:block/_page page-entity))))]
-                       (db-order/gen-n-keys (count created-ids) max-key nil)))
+                     (let [max-key' (last (sort (map :block/order (:block/_page page-entity))))]
+                       (db-order/gen-n-keys (count created-ids) max-key' nil)))
         new-id->order (when (seq created-ids) (zipmap created-ids new-orders))
         created-shapes (set (filter #(created-ids (:id %)) upsert-shapes))
         deleted-ids (->> (set/difference old-ids new-ids)

+ 2 - 2
src/main/frontend/mixins.cljs

@@ -58,13 +58,13 @@
         nil))))
 
 (defn on-enter
-  [state & {:keys [on-enter node]}]
+  [state & {on-enter-fn :on-enter :keys [node]}]
   (let [node (or node (rum/dom-node state))]
     (listen state node "keyup"
             (fn [e]
               (case (.-keyCode e)
                 ;; Enter
-                13 (on-enter e)
+                13 (on-enter-fn e)
                 nil)))))
 
 (defn on-key-up

+ 3 - 3
src/main/frontend/mobile/mobile_bar.cljs

@@ -91,7 +91,7 @@
              (or (state/sub :mobile/show-toolbar?)
                  (mobile-util/native-ipad?)))
     (let [parent-id (state/get-edit-input-id)
-          commands (commands parent-id)]
+          commands' (commands parent-id)]
       [:div#mobile-editor-toolbar.bg-base-2
        [:div.toolbar-commands
         (indent-outdent false "indent-decrease")
@@ -112,7 +112,7 @@
         (command history/undo! {:icon "rotate" :class "rotate-180"} true)
         (command history/redo! {:icon "rotate-clockwise" :class "rotate-180"} true)
         (timestamp-submenu parent-id)
-        (for [command commands]
-          command)]
+        (for [command' commands']
+          command')]
        [:div.toolbar-hide-keyboard
         (command #(state/clear-edit!) {:icon "keyboard-show"})]])))

+ 2 - 2
src/main/frontend/modules/instrumentation/sentry.cljs

@@ -60,8 +60,8 @@
 
 (defn init []
   (when (and (not config/dev?) (not-empty SENTRY-DSN))
-    (let [config (clj->js config)]
-      (Sentry/init config))))
+    (let [config' (clj->js config)]
+      (Sentry/init config'))))
 
 (defn set-user!
   [id]

+ 28 - 28
src/main/frontend/ui.cljs

@@ -240,7 +240,7 @@
      (let [links-children
            (let [links (if (fn? links) (links) links)
                  links (remove nil? links)]
-             (for [{:keys [options title icon key hr hover-detail item _as-link?]} links]
+             (for [{icon' :icon :keys [options title key hr hover-detail item _as-link?]} links]
                (let [new-options
                            (merge options
                                   (cond->
@@ -255,7 +255,7 @@
                              nil
                              (or item
                                  [:div.flex.items-center
-                                  (when icon icon)
+                                  (when icon' icon')
                                   [:div.title-wrap {:style {:margin-right "8px"
                                                             :margin-left  "4px"}} title]]))]
                  (if hr
@@ -587,7 +587,7 @@
     :on-click #(when close-backdrop? (close-fn))}
    [:div.absolute.inset-0.opacity-75]])
 
-(rum/defc modal-panel-content <
+(rum/defc modal-panel-content-cp <
   mixins/component-editing-mode
   [panel-content close-fn]
   (panel-content close-fn))
@@ -620,7 +620,7 @@
      [:div (cond-> {:class (if fullscreen? "" "panel-content")}
              (seq style)
              (assoc :style style))
-      (modal-panel-content panel-content close-fn)])])
+      (modal-panel-content-cp panel-content close-fn)])])
 
 (rum/defc modal < rum/reactive
   (mixins/event-mixin
@@ -670,15 +670,15 @@
 (rum/defc sub-modal < rum/reactive
   []
   (when-let [modals (seq (state/sub :modal/subsets))]
-    (for [[idx modal] (medley/indexed modals)]
-      (let [id (:modal/id modal)
-            modal-panel-content (:modal/panel-content modal)
-            close-btn? (:modal/close-btn? modal)
-            close-backdrop? (:modal/close-backdrop? modal)
-            show? (:modal/show? modal)
-            label (:modal/label modal)
-            style (:modal/style modal)
-            class (:modal/class modal)
+    (for [[idx modal'] (medley/indexed modals)]
+      (let [id (:modal/id modal')
+            modal-panel-content (:modal/panel-content modal')
+            close-btn? (:modal/close-btn? modal')
+            close-backdrop? (:modal/close-backdrop? modal')
+            show? (:modal/show? modal')
+            label (:modal/label modal')
+            style (:modal/style modal')
+            class (:modal/class modal')
             close-fn (fn []
                        (state/close-sub-modal! id))
             modal-panel-content (or modal-panel-content (fn [_close] [:div]))]
@@ -770,17 +770,17 @@
 (rum/defc admonition
   [type content]
   (let [type (name type)]
-    (when-let [icon (case (string/lower-case type)
-                      "note" svg/note
-                      "tip" svg/tip
-                      "important" svg/important
-                      "caution" svg/caution
-                      "warning" svg/warning
-                      "pinned" svg/pinned
-                      nil)]
+    (when-let [icon' (case (string/lower-case type)
+                       "note" svg/note
+                       "tip" svg/tip
+                       "important" svg/important
+                       "caution" svg/caution
+                       "warning" svg/warning
+                       "pinned" svg/pinned
+                       nil)]
       [:div.flex.flex-row.admonitionblock.align-items {:class type}
        [:div.pr-4.admonition-icon.flex.flex-col.justify-center
-        {:title (string/capitalize type)} (icon)]
+        {:title (string/capitalize type)} (icon')]
        [:div.ml-4.text-lg
         content]])))
 
@@ -933,7 +933,7 @@
 (rum/defcs slider < rum/reactive
   {:init (fn [state]
            (assoc state ::value (atom (first (:rum/args state)))))}
-  [state _default-value {:keys [min max on-change]}]
+  [state _default-value {max' :max :keys [min on-change]}]
   (let [*value (::value state)
         value (rum/react *value)
         value' (int value)]
@@ -942,7 +942,7 @@
      {:type      "range"
       :value     value'
       :min       min
-      :max       max
+      :max       max'
       :style     {:width "100%"}
       :on-change #(let [value (util/evalue %)]
                     (reset! *value value))
@@ -962,7 +962,7 @@
 (def icon shui.icon.v2/root)
 
 (rum/defc button-inner
-  [text & {:keys [theme background variant href size class intent small? icon icon-props disabled? button-props]
+  [text & {icon' :icon :keys [theme background variant href size class intent small? icon-props disabled? button-props]
            :or   {small? false}
            :as   opts}]
   (let [button-props (merge
@@ -977,20 +977,20 @@
                                  :else (or variant :default))
                       :href    href
                       :size    (if small? :xs (or size :sm))
-                      :icon    icon
+                      :icon    icon'
                       :class   (if (and (string? background)
                                      (not (contains? #{"gray" "red"} background)))
                                  (str class " primary-" background) class)
                       :muted   disabled?}
                 button-props)
 
-        icon (when icon (shui/tabler-icon icon icon-props))
+        icon'' (when icon' (shui/tabler-icon icon' icon-props))
         href? (not (string/blank? href))
         text (cond
                href? [:a {:href href :target "_blank"
                           :style {:color "inherit"}} text]
                :else text)
-        children [icon text]]
+        children [icon'' text]]
 
     (shui/button props children)))
 

+ 10 - 10
src/main/frontend/util.cljc

@@ -262,8 +262,8 @@
 
 ;; ".lg:absolute.lg:inset-y-0.lg:right-0.lg:w-1/2"
 (defn hiccup->class
-  [class]
-  (some->> (string/split class #"\.")
+  [class']
+  (some->> (string/split class' #"\.")
            (string/join " ")
            (string/trim)))
 
@@ -345,7 +345,7 @@
    (when-not node-test?
      (extend-type js/NodeList
        ISeqable
-       (-seq [array] (array-seq array 0)))))
+       (-seq [arr] (array-seq arr 0)))))
 
 ;; Caret
 #?(:cljs
@@ -545,9 +545,9 @@
    (defn bottom-reached?
      [node threshold]
      (let [full-height (gobj/get node "scrollHeight")
-           scroll-top (gobj/get node "scrollTop")
+           scroll-top' (gobj/get node "scrollTop")
            client-height (gobj/get node "clientHeight")]
-       (<= (- full-height scroll-top client-height) threshold))))
+       (<= (- full-height scroll-top' client-height) threshold))))
 
 #?(:cljs
    (defn link?
@@ -1256,7 +1256,7 @@
                                .-clientHeight)
 
              main-node   (app-scroll-container-node el)
-             scroll-top  (.-scrollTop main-node)
+             scroll-top'  (.-scrollTop main-node)
 
              current-pos (get-selection-start el)
              grapheme-pos (get-graphemes-pos (.-value (.textContent el)) current-pos)
@@ -1274,7 +1274,7 @@
              scroll      (- cursor-y (- vw-height (+ @keyboard-height (+ 40 4))))]
          (cond
            (and to-vw-one-quarter? (> cursor-y (* vw-height 0.4)))
-           (set! (.-scrollTop main-node) (+ scroll-top (- cursor-y (/ vw-height 4))))
+           (set! (.-scrollTop main-node) (+ scroll-top' (- cursor-y (/ vw-height 4))))
 
            (and (< cursor-y (+ header-height offset-height 4)) ;; 4 is top+bottom padding for per line
                 (>= cursor-y header-height))
@@ -1283,11 +1283,11 @@
            (< cursor-y header-height)
            (let [_ (.scrollIntoView el true)
                  main-node (app-scroll-container-node el)
-                 scroll-top (.-scrollTop main-node)]
-             (set! (.-scrollTop main-node) (- scroll-top (/ vw-height 4))))
+                 scroll-top' (.-scrollTop main-node)]
+             (set! (.-scrollTop main-node) (- scroll-top' (/ vw-height 4))))
 
            (> scroll 0)
-           (set! (.-scrollTop main-node) (+ scroll-top scroll))
+           (set! (.-scrollTop main-node) (+ scroll-top' scroll))
 
            :else
            nil)))))

+ 2 - 2
src/main/frontend/util/clock.cljs

@@ -93,7 +93,7 @@
       content)))
 
 (defn clock-summary
-  [body string?]
+  [body string?']
   (when-let [logbook (drawer/get-logbook body)]
     (when-let [logbook-lines (last logbook)]
       (when-let [clock-lines (seq (filter #(string/starts-with? % "CLOCK:") logbook-lines))]
@@ -105,7 +105,7 @@
                                  :seconds seconds)
               duration-in-minutes (t/in-minutes duration)
               zero-minutes? (zero? duration-in-minutes)]
-          (if string?
+          (if string?'
             (if zero-minutes?
               (str seconds "s")
               (-> (tf/unparse-duration duration)

+ 30 - 30
src/main/frontend/util/cursor.cljs

@@ -65,34 +65,34 @@
 
 (defn move-cursor-to
   ([input n] (move-cursor-to input n false))
-  ([input n delay?]
+  ([input n delay?']
    (.setSelectionRange input n n)
    (when-not (= js/document.activeElement input)
      (let [focus #(.focus input)]
-       (if delay? (js/setTimeout focus 16) (focus))))))
+       (if delay?' (js/setTimeout focus 16) (focus))))))
 
 (defn move-cursor-forward
   ([input]
    (move-cursor-forward input 1))
   ([input n]
    (when input
-     (let [{:keys [pos]} (get-caret-pos input)
-           pos (if (= n 1)
-                 (or (util/safe-inc-current-pos-from-start (.-value input) pos)
-                     (inc pos))
-                 (+ pos n))]
-       (move-cursor-to input pos)))))
+     (let [{pos' :pos} (get-caret-pos input)
+           pos'' (if (= n 1)
+                   (or (util/safe-inc-current-pos-from-start (.-value input) pos')
+                       (inc pos'))
+                   (+ pos' n))]
+       (move-cursor-to input pos'')))))
 
 (defn move-cursor-backward
   ([input]
    (move-cursor-backward input 1))
   ([input n]
    (when input
-     (let [{:keys [pos]} (get-caret-pos input)
-           pos (if (= n 1)
-                 (util/safe-dec-current-pos-from-end (.-value input) pos)
-                 (- pos n))]
-       (move-cursor-to input pos)))))
+     (let [{pos' :pos} (get-caret-pos input)
+           pos'' (if (= n 1)
+                   (util/safe-dec-current-pos-from-end (.-value input) pos')
+                   (- pos' n))]
+       (move-cursor-to input pos'')))))
 
 (defn- get-input-content&pos
   [input]
@@ -101,24 +101,24 @@
 
 (defn line-beginning-pos
   [input]
-  (let [[content pos] (get-input-content&pos input)]
-    (if (zero? pos) 0
-        (let [last-newline-pos (string/last-index-of content \newline (dec pos))]
+  (let [[content pos'] (get-input-content&pos input)]
+    (if (zero? pos') 0
+        (let [last-newline-pos (string/last-index-of content \newline (dec pos'))]
           (if (= nil last-newline-pos) 0 ;; no newline found (first line)
               (inc last-newline-pos))))))
 
 (defn line-end-pos
   [input]
-  (let [[content pos] (get-input-content&pos input)]
-    (or (string/index-of content \newline pos)
+  (let [[content pos'] (get-input-content&pos input)]
+    (or (string/index-of content \newline pos')
         (count content))))
 
 (defn beginning-of-line?
   [input]
-  (let [[content pos] (get-input-content&pos input)]
+  (let [[content pos'] (get-input-content&pos input)]
     (when content
-      (or (zero? pos)
-         (when-let [pre-char (subs content (dec pos) pos)]
+      (or (zero? pos')
+         (when-let [pre-char (subs content (dec pos') pos')]
            (= pre-char \newline))))))
 
 (defn move-cursor-to-line-end
@@ -131,16 +131,16 @@
 
 (defn move-cursor-to-end
   [input]
-  (let [pos (count (gobj/get input "value"))]
-    (move-cursor-to input pos)))
+  (let [pos' (count (gobj/get input "value"))]
+    (move-cursor-to input pos')))
 
 (defn move-cursor-to-thing
   ([input thing]
    (move-cursor-to-thing input thing (pos input)))
   ([input thing from]
    (let [[content _pos] (get-input-content&pos input)
-         pos (string/index-of content thing from)]
-     (move-cursor-to input pos))))
+         pos' (string/index-of content thing from)]
+     (move-cursor-to input pos'))))
 
 (defn move-cursor-forward-by-word
   [input]
@@ -208,26 +208,26 @@
   (let [elms  (-> (gdom/getElement "mock-text")
                   gdom/getChildren
                   array-seq)
-        chars (->> elms
+        chars' (->> elms
                    (map mock-char-pos)
                    (group-by :top))
-        tops  (sort (keys chars))
+        tops  (sort (keys chars'))
         tops-p (partition-by #(== (:top cursor) %) tops)
         line-next
         (if (= :up direction)
           (-> tops-p first last)
           (-> tops-p last first))
         lefts
-        (->> (get chars line-next)
+        (->> (get chars' line-next)
              (partition-by (fn [char-pos]
                              (<= (:left char-pos) (:left cursor)))))
         left-a (-> lefts first last)
         left-c (-> lefts last first)
-        closer
+        closer'
         (if (> 2 (count lefts))
           left-a
           (closer left-a cursor left-c))]
-    (:pos closer)))
+    (:pos closer')))
 
 (defn- move-cursor-up-down
   [input direction]

+ 2 - 2
src/main/frontend/worker/db/migrate.cljs

@@ -276,8 +276,8 @@
                              (#(sqlite-create-graph/build-initial-classes* % {}))
                              (map (fn [b] (assoc b :logseq.property/built-in? true))))
             fixes (mapcat
-                   (fn [update]
-                     (when-let [fix (:fix update)]
+                   (fn [update']
+                     (when-let [fix (:fix update')]
                        (when (fn? fix)
                          (fix conn search-db)))) updates)
             tx-data' (if db-based? (concat new-properties new-classes fixes) fixes)]

+ 3 - 3
src/main/frontend/worker/db_worker.cljs

@@ -282,10 +282,10 @@
 
         (db-listener/listen-db-changes! repo conn)))))
 
-(defn- iter->vec [iter]
-  (when iter
+(defn- iter->vec [iter']
+  (when iter'
     (p/loop [acc []]
-      (p/let [elem (.next iter)]
+      (p/let [elem (.next iter')]
         (if (.-done elem)
           acc
           (p/recur (conj acc (.-value elem))))))))

+ 3 - 3
src/main/frontend/worker/rtc/core.cljs

@@ -313,10 +313,10 @@
 (def ^:private create-get-state-flow
   (let [rtc-loop-metadata-flow (m/watch *rtc-loop-metadata)]
     (m/ap
-      (let [{:keys [repo graph-uuid user-uuid rtc-state-flow *rtc-auto-push? *rtc-lock *online-users]}
+      (let [{rtc-lock :*rtc-lock :keys [repo graph-uuid user-uuid rtc-state-flow *rtc-auto-push? *online-users]}
             (m/?< rtc-loop-metadata-flow)]
         (try
-          (when (and repo rtc-state-flow *rtc-auto-push? *rtc-lock)
+          (when (and repo rtc-state-flow *rtc-auto-push? rtc-lock)
             (m/?<
              (m/latest
               (fn [rtc-state rtc-auto-push? rtc-lock online-users pending-local-ops-count local-tx remote-tx]
@@ -329,7 +329,7 @@
                  :rtc-lock rtc-lock
                  :auto-push? rtc-auto-push?
                  :online-users online-users})
-              rtc-state-flow (m/watch *rtc-auto-push?) (m/watch *rtc-lock) (m/watch *online-users)
+              rtc-state-flow (m/watch *rtc-auto-push?) (m/watch rtc-lock) (m/watch *online-users)
               (client-op/create-pending-ops-count-flow repo)
               (rtc-log-and-state/create-local-t-flow graph-uuid)
               (rtc-log-and-state/create-remote-t-flow graph-uuid))))

+ 2 - 2
src/main/frontend/worker/search.cljs

@@ -167,8 +167,8 @@ DROP TRIGGER IF EXISTS blocks_au;
   (when (and (string? q) (string? match))
     (boolean
      (reduce
-      (fn [coll char]
-        (let [coll' (drop-while #(not= char %) coll)]
+      (fn [coll char']
+        (let [coll' (drop-while #(not= char' %) coll)]
           (if (seq coll')
             (rest coll')
             (reduced false))))

+ 2 - 2
src/main/logseq/api.cljs

@@ -1174,8 +1174,8 @@
 
 ;; search
 (defn ^:export search
-  [q]
-  (-> (search-handler/search q)
+  [q']
+  (-> (search-handler/search q')
       (p/then #(bean/->js %))))
 
 ;; helpers

+ 8 - 8
src/test/frontend/modules/outliner/core_test.cljs

@@ -436,8 +436,8 @@
 
 (deftest test-batch-transact
   (testing "add 4, 5 after 2 and delete 3"
-    (let [tree [[10 [[2] [3]]]]]
-      (transact-tree! tree)
+    (let [tree' [[10 [[2] [3]]]]]
+      (transact-tree! tree')
       (let [new-blocks (build-blocks [[4 [5]]])
             target-block (get-block 2)]
         (outliner-tx/transact!
@@ -585,9 +585,9 @@ tags:: tag1, tag2
 
 (defn gen-blocks
   []
-  (let [tree (gen-safe-tree)]
-    (if (seq tree)
-      (let [result (build-blocks tree)]
+  (let [tree' (gen-safe-tree)]
+    (if (seq tree')
+      (let [result (build-blocks tree')]
         (if (seq result)
           result
           (gen-blocks)))
@@ -606,9 +606,9 @@ tags:: tag1, tag2
 
 (defn transact-random-tree!
   []
-  (let [tree (gen-safe-tree)]
-    (if (seq tree)
-      (transact-tree! tree)
+  (let [tree' (gen-safe-tree)]
+    (if (seq tree')
+      (transact-tree! tree')
       (transact-random-tree!))))
 
 (defn get-datoms

+ 5 - 5
src/test/frontend/test/helper.cljs

@@ -29,16 +29,16 @@
 (defn start-test-db!
   [& {:as opts}]
   (let [db-graph? (or (:db-graph? opts) (and node? (some? js/process.env.DB_GRAPH)))
-        test-db (if db-graph? test-db-name-db-version test-db-name)]
-    (state/set-current-repo! test-db)
-    (conn/start! test-db opts)
-    (let [conn (conn/get-db test-db false)]
+        test-db' (if db-graph? test-db-name-db-version test-db-name)]
+    (state/set-current-repo! test-db')
+    (conn/start! test-db' opts)
+    (let [conn (conn/get-db test-db' false)]
       (when db-graph?
         (db-pipeline/add-listener conn)
         (d/transact! conn (sqlite-create-graph/build-db-initial-data "")))
       (d/listen! conn ::listen-db-changes!
                  (fn [tx-report]
-                   (worker-pipeline/invoke-hooks test-db conn tx-report {}))))))
+                   (worker-pipeline/invoke-hooks test-db' conn tx-report {}))))))
 
 (defn destroy-test-db!
   []

+ 11 - 11
src/test/frontend/worker/undo_redo_test.cljs

@@ -141,10 +141,10 @@
     nil))
 
 (defn- undo-all
-  [conn page-uuid]
+  [conn page-uuid']
   (binding [undo-redo/*undo-redo-info-for-test* (atom nil)]
     (loop [i 0]
-      (let [r (undo-redo/undo test-helper/test-db-name-db-version page-uuid conn)
+      (let [r (undo-redo/undo test-helper/test-db-name-db-version page-uuid' conn)
             current-db @conn]
         (check-block-count @undo-redo/*undo-redo-info-for-test* current-db)
         (if (not= :frontend.worker.undo-redo/empty-undo-stack r)
@@ -152,10 +152,10 @@
           (prn :undo-count i))))))
 
 (defn- redo-all
-  [conn page-uuid]
+  [conn page-uuid']
   (binding [undo-redo/*undo-redo-info-for-test* (atom nil)]
     (loop [i 0]
-      (let [r (undo-redo/redo test-helper/test-db-name-db-version page-uuid conn)
+      (let [r (undo-redo/redo test-helper/test-db-name-db-version page-uuid' conn)
             current-db @conn]
         (check-block-count @undo-redo/*undo-redo-info-for-test* current-db)
         (if (not= :frontend.worker.undo-redo/empty-redo-stack r)
@@ -203,19 +203,19 @@
         (is (= origin-graph-block-set (get-db-block-set @conn)))))))
 
 (defn- print-page-stat
-  [db page-uuid]
-  (let [page (d/entity db [:block/uuid page-uuid])
+  [db page-uuid']
+  (let [page (d/entity db [:block/uuid page-uuid'])
         blocks (ldb/get-page-blocks db (:db/id page))]
     (pp/pprint
      {:block-count (count blocks)
       :undo-op-count (count (get-in @(:undo/repo->page-block-uuid->undo-ops @worker-state/*state)
-                                    [test-helper/test-db-name-db-version page-uuid]))
+                                    [test-helper/test-db-name-db-version page-uuid']))
       :redo-op-count (count (get-in @(:undo/repo->page-block-uuid->redo-ops @worker-state/*state)
-                                    [test-helper/test-db-name-db-version page-uuid]))})))
+                                    [test-helper/test-db-name-db-version page-uuid']))})))
 
 (defn- print-page-blocks-tree
-  [db page-uuid]
-  (let [page (d/entity db [:block/uuid page-uuid])
+  [db page-uuid']
+  (let [page (d/entity db [:block/uuid page-uuid'])
         blocks (ldb/get-page-blocks db (:db/id page))]
     (prn ::page-block-tree)
     (pp/pprint
@@ -227,7 +227,7 @@
             (assoc :block/children (:block/children x)))
           x))
       (otree/blocks->vec-tree test-helper/test-db-name-db-version db
-                              blocks page-uuid)))))
+                              blocks page-uuid')))))
 
 (deftest ^:long ^:wip undo-redo-outliner-op-gen-test
   (try