{"id":20085,"library":"gulp-plugin-prettier","title":"gulp-plugin-prettier","description":"A Gulp plugin that formats code using Prettier with support for custom Prettier options, config file resolution, and flexible error/warning reporting. Version 2.1.0 is the latest stable release (last updated 2020). It requires Gulp 3.9+ or 4.0+ and Prettier 1.4+ / 2.x / 3.x. Unlike alternative Gulp Prettier plugins, it offers a clean API with TypeScript types and a choice of reporters (warning, error, none) or a custom reporter callback. It also supports filtering formatted files and respects .prettierrc configuration. The package is minimal and focuses on a single function (format) with consistent options.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/ikatyang/gulp-plugin-prettier","tags":["javascript","gulp","gulpplugin","prettier","typescript"],"install":[{"cmd":"npm install gulp-plugin-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-plugin-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-plugin-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for the plugin to work","package":"gulp","optional":false},{"reason":"peer dependency – the actual formatter used to format files","package":"prettier","optional":false}],"imports":[{"note":"TypeScript users: import as named export. In CJS, use destructured require. Default export is not available.","wrong":"const format = require('gulp-plugin-prettier').format","symbol":"format","correct":"import { format } from 'gulp-plugin-prettier'"},{"note":"Available as named export for TypeScript; for plain JS use string literals like 'error'.","wrong":"const { Reporter } = require('gulp-plugin-prettier')","symbol":"Reporter","correct":"import { Reporter } from 'gulp-plugin-prettier'"},{"note":"This package does not have a default export. Use namespace import or named imports.","wrong":"import prettier from 'gulp-plugin-prettier'","symbol":"default","correct":"import * as prettier from 'gulp-plugin-prettier'"}],"quickstart":{"code":"const gulp = require('gulp');\nconst { format, Reporter } = require('gulp-plugin-prettier');\n\nfunction formatTask() {\n  return gulp.src(['./src/**/*.js'])\n    .pipe(format({ singleQuote: true }, { reporter: Reporter.Error }))\n    .pipe(gulp.dest('./dist'));\n}\n\nexports.format = formatTask;","lang":"javascript","description":"Shows how to use format with Error reporter to fail on unformatted files, and pipe to destination."},"warnings":[{"fix":"Use prettier.Reporter.Error instead of 'error'.","message":"The 'reporter' option as a string is deprecated; use Reporter enum or 'none'/'warning'/'error'.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Avoid combining filter: true with reporter: Error.","message":"Can't use 'filter' option when using Reporter.Error because filter may skip files and error reporter expects to check all.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Run npm install --save-dev @types/prettier","message":"TypeScript users need to install @types/prettier separately for full type safety.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import { format } from 'gulp-plugin-prettier'","cause":"Using default import instead of named import in TypeScript/ESM","error":"TypeError: prettier.format is not a function"},{"fix":"npm install --save-dev gulp-plugin-prettier gulp prettier","cause":"Package not installed or installed as dev dependency but missing peer dependencies","error":"Cannot find module 'gulp-plugin-prettier'"},{"fix":"Use Reporter enum or one of the allowed strings: 'none', 'warning', 'error'","cause":"Invalid reporter string passed","error":"Error: reporter must be one of 'none', 'warning', 'error' or a custom function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}