Skip to content

ESLint plugin ensuring best practices and code quality for Prisma with TypeScript

Notifications You must be signed in to change notification settings

lucas-gregoire/eslint-plugin-prisma

Repository files navigation

eslint-plugin-prisma

ESLint plugin ensuring best practices and code quality for Prisma with TypeScript

Overview

This ESLint plugin is designed to help developers maintain best practices and enforce code quality when using Prisma in TypeScript projects. It includes a set of custom rules tailored to the specific requirements and idioms of Prisma, aiming to prevent common pitfalls and encourage efficient, clean, and secure database interactions.

Installation

You'll first need to install ESLint:

npm install eslint --save-dev

Next, install eslint-plugin-prisma:

npm install eslint-plugin-prisma --save-dev

Usage

Load the recommended configuration:

{
  "extends": ["plugin:eslint-plugin-prisma/recommended"]
}

Add prisma to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix. Then configure the rules you want to use under the rules section:

{
  "plugins": ["prisma"],
  "rules": {
    "prisma/no-unsafe": "error",
    "prisma/require-select": "error"
  }
}

Configurations

Name
recommended

Rules

💼 Configurations enabled in.
✅ Set in the recommended configuration.
💡 Manually fixable by editor suggestions.

Name Description 💼 💡
no-unsafe Disallow the use of potentially unsafe Prisma methods
require-select Forces explicit selection of all fields in Prisma queries 💡

About

ESLint plugin ensuring best practices and code quality for Prisma with TypeScript

Resources

Stars

Watchers

Forks

Packages

No packages published