nursery/useDisposables
nursery · since 2.4.11
Unsafe autofix
biome.json
{
"linter": {
"rules": {
"nursery": {
"useDisposables": "error"
}
}
}
}Detects a disposable object assigned to a variable without using or await using syntax.
function createDisposable(): Disposable {
return {
[Symbol.dispose]() {
// do something
},
};
}
const disposable = createDisposable();class MyClass implements AsyncDisposable {
async [Symbol.asyncDispose]() {
// do something
}
}
const instance = new MyClass();function createDisposable(): Disposable {
return {
[Symbol.dispose]() {
// do something
},
};
}
using disposable = createDisposable();class MyClass implements AsyncDisposable {
async [Symbol.asyncDispose]() {
// do something
}
}
await using instance = new MyClass();Examples from the Biome documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
ESLint does not have this rule.
Oxlint does not have this rule.
nursery/useDisposables
nursery · since 2.4.11
{
"linter": {
"rules": {
"nursery": {
"useDisposables": "error"
}
}
}
}Require a valid deletion date on the @deprecated directive.
Enforces the use of with { type: "json" } for JSON module imports.
Enforce a consistent notation for the lightness of colors.
Enforce a consistent notation for font weights.
Prefer logical CSS properties over physical properties.