PrismaP
Prisma2y ago
6 replies
aith

Setting up SafeQL for Prisma

I need help in setting up SafeQL for Prisma. I can't correctly configure my eslint.config and tsconfig. This is my eslint.config.mjs right now:
import tseslint from 'typescript-eslint';
import safeql from '@ts-safeql/eslint-plugin/config';

/** @type {import('eslint').Linter.Config} */
export default tseslint.config({
    plugins: {
        '@ts-safeql/eslint-plugin': safeql,
    },
    rules: {
        '@ts-safeql/eslint-plugin': [
            'error',
            {
                connections: [
                    {
                        // 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 the following:
Oops! Something went wrong! :(

ESLint: 9.4.0

TypeError: Key "rules": Key "@ts-safeql/eslint": Could not find plugin "@ts-safeql".
Was this page helpful?