Registry / devops / gulp-plugin-prettier

gulp-plugin-prettier

JSON →
library2.1.0jsnpmunverified

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.

npm install gulp-plugin-prettier
INSTALL
IMPORT
SIG · GULP-PLUGIN-PRETTI
G
gulp-plugin-prettier
devopsjavascriptv2.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

format
import { format } from 'gulp-plugin-prettier'
const format = require('gulp-plugin-prettier').format
TypeScript users: import as named export. In CJS, use destructured require. Default export is not available.
Reporter
import { Reporter } from 'gulp-plugin-prettier'
const { Reporter } = require('gulp-plugin-prettier')
Available as named export for TypeScript; for plain JS use string literals like 'error'.
default
import * as prettier from 'gulp-plugin-prettier'
import prettier from 'gulp-plugin-prettier'
This package does not have a default export. Use namespace import or named imports.

Shows how to use format with Error reporter to fail on unformatted files, and pipe to destination.

const gulp = require('gulp'); const { format, Reporter } = require('gulp-plugin-prettier'); function formatTask() { return gulp.src(['./src/**/*.js']) .pipe(format({ singleQuote: true }, { reporter: Reporter.Error })) .pipe(gulp.dest('./dist')); } exports.format = formatTask;
Debug
Known issues
deprecatedThe 'reporter' option as a string is deprecated; use Reporter enum or 'none'/'warning'/'error'.
fix
Use prettier.Reporter.Error instead of 'error'.
affects: >=2.0.0
gotchaCan't use 'filter' option when using Reporter.Error because filter may skip files and error reporter expects to check all.
fix
Avoid combining filter: true with reporter: Error.
affects: >=1.0.0
gotchaTypeScript users need to install @types/prettier separately for full type safety.
fix
Run npm install --save-dev @types/prettier
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: prettier.format is not a function
Using default import instead of named import in TypeScript/ESM
fix
Use import { format } from 'gulp-plugin-prettier'
Cannot find module 'gulp-plugin-prettier'
Package not installed or installed as dev dependency but missing peer dependencies
fix
npm install --save-dev gulp-plugin-prettier gulp prettier
Error: reporter must be one of 'none', 'warning', 'error' or a custom function
Invalid reporter string passed
fix
Use Reporter enum or one of the allowed strings: 'none', 'warning', 'error'
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
gulprequiredpeer dependency required for the plugin to work
prettierrequiredpeer dependency – the actual formatter used to format files
Agent activity
4 hits · last 30 days
node
4
Resources
gulp-plugin-prettier — npm install gulp-plugin-prettier · libregistry