Skip to content

Commit

Permalink
fix: Kibit cannot parse ns with string requires
Browse files Browse the repository at this point in the history
  • Loading branch information
marksto committed Sep 13, 2021
1 parent ccd8c7d commit 16bb192
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions kibit/src/kibit/check/reader.clj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
(or (keyword? (second form)) ; vector like [foo :as f]
(= 1 (count form))))) ; bare vector like [foo]

(defn- js-dep-spec?
"A version of `option-spec?` for native JS dependencies, i.e. vectors
like [\"react-dom\" :as react-dom] or just [\"some-polyfill\"]"
[form]
(and (sequential? form) ; should be a vector, but often is not
(string? (first form))
(or (keyword? (second form)) ; vector like ["foo" :as f]
(= 1 (count form)))))

(defn- deps-from-libspec
"A slight modification from clojure.tools.namespace.parse/deps-from-libspec,
in which aliases are captured as metadata."
Expand All @@ -68,6 +77,9 @@
(symbol (str (when prefix (str prefix ".")) form))
{:alias alias}))

(js-dep-spec? form)
nil

(#{:reload-all} form) ; Some people write (:require ... :reload-all)
nil

Expand Down

0 comments on commit 16bb192

Please sign in to comment.