{"id":20405,"library":"prettier-plugin-prisma","title":"prettier-plugin-prisma","description":"Prettier plugin for formatting Prisma schema files (.prisma). Current stable version is 5.0.0, released Dec 2023. It uses the official Prisma schema formatter WASM binary (@prisma/prisma-schema-wasm) to ensure formatting matches Prisma CLI output. The plugin auto-detects .prisma files and integrates seamlessly with Prettier. It requires Prettier >=2 or >=3 and Node >=14. Active development tracks Prisma releases closely, with frequent bumps to the underlying Prisma formatting engine.","status":"active","version":"5.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/umidbekk/prettier-plugin-prisma","tags":["javascript","prettier-plugin","prisma"],"install":[{"cmd":"npm install prettier-plugin-prisma","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-prisma","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-prisma","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin requires Prettier >=2 or >=3 to function.","package":"prettier","optional":false},{"reason":"Core formatting logic; Wasm binary compiled from Prisma's official formatter.","package":"@prisma/prisma-schema-wasm","optional":false}],"imports":[{"note":"No explicit import needed; Prettier discovers the plugin automatically when installed. Also works with `prettier --plugin prettier-plugin-prisma`.","wrong":"// Adding to plugins array without installing the package","symbol":"default (plugin)","correct":"// In .prettierrc: { \"plugins\": [\"prettier-plugin-prisma\"] }"},{"note":"The plugin is CommonJS-compatible; require directly returns the plugin object.","wrong":"const prettierPluginPrisma = require('prettier-plugin-prisma').default;","symbol":"default (CommonJS require for programmatic use)","correct":"const prettierPluginPrisma = require('prettier-plugin-prisma');"},{"note":"ESM import works; the package has a 'default' export. TypeScript users may need `esModuleInterop`.","wrong":"import * as prettierPluginPrisma from 'prettier-plugin-prisma';","symbol":"default (ESM import for programmatic use)","correct":"import prettierPluginPrisma from 'prettier-plugin-prisma';"},{"note":"PluginOptions is a type-only export; use `import type` to avoid runtime errors.","wrong":"import { PluginOptions } from 'prettier-plugin-prisma';","symbol":"PluginOptions (TypeScript type)","correct":"import type { PluginOptions } from 'prettier-plugin-prisma';"}],"quickstart":{"code":"// 1. Install\nnpm i -D prettier prettier-plugin-prisma\n\n// 2. In .prettierrc (JSON or YAML)\n{\n  \"plugins\": [\"prettier-plugin-prisma\"],\n  \"tabWidth\": 2,\n  \"printWidth\": 100\n}\n\n// 3. Create a Prisma file: schema.prisma\ngenerator client {\n  provider = \"prisma-client-js\"\n}\n\ndatasource db {\n  provider = \"postgresql\"\n  url      = env(\"DATABASE_URL\")\n}\n\nmodel User {\n  id        Int      @id @default(autoincrement())\n  email     String   @unique\n  name      String?\n  posts     Post[]\n  createdAt DateTime @default(now())\n  updatedAt DateTime @updatedAt\n}\n\nmodel Post {\n  id        Int      @id @default(autoincrement())\n  title     String\n  content   String?\n  author    User     @relation(fields: [authorId], references: [id])\n  authorId  Int\n  createdAt DateTime @default(now())\n}\n\n// 4. Run Prettier\nnpx prettier --write schema.prisma","lang":"typescript","description":"Demonstrates installing the plugin, configuring Prettier to use it, and formatting a .prisma schema file."},"warnings":[{"fix":"Review and commit any formatting changes after upgrading. No code changes required.","message":"v5.0.0 migrated from @prisma/prisma-fmt-wasm to @prisma/prisma-schema-wasm. The formatting output may differ slightly from previous versions.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use Prisma CLI (`prisma validate`) for schema validation.","message":"Plugin only formats .prisma files; it does not lint or validate Prisma schema syntax.","severity":"gotcha","affected_versions":">=0"},{"fix":"Ensure Node.js version supports WASM (>=14). If issues persist, report to the plugin's GitHub issues.","message":"The plugin relies on a WASM binary; may not work in all restricted environments (e.g., some serverless platforms) without Node.js WASM support.","severity":"gotcha","affected_versions":">=0"},{"fix":"Upgrade to v5.0.0 or later to use the new WASM package.","message":"v4.x and earlier used @prisma/prisma-fmt-wasm. That dependency is deprecated in v5.","severity":"deprecated","affected_versions":"<5.0.0"},{"fix":"Run `npm i -D prettier-plugin-prisma` inside your project.","message":"Installing the plugin globally may not work; prefer local install in project devDependencies.","severity":"gotcha","affected_versions":">=0"}],"env_vars":null,"search_vec":"'14':58 '2':53 '2023':20 '3':55 '5.0.0':17 'activ':59 'auto':41 'auto-detect':40 'binari':29 'bump':67 'cli':36 'close':64 'current':13 'dec':19 'detect':42 'develop':60 'engin':73 'ensur':32 'file':11,44 'format':8,33,72 'formatt':27 'frequent':66 'integr':46 'javascript':74 'match':34 'node':57 'offici':24 'output':37 'plugin':3,6,39,77 'prettier':2,5,49,52,76 'prettier-plugin':75 'prettier-plugin-prisma':1 'prisma':4,9,12,25,35,43,62,71,78 'prisma/prisma-schema-wasm':30 'releas':18,63 'requir':51 'schema':10,26 'seamless':47 'stabl':14 'track':61 'under':70 'use':22 'version':15 'wasm':28","created_at":"2026-04-25T11:22:56.250631+00:00","updated_at":"2026-04-25T11:22:56.250631+00:00","problems":[{"fix":"Run `npm install -D prettier-plugin-prisma` and ensure it's listed in package.json devDependencies.","cause":"Plugin not installed or Prettier cannot locate it.","error":"Cannot find module 'prettier-plugin-prisma'"},{"fix":"Add `\"plugins\": [\"prettier-plugin-prisma\"]` to your .prettierrc file.","cause":"Prettier is not configured to use the plugin.","error":"Error: No plugin detected for \"*.prisma\" files."},{"fix":"Use `const prettierPluginPrisma = require('prettier-plugin-prisma');` without `.default`.","cause":"Using CommonJS require incorrectly when plugin exports a single default object.","error":"TypeError: prettierPluginPrisma.default is not a function"},{"fix":"Ensure Node.js >=14 and no CSP blocking WASM. Use `--no-wasm` or upgrade Node.js.","cause":"WASM binary failed to load, possibly due to Content Security Policy or unsupported Node version.","error":"Prettier failed to load plugin due to WebAssembly.instantiateStreaming"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/umidbekk/prettier-plugin-prisma","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/prettier-plugin-prisma","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","testing","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}