diff --git a/doc/new-guidelines.md b/doc/new-guidelines.md index d4ec9c69d6..5a11fc6191 100644 --- a/doc/new-guidelines.md +++ b/doc/new-guidelines.md @@ -784,6 +784,28 @@ src └── view.cljs ``` +## Deprecation process + +To deprecate a var, add the `:deprecated` metadata and, if necessary, suggest an +alternative. + +```clojure +;; Good if there's no better alternative yet, but we want to deprecate it anyway. +(defn ^:deprecated foo + [] + (bar)) + +;; Good +(defn foo + {:deprecated "Use some.namespace/var-name instead."} + [] + (bar)) +``` + +Please check the [Clojure Style](https://guide.clojure.style/#deprecated) documentation + +To reduce visual clutter from deprecated methods in your text editor, consult this [example](https://rider-support.jetbrains.com/hc/en-us/community/posts/4419728641810-How-to-disable-the-the-strike-thru-for-deprecated-methods-in-Javascript-#:~:text=Try%20disabling%20%22Preferences%20%7C%20Editor%20%7C,It%20works%20for%20me). The approach can be adapted for settings in VSCode, Emacs, VIM, and others. + ### Test structure [Unit tests](#glossary) should be created alongside their respective source