Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Adjust clj-kondo linter to allow keyword flags in `require` (#63277)

Timothy S. Dean9dab171530b2
diff --git a/.clj-kondo/src/hooks/clojure/core/require.clj b/.clj-kondo/src/hooks/clojure/core/require.clj
index 53e2b621451..3928ee41df7 100644
--- a/.clj-kondo/src/hooks/clojure/core/require.clj
+++ b/.clj-kondo/src/hooks/clojure/core/require.clj
@@ -52,7 +52,13 @@
(defn- lint-require* [node current-ns config]
(let [[_require & args] (:children node)
- required-namespaces (keep unwrap-require args)]
+ required-namespaces (->> (keep unwrap-require args)
+ ;; `require` runs through `cc/load-libs` which allows
+ ;; #{:as :reload :reload-all :require :use :verbose :refer :as-alias}
+ ;; as args. If you use a REPL tool that applies clj-kondo linting (e.g., Clojure MCP)
+ ;; you may wish to `:reload` or `:reload-all` a namespace. So we shouldn't assume all
+ ;; args are keywords:
+ (remove keyword?))]
(lint* node current-ns config required-namespaces)))
(defn- lint-requiring-resolve* [node current-ns config]