{"id":20088,"library":"gulp-prettier","title":"gulp-prettier","description":"A Gulp plugin to format files with Prettier. Current stable version is 6.0.0, released November 2023. This plugin integrates Prettier into Gulp build pipelines, allowing automatic code formatting during development or as a CI check via `prettier.check()`. Key differentiators: simple API mirroring Prettier's options, supports EditorConfig, and the `check` method for CI validation. Since v6.0.0, it is pure ESM and requires Node 18. Prior v5.0.0 upgraded Prettier to v3.0.0. It is a direct replacement for manually calling Prettier in Gulp tasks.","status":"active","version":"6.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/thomasvantuycom/gulp-prettier","tags":["javascript","gulp","prettier","gulp-prettier","gulpplugin"],"install":[{"cmd":"npm install gulp-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for formatting; must be installed separately.","package":"prettier","optional":true}],"imports":[{"note":"ESM-only since v6.0.0; require() will fail.","wrong":"const prettier = require('gulp-prettier')","symbol":"default export (plugin function)","correct":"import prettier from 'gulp-prettier'"},{"note":"If you need the options type from Prettier, import from 'prettier' directly.","symbol":"type imports (TypeScript)","correct":"import type { PrettierOptions } from 'gulp-prettier'"},{"note":"In v6, this package is ESM-only. Use dynamic import or set \"type\": \"module\" in package.json.","wrong":"const prettier = require('gulp-prettier');","symbol":"CommonJS workaround","correct":"import prettier from 'gulp-prettier'; // within an ES module"}],"quickstart":{"code":"import gulp from 'gulp';\nimport prettier from 'gulp-prettier';\n\nexport function format() {\n  return gulp.src('src/**/*.js')\n    .pipe(prettier({ singleQuote: true, trailingComma: 'all' }))\n    .pipe(gulp.dest('dist'));\n}\n\nexport function check() {\n  return gulp.src('dist/**/*.js')\n    .pipe(prettier.check({ singleQuote: true }));\n}","lang":"typescript","description":"Defines two Gulp tasks: 'format' to format JavaScript files using Prettier with options, and 'check' to validate formatting in CI."},"warnings":[{"fix":"Switch to ESM imports (import prettier from 'gulp-prettier') and ensure Node >=18.","message":"v6.0.0 moved to pure ESM and requires Node >=18. CommonJS require() no longer works.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Review Prettier v3 changelog for option changes; update your Prettier options accordingly.","message":"v5.0.0 upgraded Prettier to v3.0.0, which has breaking changes in its API and options.","severity":"breaking","affected_versions":">=5.0.0 <6.0.0"},{"fix":"Upgrade Node to >=12 (or later).","message":"v4.0.0 dropped Node 10 support.","severity":"breaking","affected_versions":">=4.0.0 <5.0.0"},{"fix":"Use Node >=10 and update Prettier options for v2 changes.","message":"v3.0.0 dropped Node 4,6,8 and upgraded Prettier to v2.0.0.","severity":"breaking","affected_versions":">=3.0.0 <4.0.0"},{"fix":"Wrap in try/catch or use separate CI-only task.","message":"The 'check' method throws an error if files are not formatted, which can break Gulp watch tasks. Use it only in CI or as a final validation step.","severity":"gotcha","affected_versions":">=2.1.0"},{"fix":"Consult Prettier documentation for valid options; use .prettierrc file to share config.","message":"Options like 'singleQuote' and 'trailingComma' are part of Prettier's options and may change in future Prettier versions.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Switch to import statement: import prettier from 'gulp-prettier'; or use dynamic import().","cause":"Using CommonJS require() on a package that is pure ESM (v6+).","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported."},{"fix":"Run: npm install gulp-prettier --save-dev","cause":"gulp-prettier not installed or not in node_modules.","error":"Error: Cannot find module 'gulp-prettier'"},{"fix":"Use: import prettier from 'gulp-prettier';","cause":"Incorrect import pattern; importing default incorrectly.","error":"TypeError: prettier is not a function"},{"fix":"Ensure src pattern is correct and files exist.","cause":"glob pattern in gulp.src() matches no files.","error":"Error: No files matched pattern: ... (or similar Gulp error)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}