fix: lint warnings

pull/10839/head
Tienson Qin 2024-01-03 16:45:11 +08:00
parent b7d9098e80
commit cf1e4691c2
11 changed files with 7 additions and 87 deletions

View File

@ -79,11 +79,6 @@
(def hidden-page? ldb/hidden-page?)
(defn get-pages
[repo]
(let [db (conn/get-db repo)]
(ldb/get-pages db)))
(defn get-all-pages
[repo]
(->>
@ -406,12 +401,6 @@ independent of format as format specific heading characters are stripped"
f))
form))
(defn sort-page-random-blocks
"Blocks could be non consecutive."
[blocks]
(let [db (conn/get-db)]
(ldb/sort-page-random-blocks db blocks)))
;; Diverged of get-sorted-page-block-ids
(defn get-sorted-page-block-ids-and-levels
"page-name: the page name, original name
@ -517,10 +506,6 @@ independent of format as format specific heading characters are stripped"
(when-not (:block/name parent)
parent)))))
(defn get-non-consecutive-blocks
[blocks]
(ldb/get-non-consecutive-blocks (conn/get-db) blocks))
(defn get-page-blocks-no-cache
([page]
(get-page-blocks-no-cache (state/get-current-repo) page nil))

View File

@ -1,17 +0,0 @@
(ns frontend.db.outliner
"Db related fns for the outliner module"
(:require [datascript.core :as d]))
(defn get-by-id
[conn id]
(try
(d/pull @conn '[*] id)
(catch :default _e nil)))
;; key [:block/children parent-id]
(def get-by-parent-id
'[:find (pull ?a [*])
:in $ ?id
:where
[?a :block/parent ?id]])

View File

@ -14,8 +14,7 @@
[lambdaisland.glogi :as log]
[datascript.core :as d]
[logseq.db.frontend.property :as db-property]
[frontend.format.mldoc :as mldoc]
[frontend.worker.mldoc :as worker-mldoc]))
[frontend.format.mldoc :as mldoc]))
(defn- update-extracted-block-properties
"Updates DB graph blocks to ensure that built-in properties are using uuids
@ -71,13 +70,6 @@ and handles unexpected failure."
([original-page-name with-id? with-timestamp?]
(gp-block/page-name->map original-page-name with-id? (db/get-db (state/get-current-repo)) with-timestamp? (state/get-date-formatter))))
(defn extract-refs-from-text
[text]
(worker-mldoc/extract-refs-from-text (state/get-current-repo)
(db/get-db (state/get-current-repo))
text
(state/get-date-formatter)))
(defn- normalize-as-percentage
[block]
(some->> block

View File

@ -2,11 +2,9 @@
"Utility fns for properties that are for both file and db graphs.
Some fns like lookup and get-property were written to easily be backwards
compatible with file graphs"
(:require [frontend.config :as config]
[frontend.state :as state]
(:require [frontend.state :as state]
[logseq.common.util :as common-util]
[frontend.db :as db]
[frontend.util :as util]
[logseq.db.frontend.property :as db-property]))
(defn lookup

View File

@ -36,7 +36,6 @@
[frontend.mobile.util :as mobile-util]
[medley.core :as medley]
[logseq.common.path :as path]
[logseq.common.config :as common-config]
[frontend.db.listener :as db-listener]
[frontend.db.rtc.op-mem-layer :as op-mem-layer]))

View File

@ -26,10 +26,6 @@
v)))
x)))))
(defn get-tx-id
[tx-report]
(get-in tx-report [:tempids :db/current-tx]))
(defn update-refs-and-macros
"When a block is deleted, refs are updated and macros associated with the block are deleted"
[txs db repo opts set-state-fn]

View File

@ -13,8 +13,7 @@
[electron.ipc :as ipc]
[frontend.modules.outliner.pipeline :as pipeline]
[clojure.edn :as edn]
[frontend.handler.worker :as worker-handler]
[frontend.db :as db]))
[frontend.handler.worker :as worker-handler]))
(defonce *sqlite (atom nil))

View File

@ -1149,8 +1149,6 @@
#?(:cljs
(def remove-first worker-util/remove-first))
(def pprint clojure.pprint/pprint)
#?(:cljs
(defn backward-kill-word
[input]

View File

@ -5,7 +5,6 @@
2. For any block, its children should be connected by :block/left (no broken chain, no circle, no left to self)."
(:require [datascript.core :as d]
[cljs.pprint :as pprint]
[frontend.handler.notification :as notification]
[logseq.db :as ldb]
[frontend.worker.util :as util]))

View File

@ -1,30 +0,0 @@
(ns frontend.db.outliner-test
(:require [cljs.test :refer [deftest is use-fixtures]]
[datascript.core :as d]
[frontend.core-test :as core-test]
[logseq.db :as db]
[frontend.test.fixtures :as fixtures]))
(use-fixtures :each fixtures/reset-db)
(deftest test-get-by-id
(let [conn (core-test/get-current-conn)
block-id "1"
data [{:block/uuid block-id}]
_ (d/transact! conn data)
result (db/get-by-id conn [:block/uuid block-id])]
(is (= block-id (:block/uuid result)))))
(deftest test-get-by-parent-id
(let [conn (core-test/get-current-conn)
data [{:block/uuid "1"}
{:block/uuid "2"
:block/parent [:block/uuid "1"]
:block/left [:block/uuid "1"]}
{:block/uuid "3"
:block/parent [:block/uuid "1"]
:block/left [:block/uuid "2"]}]
_ (d/transact! conn data)
r (d/q db/get-by-parent-id @conn [:block/uuid "1"])
result (flatten r)]
(is (= ["2" "3"] (mapv :block/uuid result)))))

View File

@ -1,10 +1,11 @@
(ns frontend.format.mldoc-test
(:require [frontend.format.mldoc :as mldoc]
[cljs.test :refer [deftest testing are]]))
(:require [frontend.worker.mldoc :as worker-mldoc]
[cljs.test :refer [deftest testing are]]
[frontend.test.helper :as test-helper]))
(deftest test-extract-plain
(testing "normalize date values"
(are [x y] (= (mldoc/extract-plain x) y)
(are [x y] (= (worker-mldoc/extract-plain test-helper/test-db x) y)
"foo #book #[[nice test]]"
"foo"