From c86f3a0ee12fe557aa3d55013231d798ada4772e Mon Sep 17 00:00:00 2001 From: Kevan Stannard Date: Sun, 9 May 2021 08:23:07 +1000 Subject: [PATCH 1/6] Syntax lookup: Deprecated decorator --- misc_docs/syntax/decorator_deprecated.mdx | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 misc_docs/syntax/decorator_deprecated.mdx diff --git a/misc_docs/syntax/decorator_deprecated.mdx b/misc_docs/syntax/decorator_deprecated.mdx new file mode 100644 index 000000000..f19dc5e2c --- /dev/null +++ b/misc_docs/syntax/decorator_deprecated.mdx @@ -0,0 +1,38 @@ +--- +id: "deprecated-decorator" +keywords: ["deprecated", "decorator"] +name: "@deprecated" +summary: "This is the `@deprecated` decorator." +category: "decorators" +--- + +The `@deprecated` decorator is used to annotate deprecated types and values. This may be used by ReScript tooling to highlight deprecated code during development. + +### Example + + + +```res +@deprecated +type person = {id: int, name: string} + +@deprecated +let customDouble = foo => foo * 2 + +@deprecated("Use SomeOther.customTriple instead") +let customTriple = foo => foo * 3 +``` + +```js +function customDouble(foo) { + return foo << 1; +} + +function customTriple(foo) { + return Math.imul(foo, 3); +} +``` + + + + From 54e7e92dbf33440f31439fda3680f7f1942ee96f Mon Sep 17 00:00:00 2001 From: Kevan Stannard Date: Sat, 15 May 2021 20:49:48 +1000 Subject: [PATCH 2/6] Separate module and expression deprecated decorators --- misc_docs/syntax/decorator_deprecated.mdx | 38 --------------- .../decorator_expression_deprecated.mdx | 47 +++++++++++++++++++ .../syntax/decorator_module_deprecated.mdx | 30 ++++++++++++ 3 files changed, 77 insertions(+), 38 deletions(-) delete mode 100644 misc_docs/syntax/decorator_deprecated.mdx create mode 100644 misc_docs/syntax/decorator_expression_deprecated.mdx create mode 100644 misc_docs/syntax/decorator_module_deprecated.mdx diff --git a/misc_docs/syntax/decorator_deprecated.mdx b/misc_docs/syntax/decorator_deprecated.mdx deleted file mode 100644 index f19dc5e2c..000000000 --- a/misc_docs/syntax/decorator_deprecated.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -id: "deprecated-decorator" -keywords: ["deprecated", "decorator"] -name: "@deprecated" -summary: "This is the `@deprecated` decorator." -category: "decorators" ---- - -The `@deprecated` decorator is used to annotate deprecated types and values. This may be used by ReScript tooling to highlight deprecated code during development. - -### Example - - - -```res -@deprecated -type person = {id: int, name: string} - -@deprecated -let customDouble = foo => foo * 2 - -@deprecated("Use SomeOther.customTriple instead") -let customTriple = foo => foo * 3 -``` - -```js -function customDouble(foo) { - return foo << 1; -} - -function customTriple(foo) { - return Math.imul(foo, 3); -} -``` - - - - diff --git a/misc_docs/syntax/decorator_expression_deprecated.mdx b/misc_docs/syntax/decorator_expression_deprecated.mdx new file mode 100644 index 000000000..d3334c19f --- /dev/null +++ b/misc_docs/syntax/decorator_expression_deprecated.mdx @@ -0,0 +1,47 @@ +--- +id: "scope-deprecated-decorator" +keywords: ["deprecated", "decorator"] +name: "@deprecated" +summary: "This is the `expression deprecation` decorator." +category: "decorators" +--- + +The `@deprecated` decorator is used to annotate deprecated types, values and modules within a file. This may be used by ReScript tooling to highlight deprecated code during development. + +See the `@@deprecated` decorator to deprecate whole file modules. + +### Examples + + + +```res +@deprecated +type person = {id: int, name: string} + +@deprecated +let customDouble = n => n * 2 + +@deprecated("Use OtherModule.customTriple instead") +let customTriple = n => n * 3 + +@deprecated("Use OtherModule instead") +module MyModule = { + type t +} +``` + +```js +function customDouble(n) { + return n << 1; +} + +function customTriple(n) { + return Math.imul(n, 3); +} + +var MyModule = {}; +``` + + + + diff --git a/misc_docs/syntax/decorator_module_deprecated.mdx b/misc_docs/syntax/decorator_module_deprecated.mdx new file mode 100644 index 000000000..172cf812e --- /dev/null +++ b/misc_docs/syntax/decorator_module_deprecated.mdx @@ -0,0 +1,30 @@ +--- +id: "module-deprecated-decorator" +keywords: ["deprecated", "decorator"] +name: "@@deprecated" +summary: "This is the `module deprecation` decorator." +category: "decorators" +--- + +The `@@deprecated` decorator is used to indicate that a whole module is deprecated. This may be used by ReScript tooling to highlight deprecated code during development. + +See the `@deprecated` decorator to deprecate expressions. + +### Examples + + + +```res +// Indicate whole module is deprecated +@@deprecated + +// Indicate whole module is deprecated, with a comment +@@deprecated("Use OtherModule instead") +``` + +```js +``` + + + + From 9e475dae47a60812160471b3c655c75183581cc7 Mon Sep 17 00:00:00 2001 From: Kevan Stannard Date: Sat, 15 May 2021 20:52:02 +1000 Subject: [PATCH 3/6] Tweak id --- misc_docs/syntax/decorator_expression_deprecated.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc_docs/syntax/decorator_expression_deprecated.mdx b/misc_docs/syntax/decorator_expression_deprecated.mdx index d3334c19f..ac594d883 100644 --- a/misc_docs/syntax/decorator_expression_deprecated.mdx +++ b/misc_docs/syntax/decorator_expression_deprecated.mdx @@ -1,5 +1,5 @@ --- -id: "scope-deprecated-decorator" +id: "expression-deprecated-decorator" keywords: ["deprecated", "decorator"] name: "@deprecated" summary: "This is the `expression deprecation` decorator." From 8218cc628490b02203ad2d5ca2ae92415672de89 Mon Sep 17 00:00:00 2001 From: Patrick Ecker Date: Sat, 15 May 2021 18:27:33 +0200 Subject: [PATCH 4/6] Apply suggestions from code review --- misc_docs/syntax/decorator_expression_deprecated.mdx | 7 +++---- misc_docs/syntax/decorator_module_deprecated.mdx | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/misc_docs/syntax/decorator_expression_deprecated.mdx b/misc_docs/syntax/decorator_expression_deprecated.mdx index ac594d883..b477d45a9 100644 --- a/misc_docs/syntax/decorator_expression_deprecated.mdx +++ b/misc_docs/syntax/decorator_expression_deprecated.mdx @@ -2,13 +2,13 @@ id: "expression-deprecated-decorator" keywords: ["deprecated", "decorator"] name: "@deprecated" -summary: "This is the `expression deprecation` decorator." +summary: "This is the `@deprecation` decorator." category: "decorators" --- -The `@deprecated` decorator is used to annotate deprecated types, values and modules within a file. This may be used by ReScript tooling to highlight deprecated code during development. +The `@deprecated` decorator is used to add deprecation notes to types, values and submodules. The compiler and editor tooling will yield a warning whenever a deprecated entity is being used. -See the `@@deprecated` decorator to deprecate whole file modules. +Use the `@@deprecated` decorator to add deprecation notes to a module. ### Examples @@ -44,4 +44,3 @@ var MyModule = {}; - diff --git a/misc_docs/syntax/decorator_module_deprecated.mdx b/misc_docs/syntax/decorator_module_deprecated.mdx index 172cf812e..fb71a4f79 100644 --- a/misc_docs/syntax/decorator_module_deprecated.mdx +++ b/misc_docs/syntax/decorator_module_deprecated.mdx @@ -2,13 +2,13 @@ id: "module-deprecated-decorator" keywords: ["deprecated", "decorator"] name: "@@deprecated" -summary: "This is the `module deprecation` decorator." +summary: "This is the `@@deprecation` decorator." category: "decorators" --- -The `@@deprecated` decorator is used to indicate that a whole module is deprecated. This may be used by ReScript tooling to highlight deprecated code during development. +The `@@deprecated` decorator is used to add a deprecation note to the file-level of a module. The compiler and editor tooling will yield a warning whenever a deprecated file module is being used. -See the `@deprecated` decorator to deprecate expressions. +Use the `@deprecated` decorator to deprecate specific types, values and submodules. ### Examples @@ -27,4 +27,3 @@ See the `@deprecated` decorator to deprecate expressions. - From 540a26ae10961141aa1bbad74591821fbcb7c4a5 Mon Sep 17 00:00:00 2001 From: Patrick Ecker Date: Sat, 15 May 2021 18:29:35 +0200 Subject: [PATCH 5/6] Apply suggestions from code review --- misc_docs/syntax/decorator_expression_deprecated.mdx | 3 +-- misc_docs/syntax/decorator_module_deprecated.mdx | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/misc_docs/syntax/decorator_expression_deprecated.mdx b/misc_docs/syntax/decorator_expression_deprecated.mdx index b477d45a9..b8d9e431a 100644 --- a/misc_docs/syntax/decorator_expression_deprecated.mdx +++ b/misc_docs/syntax/decorator_expression_deprecated.mdx @@ -8,7 +8,7 @@ category: "decorators" The `@deprecated` decorator is used to add deprecation notes to types, values and submodules. The compiler and editor tooling will yield a warning whenever a deprecated entity is being used. -Use the `@@deprecated` decorator to add deprecation notes to a module. +Alternatively, use the `@@deprecated` decorator to add a deprecation warning to the file level. ### Examples @@ -43,4 +43,3 @@ var MyModule = {}; ``` - diff --git a/misc_docs/syntax/decorator_module_deprecated.mdx b/misc_docs/syntax/decorator_module_deprecated.mdx index fb71a4f79..228edbf18 100644 --- a/misc_docs/syntax/decorator_module_deprecated.mdx +++ b/misc_docs/syntax/decorator_module_deprecated.mdx @@ -8,7 +8,7 @@ category: "decorators" The `@@deprecated` decorator is used to add a deprecation note to the file-level of a module. The compiler and editor tooling will yield a warning whenever a deprecated file module is being used. -Use the `@deprecated` decorator to deprecate specific types, values and submodules. +For more fine-grained control, use the `@deprecated` decorator to add deprecation warnings to specific types, values and submodules. ### Examples @@ -26,4 +26,3 @@ Use the `@deprecated` decorator to deprecate specific types, values and submodul ``` - From 0227742ee2e6b4f431756ae3e49d947c4e8c57f3 Mon Sep 17 00:00:00 2001 From: Kevan Stannard Date: Sun, 16 May 2021 07:59:19 +1000 Subject: [PATCH 6/6] Change deprecation to deprecated in summary --- misc_docs/syntax/decorator_expression_deprecated.mdx | 2 +- misc_docs/syntax/decorator_module_deprecated.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/misc_docs/syntax/decorator_expression_deprecated.mdx b/misc_docs/syntax/decorator_expression_deprecated.mdx index b8d9e431a..91f5b99e1 100644 --- a/misc_docs/syntax/decorator_expression_deprecated.mdx +++ b/misc_docs/syntax/decorator_expression_deprecated.mdx @@ -2,7 +2,7 @@ id: "expression-deprecated-decorator" keywords: ["deprecated", "decorator"] name: "@deprecated" -summary: "This is the `@deprecation` decorator." +summary: "This is the `@deprecated` decorator." category: "decorators" --- diff --git a/misc_docs/syntax/decorator_module_deprecated.mdx b/misc_docs/syntax/decorator_module_deprecated.mdx index 228edbf18..387a4b2cf 100644 --- a/misc_docs/syntax/decorator_module_deprecated.mdx +++ b/misc_docs/syntax/decorator_module_deprecated.mdx @@ -2,7 +2,7 @@ id: "module-deprecated-decorator" keywords: ["deprecated", "decorator"] name: "@@deprecated" -summary: "This is the `@@deprecation` decorator." +summary: "This is the `@@deprecated` decorator." category: "decorators" ---