npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-jscs-with-reporter

v1.4.0

Published

Check JavaScript code style with jscs

Downloads

14

Readme

gulp-jscs-with-reporter

gulp-jscs plugin, add reporter support.

Why

as of now, gulp-jscs can not support custom report like gulp-jshint

i need a custom report, like gulp-jshint-file-reporter and gulp-jshint-html-reporter

before offcial support that ( there are already a pull request and a issue about that, but as of now those are also waiting merge to master)

i need this feather , so i fork from gulp-jscs and add reporter support.

Install

$ npm install --save-dev gulp-jscs-with-reporter

Usage

you can use custorm reporter and jscs build-in reporter.

api: jscs.reporter(reporter, options)

use jscs build-in reporter

gulp.task('lint', function () {

  //jscs build-in reporters:
  // - checkstyle  xml format
  // - console  default, with color in terminal
  // - inline  format inline: `{filename}: line {line}, col {col}, {msg}`
  // - inlinesingle  inline as well
  // - junit  junit xml format
  // - text  plain text
  
  return gulp.src('./lib/**/*.js')
    .pipe(jscs(jsCsConfig))  //jsCsConfig should read from pr
    .pipe(jscs.reporter('inline'))
});

jscs build-in reporters (may change, rely on jscs)

use custom reporter

gulp.task('lint', function () {
  
  return gulp.src('./lib/**/*.js')
    .pipe(jscs(jsCsConfig))  //jsCsConfig should read from pr
    .pipe(jscs.reporter(__dirname + '/gulp-jscs-custom-reporter', {
      filename: __dirname + '/jscs-output.html'
    }));
});

** first param ** the jscs.reporter() first param report can be a string or a module instance:

  1. __dirname + '/gulp-jscs-html-reporter'
  2. require(__dirname + '/gulp-jscs-html-reporter') all of the two ways work fine!

but you must know if first param is a string ,we will try jscs build-in first, then require it as an module. so if you want to require a module which name is as same as jscs build-in reporter, you should use the second way.

** options ** the options will trans to reporter as a second param.

a reporter stream handler should like this:

// this is a transform handle
// - errorsCollection is came from one stream file jscs check
// - options is came from above
module.exports = function( errorsCollection, options ) {
	//handle one stream jscs check result
}

** reporter.beforeAll and reporter.afterAll **

sometimes, in custom reporter, we need do something before jscs checking or after that. we can use these two funciton binding for that:

// this is a init handle
// before first stream came this function will run first
module.exports.beforeAll = function( options ) {
	//do something before all jscs checking
}

// this is a winding up handle
// so we transform all errorCollection in every stream file in the firm param
module.exports.afterAll = function( allErrorsCollection, options ) {
	//do something after all jscs checking and use all collects
}