feat: add missing_returning plugin to enforce return value on database operations

This commit is contained in:
Marco Pedone 2026-03-05 10:28:31 +01:00
parent c423a7bdb7
commit 728ba71c84
2 changed files with 14 additions and 1 deletions

View file

@ -125,7 +125,8 @@
"plugins": [ "plugins": [
"biome_plugins/missing_select.grit", "biome_plugins/missing_select.grit",
"biome_plugins/missing_where.grit", "biome_plugins/missing_where.grit",
"biome_plugins/null.grit" "biome_plugins/null.grit",
"biome_plugins/missing_returning.grit"
], ],
"vcs": { "vcs": {
"clientKind": "git", "clientKind": "git",

View file

@ -0,0 +1,12 @@
language js(typescript)
`$chain.$exec()` where {
$exec <: `executeTakeFirstOrThrow`,
or {
$chain <: contains `deleteFrom`,
$chain <: contains `updateTable`,
$chain <: contains `insertInto`
},
! or { $chain <: contains `returning`, $chain <: contains `returningAll` },
register_diagnostic(span=$chain, message="insert, update or delete statements must return a value on executeTakeFirstOrThrow", severity="error")
}