https://github.com/yuriy-svetlov/grunt-jshint-event-reporter
Calls an error event for jshint
https://github.com/yuriy-svetlov/grunt-jshint-event-reporter
Last synced: 3 months ago
JSON representation
Calls an error event for jshint
- Host: GitHub
- URL: https://github.com/yuriy-svetlov/grunt-jshint-event-reporter
- Owner: Yuriy-Svetlov
- License: mit
- Created: 2021-04-13T14:37:06.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-04T15:28:49.000Z (over 3 years ago)
- Last Synced: 2025-02-28T01:47:44.902Z (4 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# grunt-jshint-event-reporter
> [grunt-jshint-event-reporter](https://github.com/semiromid/grunt-jshint-event-reporter)
> Calls an error event for [grunt-contrib-jshint](https://github.com/gruntjs/grunt-contrib-jshint)
> You can make your reporter: [Writing your own JSHint reporter](https://jshint.com/docs/reporters/)## Getting Started
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-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
```shell
npm i grunt-jshint-event-reporter --save-dev
```## Usage
Need to set to jshint options
```javascript
jshint: {
options: {
reporter: require('grunt-jshint-event-reporter')
}
}
``````javascript
grunt.event.on('jshint-error', function(err){
console.log(JSON.stringify(err));
});
```## Examples
```javascript
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));
});
}
```