aith
aith
PPrisma
Created by aith on 6/11/2024 in #help-and-questions
Setting up SafeQL for Prisma
But I get the errors when I run the npx eslint . command:
18:9 error 'query' is assigned a value but never used @typescript-eslint/no-unused-vars
18:56 error Invalid Query: relation "userrss" does not exist @ts-safeql/check-sql

✖ 2 problems (2 errors, 0 warnings)
18:9 error 'query' is assigned a value but never used @typescript-eslint/no-unused-vars
18:56 error Invalid Query: relation "userrss" does not exist @ts-safeql/check-sql

✖ 2 problems (2 errors, 0 warnings)
7 replies
PPrisma
Created by aith on 6/11/2024 in #help-and-questions
Setting up SafeQL for Prisma
Okay I got this to work. The error is showing up as well. However, is there a way to have it be that I get the errors displayed as I type (like how it is done in the example video of SafeQL)? Right now, I have to type the query and then run the command for it to show me the error.
7 replies
PPrisma
Created by aith on 6/11/2024 in #help-and-questions
Setting up SafeQL for Prisma
Nevermind, I just realised what I was doing lol. I didn't put @ts-safeql/check-sql under the rules.
7 replies
PPrisma
Created by aith on 6/11/2024 in #help-and-questions
Setting up SafeQL for Prisma
Hi. Yes, I have that installed. I also downgraded ESLint from v9 to v8 cause v9 was causing a lot of problems.
"@ts-safeql/eslint-plugin": "^3.3.1",
"@ts-safeql/eslint-plugin": "^3.3.1",
And this is my eslintrc.js
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
plugins: [
"@typescript-eslint",
"import",
"prettier",
"@ts-safeql/eslint-plugin",
],
parserOptions: {
project: "./tsconfig.json",
},
extends: [
"airbnb-typescript/base",
"prettier",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.eslint.json",
},
rules: {
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-shadow": "off",
},
"@ts-safeql/check-sql": [
"error",
{
connections: [
{
connectionUrl: process.env.DATABASE_URL,
// The migrations path:
migrationsDir: "./prisma/migrations",
targets: [
// This makes `prisma.$queryRaw` and `prisma.$executeRaw` commands linted
{ tag: "prisma.+($queryRaw|$executeRaw)", transform: "{type}[]" },
],
},
],
},
],
};
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
plugins: [
"@typescript-eslint",
"import",
"prettier",
"@ts-safeql/eslint-plugin",
],
parserOptions: {
project: "./tsconfig.json",
},
extends: [
"airbnb-typescript/base",
"prettier",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.eslint.json",
},
rules: {
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-shadow": "off",
},
"@ts-safeql/check-sql": [
"error",
{
connections: [
{
connectionUrl: process.env.DATABASE_URL,
// The migrations path:
migrationsDir: "./prisma/migrations",
targets: [
// This makes `prisma.$queryRaw` and `prisma.$executeRaw` commands linted
{ tag: "prisma.+($queryRaw|$executeRaw)", transform: "{type}[]" },
],
},
],
},
],
};
When I run npx eslint . I get this:
Oops! Something went wrong! :(

ESLint: 8.57.0

Error: ESLint configuration in .eslintrc.js is invalid:
- Unexpected top-level property "@ts-safeql/check-sql".
Oops! Something went wrong! :(

ESLint: 8.57.0

Error: ESLint configuration in .eslintrc.js is invalid:
- Unexpected top-level property "@ts-safeql/check-sql".
7 replies