Skip to content

Commit

Permalink
CLJS-1603: Only warn for misspelled comp/REPL opts
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mfikes authored and dnolen committed Mar 21, 2016
1 parent 4681e47 commit 177b05f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/clojure/cljs/build/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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))))

Expand Down
4 changes: 2 additions & 2 deletions src/main/clojure/cljs/repl.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 177b05f

Please sign in to comment.