doshprompt / htmlhint-stylish

Stylish reporter for HTMLHint
MIT License
3 stars 0 forks source link

Suggestion: allow the jshint reporter name to be specified #1

Open tdmalone opened 8 years ago

tdmalone commented 8 years ago

As an option, could the jshint reporter name be specified?

My use case is I use jshint-stylish-source for jshint reporting, so I'd love to use that for htmlhint as well (jshint-stylish-source is easier to read on a black console background!)

tdmalone commented 8 years ago

As a workaround, I've borrowed the code from htmhint-stylish and am now running it inline. Here's a snippet of my gulpfile:

.pipe( htmlhint() )
.pipe( htmlhint.reporter( function( file ) {
    return require( 'jshint-stylish-source' ).reporter( file.htmlhint.messages.map( function( errMsg ) {
        return {
            file: path.relative( file.cwd, errMsg.file ),
            error: {
                character: errMsg.error.col,
                code: errMsg.error.rule.id,
                line: errMsg.error.line,
                reason: errMsg.error.message
            }
        }
    }));
}))