🚀. Socket Launch Week Day 3:Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions.Learn more
Sign In

@prisma-next/eslint-plugin

Package Overview
Dependencies
Maintainers
4
Versions
415
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma-next/eslint-plugin

ESLint plugin for Prisma Next query builder type checking and linting

latest
npmnpm
Version
0.2.0
Version published
Weekly downloads
512
28.32%
Maintainers
4
Weekly downloads
 
Created
Source

@prisma-next/eslint-plugin

ESLint plugin for Prisma Next query builder that provides TypeScript-powered linting and validation of query builder build() calls.

Installation

npm install --save-dev @prisma-next/eslint-plugin @typescript-eslint/parser

Configuration

ESLint 9 (Flat Config)

Add to your ESLint configuration:

// eslint.config.js
import prismaNext from '@prisma-next/eslint-plugin';

export default [
  {
    files: ['**/*.ts', '**/*.tsx'],
    languageOptions: {
      parser: '@typescript-eslint/parser',
      parserOptions: {
        project: './tsconfig.json',
      },
    },
    plugins: {
      '@prisma-next': prismaNext,
    },
    rules: {
      '@prisma-next/lint-build-call': 'error',
    },
  },
];

Or use the recommended flat configuration:

// eslint.config.js
import prismaNext from '@prisma-next/eslint-plugin';

export default [
  prismaNext.configs['flat/recommended'],
];

ESLint 8 (Legacy Configuration)

{
  "plugins": ["@prisma-next"],
  "rules": {
    "@prisma-next/lint-build-call": "error"
  }
}

Rules

lint-build-call

Validates query builder build() calls using TypeScript type information to catch common issues and enforce best practices.

What it checks

  • Unbounded Queries: Detects SELECT queries without .limit() calls that could fetch unlimited rows
  • Excessive Limits: Warns when .limit() exceeds a configurable maximum value

Options

{
  // Enforce limit() calls on SELECT queries (default: true)
  requireLimit?: boolean;
  
  // Maximum allowed limit value (default: 1000)  
  maxLimit?: number;
}

Examples

Incorrect - Unbounded query:

const plan = sql
  .from(userTable)
  .select({
    id: userTable.columns.id,
    email: userTable.columns.email,
  })
  .build(); // Error: unbounded query

Correct - Bounded query:

const plan = sql
  .from(userTable)
  .select({
    id: userTable.columns.id,
    email: userTable.columns.email,
  })
  .limit(100)
  .build(); // OK

Configuration Examples

Basic usage:

{
  '@prisma-next/lint-build-call': 'error'
}

Custom configuration:

{
  '@prisma-next/lint-build-call': [
    'error', 
    {
      requireLimit: true,
      maxLimit: 500,
    }
  ]
}

Disable limit requirement:

{
  '@prisma-next/lint-build-call': [
    'error',
    {
      requireLimit: false
    }
  ]
}

TypeScript Integration

This plugin leverages TypeScript's type checker to provide accurate analysis of query builder calls. For best results:

  • Ensure @typescript-eslint/parser is configured
  • Include project in parser options pointing to your tsconfig.json
  • Run ESLint on TypeScript files (.ts, .tsx)

Contributing

This plugin is part of the Prisma Next project. See the main repository for contribution guidelines.

License

See the main Prisma Next repository for license information.

Keywords

eslint

FAQs

Package last updated on 02 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts