fix: remove cli namespace dependency from electron namespaces

Added a :discouraged-namespace linter check for future times.
Had to add clj-kondo configs for db and outliner since they
were incorrectly inheriting the frontend config, specifically
the :discouraged-namespace linter. Also removed a 'm/=>' in outliner dep
b/c it would've created a complex clj-kondo setup for malli that
would need to be updated for both top-level clj-kondo and deps/outliner
This commit is contained in:
Gabriel Horner
2024-06-14 15:42:17 -04:00
parent 95db811f55
commit 8ba5c15f93
8 changed files with 48 additions and 13 deletions

View File

@@ -22,6 +22,9 @@
;; TODO:lint: Fix when fixing all type hints
object]}
:discouraged-namespace
{logseq.db.sqlite.db {:message "frontend should not depend on CLI namespace with sqlite3 dependency"}}
:unused-namespace {:level :warning
:exclude [logseq.db.frontend.entity-plus]}

25
deps/db/.clj-kondo/config.edn vendored Normal file
View File

@@ -0,0 +1,25 @@
{:linters
{:aliased-namespace-symbol {:level :warning}
:namespace-name-mismatch {:level :warning}
:used-underscored-binding {:level :warning}
:consistent-alias
{:aliases {clojure.string string
logseq.db ldb
logseq.db.frontend.content db-content
logseq.db.frontend.class db-class
logseq.db.frontend.db-ident db-ident
logseq.db.frontend.inputs db-inputs
logseq.db.frontend.order db-order
logseq.db.frontend.property db-property
logseq.db.frontend.property.build db-property-build
logseq.db.frontend.property.type db-property-type
logseq.db.frontend.property.util db-property-util
logseq.db.frontend.entity-plus entity-plus
logseq.db.frontend.rules rules
logseq.db.frontend.schema db-schema
logseq.db.frontend.validate db-validate
logseq.db.sqlite.db sqlite-db
logseq.db.sqlite.util sqlite-util}}}
:skip-comments true
:output {:progress true}}

1
deps/db/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/.clj-kondo/.cache

13
deps/outliner/.clj-kondo/config.edn vendored Normal file
View File

@@ -0,0 +1,13 @@
{:linters
{:aliased-namespace-symbol {:level :warning}
:namespace-name-mismatch {:level :warning}
:used-underscored-binding {:level :warning}
:consistent-alias
{:aliases {clojure.string string
logseq.outliner.core outliner-core
logseq.outliner.op outliner-op
logseq.outliner.pipeline outliner-pipeline
logseq.outliner.datascript-report ds-report}}}
:skip-comments true
:output {:progress true}}

1
deps/outliner/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/.clj-kondo/.cache

View File

@@ -1,14 +1,7 @@
(ns logseq.outliner.transaction
"Provides a wrapper around logseq.outliner.datascript/transact! using
transient state from logseq.outliner.core"
#?(:cljs (:require-macros [logseq.outliner.transaction]))
#?(:cljs (:require [malli.core :as m])))
#_:clj-kondo/ignore
(def ^:private transact-opts [:or :symbol :map])
#?(:org.babashka/nbb nil
:cljs (m/=> transact! [:=> [:cat transact-opts :any] :any]))
#?(:cljs (:require-macros [logseq.outliner.transaction])))
(defmacro ^:api transact!
"Batch all the transactions in `body` to a single transaction, Support nested transact! calls.

View File

@@ -3,8 +3,7 @@
(:require ["path" :as node-path]
["fs-extra" :as fs]
["electron" :refer [app]]
[logseq.db.sqlite.common-db :as sqlite-common-db]
[logseq.db.sqlite.db :as sqlite-db]))
[logseq.db.sqlite.common-db :as sqlite-common-db]))
(defn get-graphs-dir
[]
@@ -30,7 +29,7 @@
(defn get-db
[db-name]
(let [_ (ensure-graph-dir! db-name)
[_db-name db-path] (sqlite-db/get-db-full-path (get-graphs-dir) db-name)]
[_db-name db-path] (sqlite-common-db/get-db-full-path (get-graphs-dir) db-name)]
(when (fs/existsSync db-path)
(fs/readFileSync db-path))))

View File

@@ -30,7 +30,7 @@
[electron.window :as win]
[electron.handler-interface :refer [handle]]
[logseq.db.sqlite.util :as sqlite-util]
[logseq.db.sqlite.db :as sqlite-db]
[logseq.db.sqlite.common-db :as sqlite-common-db]
[goog.functions :refer [debounce]]
[logseq.common.graph :as common-graph]
[promesa.core :as p]))
@@ -294,7 +294,7 @@
(defmethod handle :deleteGraph [_window [_ graph graph-name _db-based?]]
(when graph-name
(db/unlink-graph! graph)
(let [old-transit-path (node-path/join (get-graphs-dir) (str (sqlite-db/sanitize-db-name graph) ".transit"))]
(let [old-transit-path (node-path/join (get-graphs-dir) (str (sqlite-common-db/sanitize-db-name graph) ".transit"))]
(when (fs/existsSync old-transit-path)
(fs/unlinkSync old-transit-path)))))