gulp-standard-bundle

0.2.6 • Public • Published

gulp-standard-bundle

Linter for gulp that use the given standard instance (or use the supported one as default) and format the code with a given standard-format instance (or use the supported one as default)

NPM

Build Status Coverage Status bitHound Overall Score bitHound Dependencies bitHound Dev Dependencies bitHound Code

Information

Created to support the usage of standard and standard-format with gulp (fork of gulp-standard to include the formatter)

Usage

Install

$ npm install --save-dev gulp-standard-bundle

Linter examples (standard)

Using the 'default' standard version (check package dependencies)

var gulp = require('gulp')
var linter = require('gulp-standard-bundle').linter
 
gulp.task('lint', function () {
  return gulp.src(['./app.js'])
    .pipe(linter())
    .pipe(linter.reporter('default', {
      breakOnError: true
    }))
})

Using the 'default' standard version with options

var gulp = require('gulp')
var linteropts = { globals : ['identifier'] }
var linter = require('gulp-standard-bundle').linter
 
gulp.task('lint', function () {
  return gulp.src(['./app.js'])
    .pipe(linter(undefined, linteropts))
    .pipe(linter.reporter('default', {
      breakOnError: true
    }))
})

Using a given standard instance

var gulp = require('gulp')
var standard = require('standard')
var linter = require('gulp-standard-bundle').linter
 
gulp.task('lint', function () {
  return gulp.src(['./app.js'])
    .pipe(linter(standard))
    .pipe(linter.reporter('default', {
      breakOnError: true
    }))
})

Using a given standard instance with options

var gulp = require('gulp')
var standard = require('standard')
var linteropts = { globals : ['identifier'] }
var linter = require('gulp-standard-bundle').linter
 
gulp.task('lint', function () {
  return gulp.src(['./app.js'])
    .pipe(linter(standard, linteropts))
    .pipe(linter.reporter('default', {
      breakOnError: true
    }))
})

Formatter examples (standard-format)

Using the 'default' standard-format version (check package dependencies)

var gulp = require('gulp')
var formatter = require('gulp-standard-bundle').formatter
 
gulp.task('format', function () {
  return gulp.src(['./app.js'])
    .pipe(formatter())
    .pipe(formatter.reporter('default'))
})

Using a given standard-format instance

var gulp = require('gulp')
var standardformat = require('standard-format')
var formatter = require('gulp-standard-bundle').formatter
 
gulp.task('format', function () {
  return gulp.src(['./app.js'])
    .pipe(formatter(standardformat))
    .pipe(formatter.reporter('default'))
})

Reporters

Built-in

You can choose a reporter when you call

stuff
  .pipe(linter())
  .pipe(linter.reporter('default', opts))

Custom

You can also use some other reporter instance

var reporter = require(<REPORTER NAME>);
...
  .pipe(formatter())
  .pipe(formatter.reporter(reporter))

Or pass the reporter name ()

...
  .pipe(linter())
  .pipe(linter.reporter(<REPORTER NAME>, opts))

Linter Reporter options

breakOnError

Type: boolean Default: false

Emit gulp error on reported error

breakOnWarning

Type: boolean Default: false

Emit gulp error on reported warning

Formatter Reporter options

No options

LICENSE MIT

Package Sidebar

Install

npm i gulp-standard-bundle

Weekly Downloads

4

Version

0.2.6

License

MIT

Last publish

Collaborators

  • ggarciao