noDrizzleDeleteWithoutWhere
Цей контент ще не доступний вашою мовою.
Summary
Section titled “Summary”- Rule available since:
v2.4.8 - Diagnostic Category:
lint/nursery/noDrizzleDeleteWithoutWhere - This rule doesn’t have a fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noDrizzleDeleteWithoutWhere": "error" } } }}Description
Section titled “Description”Require .where() to be called when using .delete() with Drizzle ORM.
Without a .where() clause, a delete statement will delete all rows from the table.
This rule requires explicitly calling .where() to prevent accidental data loss.
Options
Section titled “Options”Use the drizzleObjectName option to specify the variable names that represent Drizzle
ORM instances.
{ "linter": { "rules": { "nursery": { "noDrizzleDeleteWithoutWhere": { "options": { "drizzleObjectName": [ "db" ] } } } } }}Examples
Section titled “Examples”Invalid
Section titled “Invalid”await db.delete(users);code-block.js:1:7 lint/nursery/noDrizzleDeleteWithoutWhere ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ .delete() is used without .where(). This will delete all rows in the table.
> 1 │ await db.delete(users);
│ ^^^^^^^^^^^^^^^^
2 │
ℹ Add a .where() clause to delete only the intended rows, or use .where(sql`1=1`) to explicitly delete all rows.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
await db.delete(users).where(eq(users.id, 1));Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.