1.0.4 • Published 3 years ago

grunt-jshint-event-reporter v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

grunt-jshint-event-reporter

grunt-jshint-event-reporter Calls an error event for grunt-contrib-jshint You can make your reporter: Writing your own JSHint reporter

Getting Started

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

Install

npm i grunt-jshint-event-reporter --save-dev

Usage

Need to set to jshint options

jshint: {
  options: {
    reporter: require('grunt-jshint-event-reporter')
  }
}
grunt.event.on('jshint-error', function(err){
    console.log(JSON.stringify(err));
});

Examples

module.exports = function(grunt) {

  grunt.initConfig({
      jshint: {
          options: {
            reporter: require('grunt-jshint-event-reporter')
          },
          before: ['src/js/**/*.js']
      },

      uglify: {
          all: {
            files: [{
              expand: true,
              cwd: 'src',
              src: 'js/**/*.js',
              dest: 'build'
            }]
          }
      },

      watch: {
          options: {
            spawn: false 
            // It is recommended to disable `false` or not use 'grunt-contrib-watch' 
            // or perhaps even Grunt. Because it works very very slowly.
          },
          js: {
              files: ['src/**/*.js'],
              tasks: ['jshint', 'uglify']
          }      
      },
  });

  // Load the plugins (It assumes you already have all of these plugins)
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');


  grunt.event.on('jshint-error', function(err){
      console.log(JSON.stringify(err));
  });
}
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago