{"id":20087,"library":"gulp-prettier-plugin","title":"gulp-prettier-plugin","description":"Gulp plugin (v1.3.0, last release 2019) to format source code with Prettier. Requires Prettier >=1.x as a peer dependency. Key differentiator: supports filter mode (only emit files needing formatting) and validate mode (fail CI if files unformatted). Alternative to gulp-prettier with more granular control. Ships TypeScript definitions. Minimalist API with two optional config objects (prettier options and plugin options).","status":"maintenance","version":"1.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/GAumala/gulp-prettier-plugin","tags":["javascript","gulpplugin","prettier","gulp","formatter","typescript"],"install":[{"cmd":"npm install gulp-prettier-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-prettier-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-prettier-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; actual formatting engine","package":"prettier","optional":false}],"imports":[{"note":"Default export is a function. TypeScript users can also use `import * as` but default import is recommended.","wrong":"import * as prettierPlugin from 'gulp-prettier-plugin'","symbol":"default","correct":"import prettierPlugin from 'gulp-prettier-plugin'"},{"note":"The package exports a single function, not a named export.","wrong":"const { prettierPlugin } = require('gulp-prettier-plugin')","symbol":"default (CJS)","correct":"const prettierPlugin = require('gulp-prettier-plugin')"},{"note":"Type-only import for TypeScript users; no runtime symbol.","symbol":"IPrettierPluginOptions","correct":"import type { IPrettierPluginOptions } from 'gulp-prettier-plugin'"}],"quickstart":{"code":"const gulp = require('gulp');\nconst prettierPlugin = require('gulp-prettier-plugin');\n\ngulp.task('prettier', () =>\n  gulp\n    .src(['./src/**/*.js', './gulpfile.js'])\n    .pipe(prettierPlugin({ singleQuote: true, trailingComma: 'all' }, { filter: true }))\n    .pipe(gulp.dest(file => file.base))\n);","lang":"javascript","description":"Gulp task that formats JS files in place, using filter to only rewrite files that need formatting."},"warnings":[{"fix":"Consider using gulp-prettier (v4+) or use prettier directly.","message":"Prettier v2+ has breaking changes; this plugin may not support all new options.","severity":"deprecated","affected_versions":">=1.3.0"},{"fix":"Set filter to false if you need to pipe output to other plugins (e.g., linter) for all files.","message":"pluginOptions.filter does not work correctly when piping to other gulp plugins after formatting, as it only emits changed files.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use `.pipe(gulp.dest(file => file.base))` instead of `.pipe(gulp.dest('./'))`.","message":"Must call gulp.dest with a function returning file.base to write in-place, otherwise files go to cwd.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Double-check Prettier option names and values.","message":"Prettier options are not validated; invalid options are silently ignored.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use default import: import prettierPlugin from 'gulp-prettier-plugin' or const prettierPlugin = require('gulp-prettier-plugin').","cause":"Using ES module import incorrectly (import * as).","error":"TypeError: prettierPlugin is not a function"},{"fix":"Run: npm install prettier --save-dev","cause":"Prettier not installed; it's a peer dependency.","error":"Error: Cannot find module 'prettier'"},{"fix":"Change .pipe(gulp.dest('./')) to .pipe(gulp.dest(file => file.base)).","cause":"Forgetting to pass function to gulp.dest.","error":"gulp-dest: No files written"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}