Registry / database / prisma-lint

prisma-lint

JSON →
library0.13.1jsnpmunverified

A linter for Prisma schema files, currently at v0.13.1. It provides a configurable set of rules (e.g., naming conventions, field order, index requirements) similar to ESLint, all disabled by default. Supports Prisma 7+ config files (prisma.config.ts) and legacy package.json schema path. Uses ignore comments (/// prisma-lint-ignore-model, /// prisma-lint-ignore-field) and multiple output formats (simple, contextual). Released frequently with new rules and fixes. Differentiates from other Prisma tools by focusing purely on linting schema files, not migrations or querying.

npm install prisma-lint
INSTALL
IMPORT
SIG · PRISMA-LINT
P
prisma-lint
databasejavascriptv0.13.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import prismaLint from 'prisma-lint'
const prismaLint = require('prisma-lint')
The package is primarily used as a CLI tool (npx prisma-lint), but the programmatic API is available via ESM default export.
lint
import { lint } from 'prisma-lint'
const { lint } = require('prisma-lint')
Named export for programmatic linting. Available since v0.10.0. For older versions, use default export.
LoadConfigOptions
import type { LoadConfigOptions } from 'prisma-lint'
import { LoadConfigOptions } from 'prisma-lint'
TypeScript users should use `import type` for type-only imports to avoid runtime errors.

Programmatic usage: lint a Prisma schema with custom rules and output results as JSON.

import { lint } from 'prisma-lint'; async function main() { const results = await lint({ schemaPath: 'prisma/schema.prisma', config: { rules: { 'model-name-camel-case': 'error', 'field-name-camel-case': ['error', { allowUnderscore: false }], }, }, }); console.log(JSON.stringify(results, null, 2)); } main().catch(console.error);
prisma-lint --version
Debug
Known issues
breakingSchema path resolution changed in v0.13.0. Prisma 7+ config files (prisma.config.ts or .config/prisma.ts) are now preferred over package.json#prisma.schema.
fix
If you use Prisma 7+, migrate your schema path to prisma.config.ts. If you rely on package.json#prisma.schema, ensure no conflicting Prisma 7 config exists.
affects: >=0.13.0
deprecatedRule `enum-value-snake-case` is deprecated in v0.11.0 in favor of `enum-value-case`.
fix
Replace `enum-value-snake-case` with `enum-value-case` and configure `case: 'lower'` (or adjust as needed).
affects: >=0.11.0
gotchaAll rules are disabled by default. You must create a configuration file (e.g., .prismalintrc.json) to enable rules.
fix
Create a .prismalintrc.json file with a "rules" object listing the rules you want to enable and their severity.
affects: >=0.1.0
gotchaIgnore comments require exactly three slashes (///). Two slashes (//) or four slashes (////) are ignored.
fix
Use /// prisma-lint-ignore-model or /// prisma-lint-ignore-field with exactly three slashes.
affects: >=0.9.0
gotchaThe `compoundWords` option in snake-case rules is case-sensitive. Wrong case causes false positives.
fix
Ensure compound words match the exact casing used in your schema (e.g., 'S3' not 's3').
affects: >=0.10.0
Errors
Common errors & fixes
Error: Cannot find module 'prisma-lint'
prisma-lint not installed or installed globally instead of locally.
fix
Install as dev dependency: npm install --save-dev prisma-lint
Error: No configuration found for prisma-lint
Missing .prismalintrc.json or similar config file.
fix
Create a configuration file (e.g., .prismalintrc.json) with a "rules" field.
Error: Unknown rule 'model-name-camel-case'
Rule name is misspelled or does not exist.
fix
Check the RULES.md file for valid rule names. Common rules: 'model-name-camel-case', 'field-name-camel-case'.
Error: Failed to load schema from 'prisma/schema.prisma'
Schema file does not exist or path is incorrect.
fix
Verify the schema path. Provide explicit path via CLI argument or configure in prisma.config.ts / package.json#prisma.schema.
Upgrade
Version history
0.13.1latest on npm
Audit
Dependencies
cosmiconfigrequiredLoads configuration files (e.g., .prismalintrc.json, YAML, JS).
prismarequiredUses Prisma's internal schema parser to analyze the AST.
Agent activity
4 hits · last 30 days
node
4
Resources
prisma-lint — npm install prisma-lint · libregistry