# useDisposables

Rule `biome/useDisposables`. Detects a disposable object assigned to a variable without using or await using syntax.

- Source: biome
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1957 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/useDisposables` | no | unsafe | group nursery, since 2.4.11 | [docs](https://biomejs.dev/linter/rules/use-disposables/) |

## Code examples

### Incorrect: the rule reports this

```ts
function createDisposable(): Disposable {
  return {
    [Symbol.dispose]() {
      // do something
    },
  };
}

const disposable = createDisposable();
```

```ts
class MyClass implements AsyncDisposable {
  async [Symbol.asyncDispose]() {
    // do something
  }
}

const instance = new MyClass();
```

### Correct: the rule accepts this

```ts
function createDisposable(): Disposable {
  return {
    [Symbol.dispose]() {
      // do something
    },
  };
}

using disposable = createDisposable();
```

```ts
class MyClass implements AsyncDisposable {
  async [Symbol.asyncDispose]() {
    // do something
  }
}

await using instance = new MyClass();
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "useDisposables": "error"
      }
    }
  }
}
```

## Related rules

- [biome/useDeprecatedDate](https://lintradar.dev/rules/biome/useDeprecatedDate.md): Require a valid deletion date on the `@deprecated` directive.
- [biome/useJsonImportAttributes](https://lintradar.dev/rules/biome/useJsonImportAttributes.md): Enforces the use of `with { type: "json" }` for JSON module imports.
- [biome/useConsistentLightnessNotation](https://lintradar.dev/rules/biome/useConsistentLightnessNotation.md): Enforce a consistent notation for the lightness of colors.
- [biome/useLayeredStyles](https://lintradar.dev/rules/biome/useLayeredStyles.md): Enforce style rules to be defined within a cascade layer.
- [biome/useConsistentFontWeightNotation](https://lintradar.dev/rules/biome/useConsistentFontWeightNotation.md): Enforce a consistent notation for font weights.
- [biome/useLogicalProperties](https://lintradar.dev/rules/biome/useLogicalProperties.md): Prefer logical CSS properties over physical properties.

---

Web page: https://lintradar.dev/rules/biome/useDisposables. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
