# require-is-empty-with-length

Require isEmpty alongside a length accessor

A visible `length` property without `isEmpty` makes callers derive a common collection predicate themselves.
Instead, you SHOULD provide `isEmpty` in the same static or instance namespace.

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

## Reported

```ds title="main.ds"
interface Sequence {
    get length(): isize;
}
```

## Accepted

```ds title="main.ds"
interface Sequence {
    get length(): isize;
    get isEmpty(): boolean;
}
```

## Prior art

- [Clippy · len_without_is_empty](https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty)

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