mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-28 16:20:43 +00:00
This commit adds a custom linter to verify i18n/label is called with a qualified keyword, like :t/foo. More sophisticated linters are possible too. We also set the stage for other developers to consider more lint automation instead of manually reviewing conventions in PRs. If you want to understand how to write custom linters, check out https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md. You can fire the Clojure JVM REPL in status-mobile and play with the clj-kondo hook too, it works beautifully. Why do we care? By making sure all translation keywords are qualified with "t", it is trivial to grep or replace them because they're unique in the repo, and can't be confused with other words if you search by ":t/<something>". Note: It's a best practice to commit clj-kondo configuration from external libraries in the .clj-kondo directory. The directory .clj-kondo/babashka is auto-generated, that's why it was added.
67 lines
4.4 KiB
Clojure
67 lines
4.4 KiB
Clojure
{:config-paths ["status-im"]
|
|
:lint-as {status-im.utils.views/defview clojure.core/defn
|
|
status-im.utils.views/letsubs clojure.core/let
|
|
reagent.core/with-let clojure.core/let
|
|
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
|
|
utils.re-frame/defn clj-kondo.lint-as/def-catch-all
|
|
quo.react/with-deps-check clojure.core/fn
|
|
quo.previews.preview/list-comp clojure.core/for
|
|
status-im.utils.styles/def clojure.core/def
|
|
status-im.utils.styles/defn clojure.core/defn
|
|
test-helpers.unit/deftest-sub clojure.core/defn
|
|
taoensso.tufte/defnp clojure.core/defn}
|
|
:linters {:case-duplicate-test {:level :error}
|
|
:case-quoted-test {:level :error}
|
|
:case-symbol-test {:level :error}
|
|
:clj-kondo-config {:level :error}
|
|
:cond-else {:level :error}
|
|
:consistent-alias {:level :error
|
|
:aliases {clojure.string string
|
|
clojure.set set
|
|
clojure.walk walk
|
|
taoensso.timbre log}}
|
|
:deprecated-namespace {:level :warning}
|
|
:docstring-blank {:level :error}
|
|
:equals-true {:level :error}
|
|
:inline-def {:level :error}
|
|
:invalid-arity {:skip-args [status-im.utils.fx/defn utils.re-frame/defn]}
|
|
:loop-without-recur {:level :error}
|
|
:minus-one {:level :error}
|
|
:misplaced-docstring {:level :error}
|
|
:missing-body-in-when {:level :error}
|
|
:missing-clause-in-try {:level :error}
|
|
:missing-else-branch {:level :error}
|
|
:not-empty? {:level :error}
|
|
:plus-one {:level :error}
|
|
:redundant-do {:level :error}
|
|
:redundant-let {:level :error}
|
|
:refer-all {:level :error}
|
|
:shadowed-var {:level :error
|
|
;; We temporarily use :include to define an
|
|
;; allowlist of core Clojure vars. In the
|
|
;; future, as we progressively fix shadowed
|
|
;; vars, we should be able to delete this
|
|
;; option and lint all vars.
|
|
:exclude [type name]}
|
|
:single-operand-comparison {:level :error}
|
|
:syntax {:level :error}
|
|
:unbound-destructuring-default {:level :error}
|
|
:unknown-require-option {:level :error}
|
|
:unreachable-code {:level :error}
|
|
:unresolved-namespace {:level :error}
|
|
;; TODO remove number when this is fixed
|
|
;; https://github.com/borkdude/clj-kondo/issues/867
|
|
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY
|
|
number
|
|
status-im.test-helpers/restore-app-db]}
|
|
:unresolved-var {:level :error}
|
|
:uninitialized-var {:level :error}
|
|
:unused-alias {:level :warning}
|
|
:unused-binding {:level :error}
|
|
:unused-import {:level :error}
|
|
:unused-namespace {:level :error}
|
|
:unused-private-var {:level :error}
|
|
:unused-referred-var {:level :error}
|
|
:use {:level :error}}
|
|
:config-in-ns {mocks.js-dependencies {:linters {:clojure-lsp/unused-public-var {:level :off}}}}}
|