Browse Source

fix multiple lints

Gabriel Horner 1 year ago
parent
commit
c9ba357a90

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

@@ -18,7 +18,7 @@
             [logseq.db.sqlite.util :as sqlite-util]
             [logseq.db.sqlite.util :as sqlite-util]
             [cljs.pprint :as pprint]))
             [cljs.pprint :as pprint]))
 
 
-(def block-map
+(def ^:private block-map
   (mu/optional-keys
   (mu/optional-keys
    [:map
    [:map
     [:db/id :int]
     [:db/id :int]
@@ -28,12 +28,12 @@
     [:block/parent :map]
     [:block/parent :map]
     [:block/page :map]]))
     [:block/page :map]]))
 
 
-(def block-map-or-entity
+(def ^:private block-map-or-entity
   [:or [:fn de/entity?] block-map])
   [:or [:fn de/entity?] block-map])
 
 
-(defrecord Block [data])
+(defrecord ^:api Block [data])
 
 
-(defn block
+(defn ^:api block
   [db m]
   [db m]
   (assert (or (map? m) (de/entity? m)) (common-util/format "block data must be map or entity, got: %s %s" (type m) m))
   (assert (or (map? m) (de/entity? m)) (common-util/format "block data must be map or entity, got: %s %s" (type m) m))
   (let [e (if (or (de/entity? m)
   (let [e (if (or (de/entity? m)
@@ -48,11 +48,11 @@
                        :block/uuid (:block/uuid entity)))))]
                        :block/uuid (:block/uuid entity)))))]
     (->Block e)))
     (->Block e)))
 
 
-(defn get-data
+(defn ^:api get-data
   [block]
   [block]
   (:data block))
   (:data block))
 
 
-(defn get-block-by-id
+(defn- get-block-by-id
   [db id]
   [db id]
   (let [r (ldb/get-by-id db (outliner-u/->block-lookup-ref id))]
   (let [r (ldb/get-by-id db (outliner-u/->block-lookup-ref id))]
     (when r (->Block r))))
     (when r (->Block r))))
@@ -74,7 +74,7 @@
                 (assoc :block/created-at updated-at))]
                 (assoc :block/created-at updated-at))]
     block))
     block))
 
 
-(defn block-with-updated-at
+(defn ^:api block-with-updated-at
   [block]
   [block]
   (let [updated-at (common-util/time-ms)]
   (let [updated-at (common-util/time-ms)]
     (assoc block :block/updated-at updated-at)))
     (assoc block :block/updated-at updated-at)))
@@ -192,7 +192,7 @@
                                       merge-tx))))))
                                       merge-tx))))))
      (reset! (:editor/create-page? @state/state) false))))
      (reset! (:editor/create-page? @state/state) false))))
 
 
-(defn rebuild-block-refs
+(defn ^:api rebuild-block-refs
   [repo conn date-formatter block new-properties & {:keys [skip-content-parsing?]}]
   [repo conn date-formatter block new-properties & {:keys [skip-content-parsing?]}]
   (let [db @conn
   (let [db @conn
         property-key-refs (keys new-properties)
         property-key-refs (keys new-properties)
@@ -400,7 +400,7 @@
           children (ldb/get-block-immediate-children @conn parent-id)]
           children (ldb/get-block-immediate-children @conn parent-id)]
       (map #(block @conn %) children))))
       (map #(block @conn %) children))))
 
 
-(defn get-right-sibling
+(defn ^:api get-right-sibling
   [db db-id]
   [db db-id]
   (when db-id
   (when db-id
     (ldb/get-right-sibling db db-id)))
     (ldb/get-right-sibling db db-id)))
@@ -537,7 +537,7 @@
         (mapcat #(tree-seq map? children-key %))
         (mapcat #(tree-seq map? children-key %))
         (map #(dissoc % :block/children)))))
         (map #(dissoc % :block/children)))))
 
 
-(defn save-block
+(defn ^:api save-block
   "Save the `block`."
   "Save the `block`."
   [repo conn date-formatter block']
   [repo conn date-formatter block']
   {:pre [(map? block')]}
   {:pre [(map? block')]}
@@ -577,7 +577,7 @@
 
 
 ;;; ### insert-blocks, delete-blocks, move-blocks
 ;;; ### insert-blocks, delete-blocks, move-blocks
 
 
-(defn fix-top-level-blocks
+(defn ^:api fix-top-level-blocks
   "Blocks with :block/level"
   "Blocks with :block/level"
   [blocks]
   [blocks]
   (let [top-level-blocks (filter #(= (:block/level %) 1) blocks)
   (let [top-level-blocks (filter #(= (:block/level %) 1) blocks)
@@ -694,7 +694,7 @@
       result)))
       result)))
 
 
 
 
-(defn blocks-with-level
+(defn ^:api blocks-with-level
   "Calculate `:block/level` for all the `blocks`. Blocks should be sorted already."
   "Calculate `:block/level` for all the `blocks`. Blocks should be sorted already."
   [blocks]
   [blocks]
   {:pre [(seq blocks)]}
   {:pre [(seq blocks)]}
@@ -723,7 +723,7 @@
               m' (vec (conj m block))]
               m' (vec (conj m block))]
           (recur m' (rest blocks)))))))
           (recur m' (rest blocks)))))))
 
 
-(defn ^:large-vars/cleanup-todo insert-blocks
+(defn- ^:large-vars/cleanup-todo insert-blocks
   "Insert blocks as children (or siblings) of target-node.
   "Insert blocks as children (or siblings) of target-node.
   Args:
   Args:
     `conn`: db connection.
     `conn`: db connection.
@@ -844,7 +844,7 @@
                                   non-consecutive-blocks)))) page-blocks)
                                   non-consecutive-blocks)))) page-blocks)
        (remove nil?)))))
        (remove nil?)))))
 
 
-(defn delete-block
+(defn ^:api delete-block
   "Delete block from the tree."
   "Delete block from the tree."
   [repo conn txs-state node {:keys [children? children-check? date-formatter]
   [repo conn txs-state node {:keys [children? children-check? date-formatter]
                         :or {children-check? true}}]
                         :or {children-check? true}}]
@@ -933,7 +933,7 @@
                 (:db/id target-block))
                 (:db/id target-block))
              sibling?)))
              sibling?)))
 
 
-(defn move-blocks
+(defn- move-blocks
   "Move `blocks` to `target-block` as siblings or children."
   "Move `blocks` to `target-block` as siblings or children."
   [repo conn blocks target-block {:keys [_sibling? _up? outliner-op _indent?]
   [repo conn blocks target-block {:keys [_sibling? _up? outliner-op _indent?]
                                   :as opts}]
                                   :as opts}]
@@ -979,7 +979,7 @@
                 {:tx-data full-tx
                 {:tx-data full-tx
                  :tx-meta tx-meta}))))))))
                  :tx-meta tx-meta}))))))))
 
 
-(defn move-blocks-up-down
+(defn- move-blocks-up-down
   "Move blocks up/down."
   "Move blocks up/down."
   [repo conn blocks up?]
   [repo conn blocks up?]
   {:pre [(seq blocks) (boolean? up?)]}
   {:pre [(seq blocks) (boolean? up?)]}
@@ -1013,7 +1013,7 @@
           (move-blocks repo conn blocks right (merge opts {:sibling? sibling?
           (move-blocks repo conn blocks right (merge opts {:sibling? sibling?
                                                            :up? up?})))))))
                                                            :up? up?})))))))
 
 
-(defn ^:large-vars/cleanup-todo indent-outdent-blocks
+(defn- ^:large-vars/cleanup-todo indent-outdent-blocks
   "Indent or outdent `blocks`."
   "Indent or outdent `blocks`."
   [repo conn blocks indent? & {:keys [get-first-block-original logical-outdenting?]}]
   [repo conn blocks indent? & {:keys [get-first-block-original logical-outdenting?]}]
   {:pre [(seq blocks) (boolean? indent?)]}
   {:pre [(seq blocks) (boolean? indent?)]}

+ 1 - 1
deps/outliner/src/logseq/outliner/datascript.cljs

@@ -27,7 +27,7 @@
                                        v)))
                                        v)))
                     x)))))
                     x)))))
 
 
-(defn update-refs-and-macros
+(defn- update-refs-and-macros
   "When a block is deleted, refs are updated and macros associated with the block are deleted"
   "When a block is deleted, refs are updated and macros associated with the block are deleted"
   [txs db repo opts set-state-fn]
   [txs db repo opts set-state-fn]
   (if (= :delete-blocks (:outliner-op opts))
   (if (= :delete-blocks (:outliner-op opts))

+ 2 - 2
deps/outliner/src/logseq/outliner/transaction.cljc

@@ -4,12 +4,12 @@
   #?(:cljs (:require-macros [logseq.outliner.transaction]))
   #?(:cljs (:require-macros [logseq.outliner.transaction]))
   #?(:cljs (:require [malli.core :as m])))
   #?(:cljs (:require [malli.core :as m])))
 
 
-(def transact-opts [:or :symbol :map])
+(def ^:private transact-opts [:or :symbol :map])
 
 
 #?(:org.babashka/nbb nil
 #?(:org.babashka/nbb nil
    :cljs (m/=> transact! [:=> [:cat transact-opts :any] :any]))
    :cljs (m/=> transact! [:=> [:cat transact-opts :any] :any]))
 
 
-(defmacro transact!
+(defmacro ^:api transact!
   "Batch all the transactions in `body` to a single transaction, Support nested transact! calls.
   "Batch all the transactions in `body` to a single transaction, Support nested transact! calls.
   Currently there are no options, it'll execute body and collect all transaction data generated by body.
   Currently there are no options, it'll execute body and collect all transaction data generated by body.
   If no transactions are included in `body`, it does not save a transaction.
   If no transactions are included in `body`, it does not save a transaction.

+ 3 - 3
deps/outliner/src/logseq/outliner/tree.cljs

@@ -80,7 +80,7 @@
       (assoc root' :block/children children)
       (assoc root' :block/children children)
       root')))
       root')))
 
 
-(defn block-entity->map
+(defn ^:api block-entity->map
   [e]
   [e]
   (cond-> {:db/id (:db/id e)
   (cond-> {:db/id (:db/id e)
            :block/uuid (:block/uuid e)
            :block/uuid (:block/uuid e)
@@ -93,7 +93,7 @@
     (:block/children e)
     (:block/children e)
     (assoc :block/children (:block/children e))))
     (assoc :block/children (:block/children e))))
 
 
-(defn filter-top-level-blocks
+(defn ^:api filter-top-level-blocks
   [blocks]
   [blocks]
   (let [id->blocks (zipmap (map :db/id blocks) blocks)]
   (let [id->blocks (zipmap (map :db/id blocks) blocks)]
     (filter #(nil?
     (filter #(nil?
@@ -121,7 +121,7 @@
                     (if sorted-nested-children [parent sorted-nested-children] [parent])))
                     (if sorted-nested-children [parent sorted-nested-children] [parent])))
         parents))
         parents))
 
 
-(defn sort-blocks
+(defn ^:api sort-blocks
   "sort blocks by parent & left"
   "sort blocks by parent & left"
   [blocks-exclude-root root]
   [blocks-exclude-root root]
   (let [parent-groups (atom (group-by :block/parent blocks-exclude-root))]
   (let [parent-groups (atom (group-by :block/parent blocks-exclude-root))]

+ 1 - 1
deps/outliner/src/logseq/outliner/util.cljs

@@ -7,7 +7,7 @@
    [datascript.impl.entity :as e]
    [datascript.impl.entity :as e]
    [logseq.common.util :as common-util]))
    [logseq.common.util :as common-util]))
 
 
-(defn block-id?
+(defn- block-id?
   [id]
   [id]
   (or
   (or
    (number? id)
    (number? id)

+ 1 - 3
src/main/frontend/components/page.cljs

@@ -10,7 +10,6 @@
             [frontend.components.reference :as reference]
             [frontend.components.reference :as reference]
             [frontend.components.scheduled-deadlines :as scheduled]
             [frontend.components.scheduled-deadlines :as scheduled]
             [frontend.components.icon :as icon-component]
             [frontend.components.icon :as icon-component]
-            [frontend.components.property.value :as pv]
             [frontend.components.db-based.page :as db-page]
             [frontend.components.db-based.page :as db-page]
             [frontend.handler.property.util :as pu]
             [frontend.handler.property.util :as pu]
             [frontend.handler.db-based.property :as db-property-handler]
             [frontend.handler.db-based.property :as db-property-handler]
@@ -337,8 +336,7 @@
                         (date/journal-title->custom-format title)
                         (date/journal-title->custom-format title)
                         title))
                         title))
               old-name (or title page-name)
               old-name (or title page-name)
-              db-based? (config/db-based-graph? repo)
-              tags-property (db/entity [:block/name "tags"])]
+              db-based? (config/db-based-graph? repo)]
           [:div.ls-page-title.flex.flex-1.flex-row.flex-wrap.w-full.relative.items-center.gap-2
           [:div.ls-page-title.flex.flex-1.flex-row.flex-wrap.w-full.relative.items-center.gap-2
            {:on-mouse-over #(reset! *hover? true)
            {:on-mouse-over #(reset! *hover? true)
             :on-mouse-out #(reset! *hover? false)}
             :on-mouse-out #(reset! *hover? false)}

+ 1 - 4
src/test/frontend/handler/export_test.cljs

@@ -1,12 +1,9 @@
 (ns frontend.handler.export-test
 (ns frontend.handler.export-test
-  (:require [cljs.test :refer [are async deftest is use-fixtures]]
-            [clojure.edn :as edn]
+  (:require [cljs.test :refer [are async deftest use-fixtures]]
             [clojure.string :as string]
             [clojure.string :as string]
-            [frontend.handler.export :as export]
             [frontend.handler.export.text :as export-text]
             [frontend.handler.export.text :as export-text]
             [frontend.state :as state]
             [frontend.state :as state]
             [frontend.test.helper :as test-helper :include-macros true :refer [deftest-async]]
             [frontend.test.helper :as test-helper :include-macros true :refer [deftest-async]]
-            [logseq.db.frontend.default :as default-db]
             [promesa.core :as p]))
             [promesa.core :as p]))
 
 
 (def test-files
 (def test-files

+ 1 - 2
src/test/frontend/worker/rtc/asset_sync_effects_test.cljs

@@ -1,8 +1,7 @@
 (ns frontend.worker.rtc.asset-sync-effects-test
 (ns frontend.worker.rtc.asset-sync-effects-test
   "This ns include tests abouts asset-sync with other components.
   "This ns include tests abouts asset-sync with other components.
   These tests need to start the asset-sync-loop."
   These tests need to start the asset-sync-loop."
-  (:require [cljs.core.async :as async :refer [<! >! go timeout]]
-            [clojure.test :as t :refer [deftest is use-fixtures]]
+  (:require [clojure.test :as t :refer [deftest is use-fixtures]]
             [frontend.test.helper :include-macros true :as test-helper]
             [frontend.test.helper :include-macros true :as test-helper]
             [frontend.worker.rtc.fixture :as rtc-fixture]
             [frontend.worker.rtc.fixture :as rtc-fixture]
             [spy.core :as spy]))
             [spy.core :as spy]))

+ 1 - 1
typos.toml

@@ -18,4 +18,4 @@ fom = "fom"
 tne = "tne"
 tne = "tne"
 Damon = "Damon"
 Damon = "Damon"
 [files]
 [files]
-extend-exclude = ["resources/*", "src/resources/*", "scripts/resources/*"]
+extend-exclude = ["resources/*", "src/resources/*", "scripts/resources/*", "e2e-tests/plugin/lsplugin.user.js"]