项目作者: svenschoenung

项目描述 :
A stylish summary reporter for jshint
高级语言: JavaScript
项目地址: git://github.com/svenschoenung/jshint-stylish-summary.git
创建时间: 2016-03-19T11:34:47Z
项目社区:https://github.com/svenschoenung/jshint-stylish-summary

开源协议:MIT License

下载


npm Version
Build Status
Coverage Status
Dependency Status
devDependency Status
Code Climate
Codacy Badge Greenkeeper badge

jshint-stylish-summary

A stylish summary reporter for jshint. Best used in combination with jshint-stylish.

Brought on by this Stack Overflow question.

Screenshots

Default output with jshint (in combination with jshint-stylish):

Default output with gulp-jshint (in combination with jshint-stylish):

Installation

  1. npm install --save-dev jshint-stylish-summary

Usage

With jshint

  1. $ jshint --reporter=node_modules/jshint-stylish-summary src/js/*.js

Since jshint’s CLI doesn’t currently support multiple reporters it is necessary to create a wrapper reporter if jshint-stylish-summary should be used in combination with another reporter.

To use jshint-stylish-summary with, e.g., jshint-stylish, create a file reporter.js:

  1. module.exports = {
  2. reporter: function(result, config, options) {
  3. require('jshint-stylish').reporter(result, config, options);
  4. require('jshint-stylish-summary').reporter(result, config, options);
  5. }
  6. };

Then pass this file to jshint:

  1. $ jshint --reporter=reporter.js src/js/*.js

With gulp-jshint

Since jshint-stylish-summary needs to collect information about all files passing through the stream before it can log the results, it is not compatible with gulp-jshint’s reporter() interface.

Instead use the collect() and summarize() functions that jshint-stylish-summary provides:

  1. var jshintSummary = require('jshint-stylish-summary');
  2. gulp.task('lint', function() {
  3. return gulp.src('src/**/*.js')
  4. .pipe(jshint('.jshintrc'))
  5. .pipe(jshint.reporter('jshint-stylish'))
  6. .pipe(jshintSummary.collect())
  7. .on('end', jshintSummary.summarize());
  8. });

See the API documentation for a complete overview of all available functions and options.

License

MIT