Browse Source

fix: stop shadowing vars in deps and turn on related lint

Follow up to last commit. Added some exceptions for cljs.core
to minimize change for now
Gabriel Horner 1 năm trước cách đây
mục cha
commit
f2b38b5963
29 tập tin đã thay đổi với 126 bổ sung118 xóa
  1. 1 0
      deps/common/.clj-kondo/config.edn
  2. 10 10
      deps/common/src/logseq/common/util/date_time.cljs
  3. 5 5
      deps/common/src/logseq/common/util/macro.cljs
  4. 2 2
      deps/common/src/logseq/common/uuid.cljs
  5. 3 0
      deps/db/.clj-kondo/config.edn
  6. 19 19
      deps/db/src/logseq/db.cljs
  7. 2 2
      deps/db/src/logseq/db/frontend/inputs.cljs
  8. 2 2
      deps/db/src/logseq/db/frontend/property/build.cljs
  9. 3 3
      deps/db/src/logseq/db/frontend/rules.cljc
  10. 2 2
      deps/db/src/logseq/db/sqlite/common_db.cljs
  11. 3 3
      deps/db/src/logseq/db/sqlite/create_graph.cljs
  12. 2 2
      deps/db/src/logseq/db/sqlite/util.cljs
  13. 3 0
      deps/graph-parser/.clj-kondo/config.edn
  14. 2 2
      deps/graph-parser/src/logseq/graph_parser.cljs
  15. 10 10
      deps/graph-parser/src/logseq/graph_parser/block.cljs
  16. 5 5
      deps/graph-parser/src/logseq/graph_parser/db.cljs
  17. 4 4
      deps/graph-parser/src/logseq/graph_parser/exporter.cljs
  18. 1 0
      deps/outliner/.clj-kondo/config.edn
  19. 12 12
      deps/outliner/src/logseq/outliner/core.cljs
  20. 2 2
      deps/outliner/src/logseq/outliner/pipeline.cljs
  21. 2 2
      deps/outliner/src/logseq/outliner/property.cljs
  22. 1 0
      deps/publishing/.clj-kondo/config.edn
  23. 8 8
      deps/publishing/src/logseq/publishing/db.cljs
  24. 4 4
      deps/publishing/src/logseq/publishing/html.cljs
  25. 2 2
      deps/publishing/test/logseq/publishing/test/helper.clj
  26. 8 8
      src/electron/electron/core.cljs
  27. 1 2
      src/main/frontend/common/file/core.cljs
  28. 3 3
      src/main/frontend/common/missionary_util.cljs
  29. 4 4
      src/main/frontend/common/search_fuzzy.cljs

+ 1 - 0
deps/common/.clj-kondo/config.edn

@@ -2,6 +2,7 @@
  {:aliased-namespace-symbol {:level :warning}
   :namespace-name-mismatch {:level :warning}
   :used-underscored-binding {:level :warning}
+  :shadowed-var {:level :warning}
 
   :consistent-alias
   {:aliases {clojure.string string}}}

+ 10 - 10
deps/common/src/logseq/common/util/date_time.cljs

@@ -14,16 +14,16 @@
 (defn journal-title->
   [journal-title then-fn formatters]
   (when-not (string/blank? journal-title)
-    (when-let [time (->> (map
-                          (fn [formatter]
-                            (try
-                              (tf/parse (tf/formatter formatter) (common-util/capitalize-all journal-title))
-                              (catch :default _e
-                                nil)))
-                          formatters)
-                         (filter some?)
-                         first)]
-      (then-fn time))))
+    (when-let [time' (->> (map
+                           (fn [formatter]
+                             (try
+                               (tf/parse (tf/formatter formatter) (common-util/capitalize-all journal-title))
+                               (catch :default _e
+                                 nil)))
+                           formatters)
+                          (filter some?)
+                          first)]
+      (then-fn time'))))
 
 (defn journal-title->int
   [journal-title formatters]

+ 5 - 5
deps/common/src/logseq/common/util/macro.cljs

@@ -25,13 +25,13 @@
 (defn- macro-expand-value
   "Checks a string for a macro and expands it if there's a macro entry for it.
    This is a slimmer version of macro-else-cp"
-  [val macros]
-  (if-let [[_ macro args] (and (string? val)
-                               (seq (re-matches #"\{\{(\S+)\s+(.*)\}\}" val)))]
+  [value macros]
+  (if-let [[_ macro args] (and (string? value)
+                               (seq (re-matches #"\{\{(\S+)\s+(.*)\}\}" value)))]
     (if-let [content (get macros macro)]
       (macro-subs content (string/split args #"\s+"))
-      val)
-    val))
+      value)
+    value))
 
 (defn expand-value-if-macro
   [s macros]

+ 2 - 2
deps/common/src/logseq/common/uuid.cljs

@@ -35,7 +35,7 @@ the remaining chars for data of this type"
   - :journal-page-uuid
   - :db-ident-block-uuid"
   ([] (d/squuid))
-  ([type v]
-   (case type
+  ([type' v]
+   (case type'
      :journal-page-uuid (gen-journal-page-uuid v)
      :db-ident-block-uuid (gen-db-ident-block-uuid v))))

+ 3 - 0
deps/db/.clj-kondo/config.edn

@@ -2,6 +2,9 @@
  {:aliased-namespace-symbol {:level :warning}
   :namespace-name-mismatch {:level :warning}
   :used-underscored-binding {:level :warning}
+  :shadowed-var {:level :warning
+                 ;; FIXME: Remove these as shadowing core fns isn't a good practice
+                 :exclude [val key]}
 
   :consistent-alias
   {:aliases {clojure.string string

+ 19 - 19
deps/db/src/logseq/db.cljs

@@ -189,11 +189,11 @@
 
 (defn page-exists?
   "Whether a page exists with the `type`."
-  [db page-name type]
+  [db page-name type']
   (when page-name
     (if (db-based-graph? db)
       ;; Classes and properties are case sensitive
-      (if (#{"class" "property"} type)
+      (if (#{"class" "property"} type')
         (seq
          (d/q
           '[:find [?p ...]
@@ -203,7 +203,7 @@
             [?p :block/type ?type]]
           db
           page-name
-          type))
+          type'))
         ;; TODO: Decouple db graphs from file specific :block/name
         (seq
          (d/q
@@ -214,7 +214,7 @@
             [?p :block/type ?type]]
           db
           (common-util/page-name-sanity-lc page-name)
-          type)))
+          type')))
       (d/entity db [:block/name (common-util/page-name-sanity-lc page-name)]))))
 
 (defn get-page
@@ -260,7 +260,7 @@
                         (map
                          (fn [page]
                            (when-let [page (get-page db page)]
-                             (let [name (:block/name page)]
+                             (let [name' (:block/name page)]
                                (and
                                 (empty-ref-f page)
                                 (or
@@ -271,12 +271,12 @@
                                     first-child
                                     (= 1 (count children))
                                     (contains? #{"" "-" "*"} (string/trim (:block/title first-child))))))
-                                (not (contains? built-in-pages name))
+                                (not (contains? built-in-pages name'))
                                 (not (whiteboard? page))
                                 (not (:block/_namespace page))
                                 (not (property? page))
                                  ;; a/b/c might be deleted but a/b/c/d still exists (for backward compatibility)
-                                (not (and (string/includes? name "/")
+                                (not (and (string/includes? name' "/")
                                           (not (journal? page))))
                                 (not (:block/properties page))
                                 page))))
@@ -323,13 +323,13 @@
 (defn get-block-parents
   [db block-id {:keys [depth] :or {depth 100}}]
   (loop [block-id block-id
-         parents (list)
+         parents' (list)
          d 1]
     (if (> d depth)
-      parents
+      parents'
       (if-let [parent (:block/parent (d/entity db [:block/uuid block-id]))]
-        (recur (:block/uuid parent) (conj parents parent) (inc d))
-        parents))))
+        (recur (:block/uuid parent) (conj parents' parent) (inc d))
+        parents'))))
 
 (def get-block-children-ids sqlite-common-db/get-block-children-ids)
 (def get-block-children sqlite-common-db/get-block-children)
@@ -533,9 +533,9 @@
 ;; File based fns
 (defn get-namespace-pages
   "Accepts both sanitized and unsanitized namespaces"
-  [db namespace {:keys [db-graph?]}]
-  (assert (string? namespace))
-  (let [namespace (common-util/page-name-sanity-lc namespace)
+  [db namespace' {:keys [db-graph?]}]
+  (assert (string? namespace'))
+  (let [namespace'' (common-util/page-name-sanity-lc namespace')
         pull-attrs  (cond-> [:db/id :block/name :block/title :block/namespace]
                       (not db-graph?)
                       (conj {:block/file [:db/id :file/path]}))]
@@ -547,16 +547,16 @@
       (list 'namespace '?p '?c)]
      db
      (:namespace rules/rules)
-     namespace)))
+     namespace'')))
 
 (defn get-pages-by-name-partition
-  [db partition]
-  (when-not (string/blank? partition)
-    (let [partition (common-util/page-name-sanity-lc (string/trim partition))
+  [db partition']
+  (when-not (string/blank? partition')
+    (let [partition'' (common-util/page-name-sanity-lc (string/trim partition'))
           ids (->> (d/datoms db :aevt :block/name)
                    (filter (fn [datom]
                              (let [page (:v datom)]
-                               (string/includes? page partition))))
+                               (string/includes? page partition''))))
                    (map :e))]
       (when (seq ids)
         (d/pull-many db

+ 2 - 2
deps/db/src/logseq/db/frontend/inputs.cljs

@@ -17,10 +17,10 @@ it will return 1622433600000, which is equivalent to Mon May 31 2021 00 :00:00."
    (.setHours (js/Date. date) hours mins secs millisecs)))
 
 (defn- old->new-relative-date-format [input]
-  (let [count (re-find #"^\d+" (name input))
+  (let [count' (re-find #"^\d+" (name input))
         plus-minus (if (re-find #"after" (name input)) "+" "-")
         ms? (string/ends-with? (name input) "-ms")]
-    (keyword :today (str plus-minus count "d" (if ms? "-ms" "")))))
+    (keyword :today (str plus-minus count' "d" (if ms? "-ms" "")))))
 
 (comment
   (old->new-relative-date-format "1d")

+ 2 - 2
deps/db/src/logseq/db/frontend/property/build.cljs

@@ -43,10 +43,10 @@
                                                                                      :ref-type? true})
                            property-attributes)]
     (into [property-tx]
-          (map (fn [{:keys [db-ident value icon uuid]}]
+          (map (fn [{uuid' :uuid :keys [db-ident value icon]}]
                  (cond->
                   (build-closed-value-block
-                   uuid
+                   uuid'
                    value
                    property
                    {:db-ident db-ident :icon icon})

+ 3 - 3
deps/db/src/logseq/db/frontend/rules.cljc

@@ -234,10 +234,10 @@
    * :deps - A map of rule names to their dependencies. Only one-level of dependencies are resolved.
    No dependencies are detected by default though we could add it later e.g. find-rules-in-where"
   ([rules-m] (extract-rules rules-m (keys rules-m)))
-  ([rules-m rules & {:keys [deps]}]
-   (let [rules-with-deps (concat rules
+  ([rules-m rules' & {:keys [deps]}]
+   (let [rules-with-deps (concat rules'
                                  (when (map? deps)
-                                   (mapcat deps rules)))]
+                                   (mapcat deps rules')))]
      (vec
       (mapcat #(let [val (rules-m %)]
                  ;; if vector?, rule has multiple clauses

+ 2 - 2
deps/db/src/logseq/db/sqlite/common_db.cljs

@@ -213,8 +213,8 @@
 
 (defn get-structured-datoms
   [db]
-  (mapcat (fn [type]
-            (->> (d/datoms db :avet :block/type type)
+  (mapcat (fn [type']
+            (->> (d/datoms db :avet :block/type type')
                  (mapcat (fn [d]
                            (d/datoms db :eavt (:e d))))))
           [

+ 3 - 3
deps/db/src/logseq/db/sqlite/create_graph.cljs

@@ -61,9 +61,9 @@
 (defn kv
   "Creates a key-value pair tx with the key and value respectively stored under
   :db/ident and :kv/value.  The key must be under the namespace :logseq.kv"
-  [key value]
-  {:pre [(= "logseq.kv" (namespace key))]}
-  {:db/ident key
+  [k value]
+  {:pre [(= "logseq.kv" (namespace k))]}
+  {:db/ident k
    :kv/value value})
 
 (def built-in-pages-names

+ 2 - 2
deps/db/src/logseq/db/sqlite/util.cljs

@@ -24,8 +24,8 @@
   (transit/write transit-w data))
 
 (defn transit-read
-  [str]
-  (transit/read transit-r str))
+  [s]
+  (transit/read transit-r s))
 
 (def write-transit-str
   (let [write-handlers (->> (assoc dt/write-handlers

+ 3 - 0
deps/graph-parser/.clj-kondo/config.edn

@@ -2,6 +2,9 @@
  {:aliased-namespace-symbol {:level :warning}
   :namespace-name-mismatch {:level :warning}
   :used-underscored-binding {:level :warning}
+  :shadowed-var {:level :warning
+                 ;; FIXME: Remove these as shadowing core fns isn't a good practice
+                 :exclude [val format key name alias type parents exists?]}
 
   :consistent-alias
   {:aliases {clojure.string string

+ 2 - 2
deps/graph-parser/src/logseq/graph_parser.cljs

@@ -12,8 +12,8 @@
 
 (defn- retract-blocks-tx
   [blocks retain-uuids]
-  (mapcat (fn [{uuid :block/uuid eid :db/id}]
-            (if (and uuid (contains? retain-uuids uuid))
+  (mapcat (fn [{uuid' :block/uuid eid :db/id}]
+            (if (and uuid' (contains? retain-uuids uuid'))
               (map (fn [attr] [:db.fn/retractAttribute eid attr]) db-schema/retract-attributes)
               (when eid [[:db.fn/retractEntity eid]])))
           blocks))

+ 10 - 10
deps/graph-parser/src/logseq/graph_parser/block.cljs

@@ -341,9 +341,9 @@
                                                                new-uuid*))]
                                                {:block/uuid new-uuid}))
                                            (when namespace?
-                                             (let [namespace (first (common-util/split-last "/" original-page-name))]
-                                               (when-not (string/blank? namespace)
-                                                 {:block/namespace {:block/name (common-util/page-name-sanity-lc namespace)}})))
+                                             (let [namespace' (first (common-util/split-last "/" original-page-name))]
+                                               (when-not (string/blank? namespace')
+                                                 {:block/namespace {:block/name (common-util/page-name-sanity-lc namespace')}})))
                                            (when (and with-timestamp? (or skip-existing-page-check? (not page-entity))) ;; Only assign timestamp on creating new entity
                                              (let [current-ms (common-util/time-ms)]
                                                {:block/created-at current-ms
@@ -463,13 +463,13 @@
        blocks))
 
 (defn get-block-content
-  [utf8-content block format meta block-pattern]
-  (let [content (if-let [end-pos (:end_pos meta)]
+  [utf8-content block format meta' block-pattern]
+  (let [content (if-let [end-pos (:end_pos meta')]
                   (utf8/substring utf8-content
-                                  (:start_pos meta)
+                                  (:start_pos meta')
                                   end-pos)
                   (utf8/substring utf8-content
-                                  (:start_pos meta)))
+                                  (:start_pos meta')))
         content (when content
                   (let [content (text/remove-level-spaces content format block-pattern)]
                     (if (or (:pre-block? block)
@@ -599,7 +599,7 @@
                 (-> (assoc block :collapsed? true)
                     (update :properties (fn [m] (dissoc m :collapsed)))
                     (update :properties-text-values dissoc :collapsed)
-                    (update :properties-order (fn [keys] (vec (remove #{:collapsed} keys)))))
+                    (update :properties-order (fn [keys'] (vec (remove #{:collapsed} keys')))))
                 block)
         title (cond->> (get-block-content encoded-content block format pos-meta block-pattern)
                 remove-properties?
@@ -742,7 +742,7 @@
                    (map #(dissoc % :block/level-spaces) result)
                    (let [[block & others] blocks
                          level-spaces (:block/level-spaces block)
-                         {:block/keys [uuid level parent] :as last-parent} (last parents)
+                         {uuid' :block/uuid :block/keys [level parent] :as last-parent} (last parents)
                          parent-spaces (:block/level-spaces last-parent)
                          [blocks parents result]
                          (cond
@@ -755,7 +755,7 @@
                              [others parents' result'])
 
                            (> level-spaces parent-spaces)         ; child
-                           (let [parent (if uuid [:block/uuid uuid] (:page/id last-parent))
+                           (let [parent (if uuid' [:block/uuid uuid'] (:page/id last-parent))
                                  block (cond->
                                         (assoc block
                                                :block/parent parent)

+ 5 - 5
deps/graph-parser/src/logseq/graph_parser/db.cljs

@@ -31,12 +31,12 @@
 
 (defn- build-pages-tx
   [pages]
-  (let [time (common-util/time-ms)]
+  (let [time' (common-util/time-ms)]
     (map
      (fn [m]
        (-> m
-           (assoc :block/created-at time)
-           (assoc :block/updated-at time)))
+           (assoc :block/created-at time')
+           (assoc :block/updated-at time')))
      pages)))
 
 (defn create-default-pages!
@@ -44,8 +44,8 @@
    fn is idempotent"
   [db-conn]
   (when-not (ldb/get-page @db-conn "card")
-    (let [built-in-pages (build-pages-tx built-in-pages)]
-      (ldb/transact! db-conn built-in-pages))))
+    (let [built-in-pages' (build-pages-tx built-in-pages)]
+      (ldb/transact! db-conn built-in-pages'))))
 
 (defn start-conn
   "Create datascript conn with schema and default data"

+ 4 - 4
deps/graph-parser/src/logseq/graph_parser/exporter.cljs

@@ -210,7 +210,7 @@
 (defn- text-with-refs?
   "Detects if a property value has text with refs e.g. `#Logseq is #awesome`
   instead of `#Logseq #awesome`. If so the property type is :default instead of :page"
-  [vals val-text]
+  [prop-vals val-text]
   (let [replace-regex (re-pattern
                        ;; Regex removes all characters of a tag or page-ref
                        ;; so that only ref chars are left
@@ -219,7 +219,7 @@
                             ;; Sorts ref names in descending order so that longer names
                             ;; come first. Order matters since (foo-bar|foo) correctly replaces
                             ;; "foo-bar" whereas (foo|foo-bar) does not
-                            (->> vals (sort >) (map common-util/escape-regex-chars) (string/join "|"))
+                            (->> prop-vals (sort >) (map common-util/escape-regex-chars) (string/join "|"))
                             ")"))
         remaining-text (string/replace val-text replace-regex "$1")
         non-ref-char (some #(if (or (string/blank? %) (#{"[" "]" "," "#"} %))
@@ -839,11 +839,11 @@
         ;; _ (when (seq new-properties) (prn :new-properties new-properties))
         [properties-tx pages-tx'] ((juxt filter remove)
                                    #(contains? new-properties (keyword (:block/name %))) pages-tx)
-        property-pages-tx (map (fn [{:block/keys [title uuid]}]
+        property-pages-tx (map (fn [{block-uuid :block/uuid :block/keys [title]}]
                                  (let [db-ident (get @(:all-idents import-state) (keyword (string/lower-case title)))]
                                    (sqlite-util/build-new-property db-ident
                                                                    (get @(:property-schemas import-state) (keyword title))
-                                                                   {:title title :block-uuid uuid})))
+                                                                   {:title title :block-uuid block-uuid})))
                                properties-tx)
         converted-property-pages-tx
         (map (fn [kw-name]

+ 1 - 0
deps/outliner/.clj-kondo/config.edn

@@ -2,6 +2,7 @@
  {:aliased-namespace-symbol {:level :warning}
   :namespace-name-mismatch {:level :warning}
   :used-underscored-binding {:level :warning}
+  :shadowed-var {:level :warning}
 
   :consistent-alias
   {:aliases {clojure.string string

+ 12 - 12
deps/outliner/src/logseq/outliner/core.cljs

@@ -445,10 +445,10 @@
     (if-let [list-type (and target-block (list-type-fn target-block))]
       (mapv
        (fn [{:block/keys [title format] :as block}]
-         (let [list? (and (some? (:block/uuid block))
-                          (nil? (list-type-fn block)))]
+         (let [list?' (and (some? (:block/uuid block))
+                           (nil? (list-type-fn block)))]
            (cond-> block
-             list?
+             list?'
              ((fn [b]
                 (if db-based?
                   (assoc b :logseq.property/order-list-type list-type)
@@ -493,10 +493,10 @@
         get-new-id (fn [block lookup]
                      (cond
                        (or (map? lookup) (vector? lookup) (de/entity? lookup))
-                       (when-let [uuid (if (and (vector? lookup) (= (first lookup) :block/uuid))
+                       (when-let [uuid' (if (and (vector? lookup) (= (first lookup) :block/uuid))
                                          (get uuids (last lookup))
                                          (get id->new-uuid (:db/id lookup)))]
-                         [:block/uuid uuid])
+                         [:block/uuid uuid'])
 
                        (integer? lookup)
                        lookup
@@ -505,14 +505,14 @@
                        (throw (js/Error. (str "[insert-blocks] illegal lookup: " lookup ", block: " block)))))
         orders (get-block-orders blocks target-block sibling? keep-block-order?)]
     (map-indexed (fn [idx {:block/keys [parent] :as block}]
-                   (when-let [uuid (get uuids (:block/uuid block))]
+                   (when-let [uuid' (get uuids (:block/uuid block))]
                      (let [top-level? (= (:block/level block) 1)
                            parent (compute-block-parent block parent target-block top-level? sibling? get-new-id outliner-op replace-empty-target? idx)
 
                            order (nth orders idx)
                            _ (assert (and parent order) (str "Parent or order is nil: " {:parent parent :order order}))
                            m {:db/id (:db/id block)
-                              :block/uuid uuid
+                              :block/uuid uuid'
                               :block/page target-page
                               :block/parent parent
                               :block/order order}]
@@ -647,7 +647,7 @@
                        :target-block target-block}))
       (let [uuids-tx (->> (map :block/uuid tx')
                           (remove nil?)
-                          (map (fn [uuid] {:block/uuid uuid})))
+                          (map (fn [uuid'] {:block/uuid uuid'})))
             tx (assign-temp-id tx' replace-empty-target? target-block)
             from-property (:logseq.property/created-from-property target-block)
             property-values-tx (when (and sibling? from-property)
@@ -776,10 +776,10 @@
         original-position? (move-to-original-position? blocks target-block sibling? non-consecutive?)]
     (when (and (not (contains? (set (map :db/id blocks)) (:db/id target-block)))
                (not original-position?))
-      (let [parents (->> (ldb/get-block-parents db (:block/uuid target-block) {})
-                         (map :db/id)
-                         (set))
-            move-parents-to-child? (some parents (map :db/id blocks))]
+      (let [parents' (->> (ldb/get-block-parents db (:block/uuid target-block) {})
+                          (map :db/id)
+                          (set))
+            move-parents-to-child? (some parents' (map :db/id blocks))]
         (when-not move-parents-to-child?
           (batch-tx/with-batch-tx-mode conn {:outliner-op :move-blocks}
             (doseq [[idx block] (map vector (range (count blocks)) blocks)]

+ 2 - 2
deps/outliner/src/logseq/outliner/pipeline.cljs

@@ -74,10 +74,10 @@
                (when-not (@*computed-ids (:block/uuid block))
                  (let [page? (ldb/page? block)
                        from-property (:logseq.property/created-from-property block)
-                       parents (when-not page?
+                       parents' (when-not page?
                                  (ldb/get-block-parents db-after (:block/uuid block) {}))
                        parents-refs (->> (cond->>
-                                          (mapcat :block/path-refs parents)
+                                          (mapcat :block/path-refs parents')
                                            from-property
                                            (remove (fn [parent] (and (ldb/property? parent) (not= (:db/id parent) (:db/id from-property))))))
                                          (map :db/id))

+ 2 - 2
deps/outliner/src/logseq/outliner/property.cljs

@@ -71,12 +71,12 @@
     v-str))
 
 (defn- update-datascript-schema
-  [property {:keys [type cardinality]}]
+  [property {type' :type :keys [cardinality]}]
   (let [ident (:db/ident property)
         cardinality (if (= cardinality :many) :db.cardinality/many :db.cardinality/one)
         old-type (get-in property [:block/schema :type])
         old-ref-type? (db-property-type/ref-property-types old-type)
-        ref-type? (db-property-type/ref-property-types type)]
+        ref-type? (db-property-type/ref-property-types type')]
     [(cond->
       {:db/ident ident
        :db/cardinality cardinality}

+ 1 - 0
deps/publishing/.clj-kondo/config.edn

@@ -2,6 +2,7 @@
  {:aliased-namespace-symbol {:level :warning}
   :namespace-name-mismatch {:level :warning}
   :used-underscored-binding {:level :warning}
+  :shadowed-var {:level :warning}
 
   :consistent-alias
   {:aliases {clojure.string string}}}

+ 8 - 8
deps/publishing/src/logseq/publishing/db.cljs

@@ -16,13 +16,13 @@
     (let [prop-lookup-fn (if (entity-util/db-based-graph? db)
                            #(db-property/property-value-content (get %1 %2))
                            #(get %1 (keyword (name %2))))]
-      (when-some [uuid (:block/uuid block)]
+      (when-some [uuid' (:block/uuid block)]
         (when-some [stamp (prop-lookup-fn props :logseq.property.pdf/hl-stamp)]
           (let [group-key      (string/replace-first (:block/title page) #"^hls__" "")
                 hl-page        (prop-lookup-fn props :logseq.property.pdf/hl-page)
                 encoded-chars? (boolean (re-find #"(?i)%[0-9a-f]{2}" group-key))
                 group-key      (if encoded-chars? (js/encodeURI group-key) group-key)]
-            (str "./assets/" group-key "/" (str hl-page "_" uuid "_" stamp ".png"))))))))
+            (str "./assets/" group-key "/" (str hl-page "_" uuid' "_" stamp ".png"))))))))
 
 (defn- clean-asset-path-prefix
   [path]
@@ -170,8 +170,8 @@
                                (set (concat (get-public-false-pages db) (get-public-false-block-ids db))))
         filtered-db (d/filter db
                               (fn [_db datom]
-                                (let [ns (namespace (:a datom))]
-                                  (and (not (remove? ns))
+                                (let [ns' (namespace (:a datom))]
+                                  (and (not (remove? ns'))
                                        (not (contains? #{:block/file} (:a datom)))
                                        (not (contains? non-public-datom-ids (:e datom)))))))
         datoms (d/datoms filtered-db :eavt)
@@ -189,13 +189,13 @@
         exported-namespace? #(contains? #{"block" "recent"} %)
         filtered-db (d/filter db
                               (fn [db datom]
-                                (let [ns (namespace (:a datom))]
+                                (let [ns' (namespace (:a datom))]
                                   (and
                                    (not (contains? #{:block/file} (:a datom)))
-                                   (not= ns "file")
+                                   (not= ns' "file")
                                    (or
-                                    (not (exported-namespace? ns))
-                                    (and (= ns "block")
+                                    (not (exported-namespace? ns'))
+                                    (and (= ns' "block")
                                          (or
                                           (contains? public-pages (:e datom))
                                           (contains? public-pages (:db/id (:block/page (d/entity db (:e datom))))))))))))

+ 4 - 4
deps/publishing/src/logseq/publishing/html.cljs

@@ -42,9 +42,9 @@ necessary db filtering"
 
 (defn- ^:large-vars/html publishing-html
   [transit-db app-state options]
-  (let [{:keys [icon name alias title description url]} options
+  (let [{name' :name :keys [icon alias title description url]} options
         icon (or icon "static/img/logo.png")
-        project (or alias name)]
+        project (or alias name')]
     (str "<!DOCTYPE html>\n"
          (html
           (list
@@ -138,8 +138,8 @@ necessary db filtering"
   "Given the graph's db, filters the db using the given options and returns the
 generated index.html string and assets used by the html"
   [db* {:keys [app-state repo-config html-options db-graph?]}]
-  (let [all-pages-public? (if-let [val (:publishing/all-pages-public? repo-config)]
-                            val
+  (let [all-pages-public? (if-let [value (:publishing/all-pages-public? repo-config)]
+                            value
                             (:all-pages-public? repo-config))
         [db asset-filenames'] (if all-pages-public?
                                 (db/clean-export! db* {:db-graph? db-graph?})

+ 2 - 2
deps/publishing/test/logseq/publishing/test/helper.clj

@@ -5,12 +5,12 @@
   "A wrapper around deftest that handles async and done in all cases.
   Importantly, it prevents unexpected failures in an async test from abruptly
   ending a test suite"
-  [name opts & body]
+  [name' opts & body]
   (let [[opts body]
         (if (map? opts)
           [opts body]
           [nil (cons opts body)])]
-    `(cljs.test/deftest ~name
+    `(cljs.test/deftest ~name'
        ~@(when-let [pre (:before opts)]
            [pre])
        (cljs.test/async

+ 8 - 8
src/electron/electron/core.cljs

@@ -58,8 +58,8 @@
     (when (= (str LSP_SCHEME ":") (.-protocol parsed-url))
       (logseq-url-handler win parsed-url))))
 
-(defn setup-interceptor! [^js app]
-  (.setAsDefaultProtocolClient app LSP_SCHEME)
+(defn setup-interceptor! [^js app']
+  (.setAsDefaultProtocolClient app' LSP_SCHEME)
 
   (.registerFileProtocol
    protocol FILE_ASSETS_SCHEME
@@ -242,13 +242,13 @@
                (open-url-handler win url))))))
 
 (defn- on-app-ready!
-  [^js app]
-  (.on app "ready"
+  [^js app']
+  (.on app' "ready"
        (fn []
-         (let [t0 (setup-interceptor! app)
+         (let [t0 (setup-interceptor! app')
                ^js win (win/create-main-window!)
                _ (reset! *win win)]
-           (logger/info (str "Logseq App(" (.getVersion app) ") Starting... "))
+           (logger/info (str "Logseq App(" (.getVersion app') ") Starting... "))
 
            (utils/<restore-proxy-settings)
 
@@ -297,10 +297,10 @@
                                               (.hide win)))
                                         :else
                                         nil)))))
-           (.on app "before-quit" (fn [_e]
+           (.on app' "before-quit" (fn [_e]
                                     (reset! win/*quitting? true)))
 
-           (.on app "activate" #(when @*win (.show win)))))))
+           (.on app' "activate" #(when @*win (.show win)))))))
 
 (defn main []
   (if-not (.requestSingleInstanceLock app)

+ 1 - 2
src/main/frontend/common/file/core.cljs

@@ -128,8 +128,6 @@
   [repo db tree opts context]
   (->> (tree->file-content-aux repo db tree opts context) (string/join "\n")))
 
-(def init-level 1)
-
 (defn- transact-file-tx-if-not-exists!
   [conn page-block ok-handler context]
   (when (:block/name page-block)
@@ -163,6 +161,7 @@
 (defn- save-tree-aux!
   [repo db page-block tree blocks-just-deleted? context request-id]
   (let [page-block (d/pull db '[*] (:db/id page-block))
+        init-level 1
         file-db-id (-> page-block :block/file :db/id)
         file-path (-> (d/entity db file-db-id) :file/path)
         result (if (and (string? file-path) (not-empty file-path))

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

@@ -11,9 +11,9 @@
 (def ^:private retry-sentinel (js-obj))
 (defn backoff
   "Retry task when it throw exception `(get ex-data :missionary/retry)`"
-  [delays task]
+  [delays-seq task]
   (m/sp
-    (loop [[delay & delays] (seq delays)]
+    (loop [[delay & rest-delays] (seq delays-seq)]
       (let [r (try
                 (m/? task)
                 (catch :default e
@@ -24,7 +24,7 @@
                         retry-sentinel)
                     (throw e))))]
         (if (identical? r retry-sentinel)
-          (recur delays)
+          (recur rest-delays)
           r)))))
 
 (defn mix

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

@@ -36,11 +36,11 @@
            s (seq (char-array str))
            mult 1
            idx MAX-STRING-LENGTH
-           score 0]
+           score' 0]
       (cond
         ;; 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
+        (empty? q) (+ score'
                       (str-len-distance query str)
                       (if (<= 0 (.indexOf ostr oquery)) MAX-STRING-LENGTH 0))
         (empty? s) 0
@@ -49,12 +49,12 @@
                        (rest s)
                        (inc mult) ;; increase the multiplier as more query chars are matched
                        (dec idx) ;; decrease idx so score gets lowered the further into the string we match
-                       (+ mult score)) ;; score for this match is current multiplier * idx
+                       (+ mult score')) ;; score for this match is current multiplier * idx
                 (recur q
                        (rest s)
                        1 ;; when there is no match, reset multiplier to one
                        (dec idx)
-                       (- score 0.1)))))))
+                       (- score' 0.1)))))))
 
 (defn search-normalize
   "Normalize string for searching (loose)"