package
Gulp plugin to format code with Prettier
npm install gulp-plugin-prettierGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Gulp plugin to format code with Prettier
# using npm
npm install --save-dev gulp-plugin-prettier gulp prettier
# using yarn
yarn add --dev gulp-plugin-prettier gulp prettierNOTE: For TypeScript user, you have to install @types/prettier to get full types.
(gulpfile.ts)
import * as gulp from 'gulp';
import * as prettier from 'gulp-plugin-prettier';
// replace unformatted with formatted
function format() {
return gulp.src(['./src/**/*.ts', './gulpfile.ts'])
.pipe(prettier.format({ singleQuote: true }))
.pipe(gulp.dest(file => file.base));
}
// throw error if there is unformatted file
function format_check() {
return gulp.src(['./src/**/*.ts', './gulpfile.ts'])
.pipe
(gulpfile.js)
const gulp = require('gulp');
const prettier = require('gulp-plugin-prettier');
// replace unformatted with formatted
function format() {
return gulp.src(['./src/**/*.js', './gulpfile.js'])
.pipe(prettier.format({ singleQuote: true }))
.pipe(gulp.dest(file => file.base));
}
// throw error if there is unformatted file
function format_check() {
return gulp.src(['./src/**/*.js', './gulpfile.js'])
.pipe
export function format(prettier_options?: PrettierOptions, plugin_options?: PluginOptions): stream.Transform;
export interface PluginOptions {
/**
* default: 'warning'
* report the filenames of files that are different from Prettier formatting
*/
reporter?: Reporter | CustomReporter;
/**
* default: false
* omit formatted files
*/
filter?: boolean;
/**
* default: true
* include rules from Prettier config files, e.g. .prettierrc
*/
configFile?: boolean;
}
# lint
yarn run lint
# format
yarn run format
# build
yarn run build
# test
yarn run testMIT © Ika
Estimated unpacked size across 18 packages.
712.9 kB
Includes dependencies.
5 direct · 4 outdated
^2.2.0
3.0.1
^2.0.3
5.0.12
^1.3.3
2.0.0
^4.1.1
4.1.3
^1.0.1
2.0.1