Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax lookup: Warning decorator #350

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions misc_docs/syntax/decorator_expression_warning.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
id: "expression-warning-decorator"
keywords: ["warning", "decorator"]
name: "@warning"
summary: "This is the `@warning` decorator."
category: "decorators"
---

The `@warning` decorator is used to selectively enable or disable compiler warnings for _expressions_.

See the `@@warning` decorator to control warnings for _modules_.

### Example

<CodeTab labels={["ReScript", "JS Output"]}>

```res
// Disable warning 32 (unused value)
@warning("-32")
let result = Ok()
let result = Error()
```

```js
var result = {
TAG: /* Error */ 1,
_0: undefined,
};
```

</CodeTab>

### References

* [Build configuration warnings](/docs/manual/latest/build-configuration#warnings)
32 changes: 32 additions & 0 deletions misc_docs/syntax/decorator_module_warning.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
id: "module-warning-decorator"
keywords: ["warning", "decorator"]
name: "@@warning"
summary: "This is the `@@warning` decorator."
category: "decorators"
---

The `@@warning` decorator is used to selectively enable or disable compiler warnings for _modules_.

See the `@warning` decorator to control warnings for _expressions_.

### Example

<CodeTab labels={["ReScript", "JS Output"]}>

```res
// Disable warning 44
@@warning("-44")

// Enable warning 44 and disable warning 102
@@warning("+44-102")
```

```js
```

</CodeTab>

### References

* [Build configuration warnings](/docs/manual/latest/build-configuration#warnings)