From 177b05fc5935c659e4829b7b1798e216b6797bec Mon Sep 17 00:00:00 2001 From: Mike Fikes Date: Fri, 18 Mar 2016 21:37:12 -0700 Subject: [PATCH] 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. --- src/main/clojure/cljs/build/api.clj | 4 ++-- src/main/clojure/cljs/repl.cljc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/clojure/cljs/build/api.clj b/src/main/clojure/cljs/build/api.clj index d8cbd99667..efb0de14bd 100644 --- a/src/main/clojure/cljs/build/api.clj +++ b/src/main/clojure/cljs/build/api.clj @@ -204,8 +204,8 @@ (env/default-compiler-env opts)))) ([source opts compiler-env] (doseq [[unknown-opt suggested-opt] (util/unknown-opts (set (keys opts)) closure/known-opts)] - (println (str "WARNING: Unknown compiler option '" unknown-opt "'." - (when suggested-opt (str " Did you mean '" suggested-opt "'?"))))) + (when suggested-opt + (println (str "WARNING: Unknown compiler option '" unknown-opt "'. Did you mean '" suggested-opt "'?")))) (binding [ana/*cljs-warning-handlers* (:warning-handlers opts ana/*cljs-warning-handlers*)] (closure/build source opts compiler-env)))) diff --git a/src/main/clojure/cljs/repl.cljc b/src/main/clojure/cljs/repl.cljc index ee8dca22f1..ecffd9abfe 100644 --- a/src/main/clojure/cljs/repl.cljc +++ b/src/main/clojure/cljs/repl.cljc @@ -780,8 +780,8 @@ bind-err true} :as opts}] (doseq [[unknown-opt suggested-opt] (util/unknown-opts (set (keys opts)) (set/union known-repl-opts cljsc/known-opts))] - (println (str "WARNING: Unknown option '" unknown-opt "'." - (when suggested-opt (str " Did you mean '" suggested-opt "'?"))))) + (when suggested-opt + (println (str "WARNING: Unknown option '" unknown-opt "'. Did you mean '" suggested-opt "'?")))) (let [repl-opts (-repl-options repl-env) repl-requires (into repl-requires (:repl-requires repl-opts)) {:keys [analyze-path repl-verbose warn-on-undeclared special-fns static-fns] :as opts