mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
enhance(dev): Add fast kondo lint for dev
This commit is contained in:
3
bb.edn
3
bb.edn
@@ -152,6 +152,9 @@
|
||||
lint:dev
|
||||
logseq.tasks.dev.lint/dev
|
||||
|
||||
lint:kondo-git-changes
|
||||
logseq.tasks.dev.lint/kondo-git-changes
|
||||
|
||||
lint:large-vars
|
||||
logseq.bb-tasks.lint.large-vars/-main
|
||||
|
||||
|
||||
@@ -14,11 +14,13 @@ bb lint:dev
|
||||
|
||||
To lint:
|
||||
```sh
|
||||
clojure -M:clj-kondo --parallel --lint src --cache false
|
||||
clojure -M:clj-kondo --parallel --lint src
|
||||
```
|
||||
|
||||
We lint our Clojure(Script) code with https://github.com/clj-kondo/clj-kondo/. If you need to configure specific linters, see [this documentation](https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md). Where possible, a global linting configuration is used and namespace specific configuration is avoided.
|
||||
|
||||
For engineers, there is a faster version of this command that only checks files that you have changed: `bb lint:kondo-git-changes`.
|
||||
|
||||
There are outstanding linting items that are currently ignored to allow linting the rest of the codebase in CI. These outstanding linting items should be addressed at some point:
|
||||
|
||||
* Comments starting with `TODO:lint`
|
||||
@@ -313,7 +315,7 @@ We strive to use explicit names that are self explanatory so that our codebase i
|
||||
|
||||
### Babashka tasks
|
||||
|
||||
There are a number of bb tasks under `dev:` for developers. Some useful ones to
|
||||
There are a number of bb tasks under `dev:` for development. Some useful ones to
|
||||
point out:
|
||||
|
||||
* `dev:validate-repo-config-edn` - Validate a repo config.edn
|
||||
|
||||
@@ -21,6 +21,20 @@
|
||||
(println cmd)
|
||||
(shell cmd)))
|
||||
|
||||
(defn kondo-git-changes
|
||||
"Run clj-kondo only for files that git diff detects as changed and unstaged"
|
||||
[]
|
||||
(let [files (->> (shell {:out :string} "git diff --name-only")
|
||||
:out
|
||||
string/split-lines
|
||||
(filter #(string/starts-with? % "src")))]
|
||||
(if (seq files)
|
||||
(let [cmd (str "clj-kondo --lint " (string/join " " files))
|
||||
_ (println cmd)
|
||||
res (apply shell {:continue :true} "clj-kondo --lint" files)]
|
||||
(System/exit (:exit res)))
|
||||
(println "No files have changed to lint."))))
|
||||
|
||||
(defn- validate-frontend-not-in-worker
|
||||
[]
|
||||
(let [res (shell {:out :string}
|
||||
|
||||
Reference in New Issue
Block a user