Lint rule · ADN0501

adorn/clause-below-validate

A clause decorator above @Validate() records after the install and is never enforced.

IdADN0501, the prefix of every message
recommendederror
stricterror
Fixableyes (--fix)
Needs type informationno: it also runs in an untyped config

What it reports

A @Requires, @Ensures, @Returns or @EnabledWhen written above @Validate() on the same method.

Why

Method decorators apply bottom up, so a clause above @Validate() records after @Validate() has installed the wrapper, and is never enforced. The runtime refuses it at declaration; the lint moves the clause for you.

Examples

Reported

reported by adorn/clause-below-validate
import { Ensures, GreaterThan, Validate, RelationContracts as R } from 'adorn';

class Counter {
    @Ensures(R.GreaterThan(R.Result(), 0))
    @Validate()
    next(@GreaterThan(0) n: number) { return n + 1; }
}

Accepted

accepted
import { Ensures, GreaterThan, Validate, RelationContracts as R } from 'adorn';

class Counter {
    @Validate()
    @Ensures(R.GreaterThan(R.Result(), 0))
    next(@GreaterThan(0) n: number) { return n + 1; }
}

Details

Class-level @Contract() runs after every member decorator, so its order never matters. A clause above a decorator that is not adorn's Validate is not reported.

To keep a finding on purpose, disable it with a reason, which justify-opt-out checks: // eslint-disable-next-line adorn/clause-below-validate -- <why>.

Messages

The text ESLint prints, read from the rule itself. {{…}} is filled in for each finding.

Message idText
above[ADN0501] @{{clause}} sits above @Validate(): it records after @Validate() installs, so it is never enforced. Move it below @Validate(), or use class-level @Contract().

All rules · the adorn/eslint guide