jshintgrunt-contrib-jshint

How to specify custom reporter with JSHint


I'm using JSHint (in grunt tasks) on a project and currently have it setup to use "jshint-stylish" as the reporter. It's defined in the jshint.js file as seen in the following code

module.exports = {

options: {
    reporter: require('jshint-stylish'),

but I'd like to use my own custom reporter. How do I define the reporter to identify the custom reporter?


Solution

  • Using the structure identified in https://stackoverflow.com/a/17493367/5144741, I figured out that my relative path was incorrect. Important to note: don't include the extension when identifying the reporter. And the require statement isn't needed in this case either.

    module.exports = {
    
    options: {
        reporter: './example/folder/src/reporters/my_reporter',