Skip to content

Commit 177b05f

Browse files
mfikesdnolen
authored and
dnolen
committed
CLJS-1603: Only warn for misspelled comp/REPL opts
REPLs may have REPL-specific options which are added to the compiler/ REPL option map and this triggers "unknown compiler option" warnings. Instead, only issue warnings when there are known suggestions within the Levenshtein distance threshold. This effectively limits the feature to its original use case of detecting minor misspellings.
1 parent 4681e47 commit 177b05f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: src/main/clojure/cljs/build/api.clj

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@
204204
(env/default-compiler-env opts))))
205205
([source opts compiler-env]
206206
(doseq [[unknown-opt suggested-opt] (util/unknown-opts (set (keys opts)) closure/known-opts)]
207-
(println (str "WARNING: Unknown compiler option '" unknown-opt "'."
208-
(when suggested-opt (str " Did you mean '" suggested-opt "'?")))))
207+
(when suggested-opt
208+
(println (str "WARNING: Unknown compiler option '" unknown-opt "'. Did you mean '" suggested-opt "'?"))))
209209
(binding [ana/*cljs-warning-handlers* (:warning-handlers opts ana/*cljs-warning-handlers*)]
210210
(closure/build source opts compiler-env))))
211211

Diff for: src/main/clojure/cljs/repl.cljc

+2-2
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,8 @@
780780
bind-err true}
781781
:as opts}]
782782
(doseq [[unknown-opt suggested-opt] (util/unknown-opts (set (keys opts)) (set/union known-repl-opts cljsc/known-opts))]
783-
(println (str "WARNING: Unknown option '" unknown-opt "'."
784-
(when suggested-opt (str " Did you mean '" suggested-opt "'?")))))
783+
(when suggested-opt
784+
(println (str "WARNING: Unknown option '" unknown-opt "'. Did you mean '" suggested-opt "'?"))))
785785
(let [repl-opts (-repl-options repl-env)
786786
repl-requires (into repl-requires (:repl-requires repl-opts))
787787
{:keys [analyze-path repl-verbose warn-on-undeclared special-fns static-fns] :as opts

0 commit comments

Comments
 (0)