# prefer-expect-diagnostic

Prefer diagnostic expectations for local suppressions

A local `@allow` remains valid after the suppressed diagnostic disappears.
Instead, you SHOULD use `@expect` for an intentional diagnostic so its disappearance is reported.

- Category: style
- Level: warning
- Fix: suggestion
- Scope: module

## Reported

```ds title="main.ds"
@allow("constant-condition", { reason: "required sentinel branch" })
function ready(): boolean {
    if (true) {
        return true;
    }

    return false;
}
```

## Accepted

```ds title="main.ds"
@expect("constant-condition", { reason: "required sentinel branch" })
function ready(): boolean {
    if (true) {
        return true;
    }

    return false;
}
```

## Prior art

- [typescript-eslint · prefer-ts-expect-error](https://typescript-eslint.io/rules/prefer-ts-expect-error)

[language/linter/src/rules/style/prefer_expect_diagnostic.rs:7](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/style/prefer_expect_diagnostic.rs#L7)
