webpack-contrib / jshint-loader

[DEPRECATED] jshint loader for webpack, please migrate on `eslint`
MIT License
67 stars 37 forks source link

Provide filename into error so reporter can use it #11

Closed MoOx closed 8 years ago

MoOx commented 9 years ago

I like GNU like message and I would like to be able to output message like this

/.../filename.ext:line:column: message

Example:

web_modules/component/index.js:42:1337: This error make me sad (reason - code)

But right now I can not do that :(

MoOx commented 9 years ago

Adding source as param for the reporter should do the trick, don't you think ?

sokra commented 9 years ago

You can pass a custom reporter...

MoOx commented 9 years ago

Yeah, but can't access the filename. It's not accessible.

dashed commented 9 years ago

@MoOx The caveat is that the reporter for jshint-loader is called for every file; and thus the jshint output is only on one file, not a list of them.

webpack provides this.emitWarning function, which you can use to emit jshint output. When using it, it will output which file the output is associated with.

For example for my custom reporter:

WARNING in ./src/index.js

jshint report:
  line 20  col 17  Missing 'new' prefix when invoking a constructor.  (W064)  
            let Store = StoreSnapshot();

  ⚠  1 warning

Here's my custom reporter: https://gist.github.com/Dashed/ed941052b82fd7694320