Skip to content

ggarciao/gulp-standard-bundle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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

About

Standard linter for gulp

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%