Added eslint fot drizzle
This commit is contained in:
@@ -2,6 +2,7 @@ import { FlatCompat } from "@eslint/eslintrc"
|
|||||||
import js from "@eslint/js"
|
import js from "@eslint/js"
|
||||||
import typescriptEslint from "@typescript-eslint/eslint-plugin"
|
import typescriptEslint from "@typescript-eslint/eslint-plugin"
|
||||||
import tsParser from "@typescript-eslint/parser"
|
import tsParser from "@typescript-eslint/parser"
|
||||||
|
import drizzle from "eslint-plugin-drizzle"
|
||||||
import globals from "globals"
|
import globals from "globals"
|
||||||
import path from "node:path"
|
import path from "node:path"
|
||||||
import { fileURLToPath } from "node:url"
|
import { fileURLToPath } from "node:url"
|
||||||
@@ -20,10 +21,11 @@ export default [
|
|||||||
{
|
{
|
||||||
ignores: ["**/node_modules", "**/dist", "**/dev"]
|
ignores: ["**/node_modules", "**/dist", "**/dev"]
|
||||||
},
|
},
|
||||||
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
|
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:drizzle/all"),
|
||||||
{
|
{
|
||||||
plugins: {
|
plugins: {
|
||||||
"@typescript-eslint": typescriptEslint
|
"@typescript-eslint": typescriptEslint,
|
||||||
|
"drizzle": drizzle
|
||||||
},
|
},
|
||||||
|
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
@@ -87,6 +89,12 @@ export default [
|
|||||||
"ts-ignore": "allow-with-description",
|
"ts-ignore": "allow-with-description",
|
||||||
"ts-nocheck": "allow-with-description",
|
"ts-nocheck": "allow-with-description",
|
||||||
"ts-check": "allow-with-description"
|
"ts-check": "allow-with-description"
|
||||||
|
}],
|
||||||
|
"drizzle/enforce-delete-with-where": ["error", {
|
||||||
|
"drizzleObjectName": ["db"]
|
||||||
|
}],
|
||||||
|
"drizzle/enforce-update-with-where": ["error", {
|
||||||
|
"drizzleObjectName": ["db"]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
"dprint": "^0.47.2",
|
"dprint": "^0.47.2",
|
||||||
"drizzle-kit": "^0.24.2",
|
"drizzle-kit": "^0.24.2",
|
||||||
"eslint": "^9.11.1",
|
"eslint": "^9.11.1",
|
||||||
|
"eslint-plugin-drizzle": "^0.2.3",
|
||||||
"globals": "^15.9.0",
|
"globals": "^15.9.0",
|
||||||
"sqlite3": "^5.1.7",
|
"sqlite3": "^5.1.7",
|
||||||
"tsx": "^4.19.1",
|
"tsx": "^4.19.1",
|
||||||
|
|||||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -104,6 +104,9 @@ importers:
|
|||||||
eslint:
|
eslint:
|
||||||
specifier: ^9.11.1
|
specifier: ^9.11.1
|
||||||
version: 9.11.1
|
version: 9.11.1
|
||||||
|
eslint-plugin-drizzle:
|
||||||
|
specifier: ^0.2.3
|
||||||
|
version: 0.2.3(eslint@9.11.1)
|
||||||
globals:
|
globals:
|
||||||
specifier: ^15.9.0
|
specifier: ^15.9.0
|
||||||
version: 15.9.0
|
version: 15.9.0
|
||||||
@@ -1466,6 +1469,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
|
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
|
eslint-plugin-drizzle@0.2.3:
|
||||||
|
resolution: {integrity: sha512-BO+ymHo33IUNoJlC0rbd7HP9EwwpW4VIp49R/tWQF/d2E1K2kgTf0tCXT0v9MSiBr6gGR1LtPwMLapTKEWSg9A==}
|
||||||
|
peerDependencies:
|
||||||
|
eslint: '>=8.0.0'
|
||||||
|
|
||||||
eslint-scope@8.0.2:
|
eslint-scope@8.0.2:
|
||||||
resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==}
|
resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
@@ -3927,6 +3935,10 @@ snapshots:
|
|||||||
|
|
||||||
escape-string-regexp@5.0.0: {}
|
escape-string-regexp@5.0.0: {}
|
||||||
|
|
||||||
|
eslint-plugin-drizzle@0.2.3(eslint@9.11.1):
|
||||||
|
dependencies:
|
||||||
|
eslint: 9.11.1
|
||||||
|
|
||||||
eslint-scope@8.0.2:
|
eslint-scope@8.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
esrecurse: 4.3.0
|
esrecurse: 4.3.0
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { embedColor } from "config/options.js"
|
import { embedColor } from "config/options.js"
|
||||||
import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js"
|
import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js"
|
||||||
|
import { eq } from "drizzle-orm"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
import db from "src/db/db.js"
|
import db from "src/db/db.js"
|
||||||
import { settings } from "src/db/schema.js"
|
import { settings } from "src/db/schema.js"
|
||||||
@@ -56,7 +57,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
await db.update(settings).set({
|
await db.update(settings).set({
|
||||||
value: value
|
value: value
|
||||||
})
|
}).where(eq(settings.name, setting))
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
Reference in New Issue
Block a user