webpack-contrib / jshint-loader

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

add support for .jshintrc files #8

Closed agundermann closed 10 years ago

agundermann commented 10 years ago

Solution for #6

dashed commented 10 years ago

Was about to copy from https://github.com/spenceralger/gulp-jshint :smile:

agundermann commented 10 years ago

@Dashed that's pretty much what this is :smile: @sokra I see, I'll see what I can do tomorrow. The goal is to also keep a sync option for the loader, right?

sokra commented 10 years ago

@taurose Yes sync and async mode would be nice... For webpack a async mode is important for performance reasons. sync mode is nice to have.

agundermann commented 10 years ago

Sadly, I wasn't able to make RcLoader work with proper error handling in async mode. I believe this is due to a bug in RcFinder. I've noticed that other jshint packages use findup-sync to locate the jshintrc file. So I tried using findup which also works asynchronously. This seems to work, but makes the code more verbose and lacks integrated caching. So now I'm unsure about the best approach here. Wait for RcFinder fix, try to work around the bug, or use findup with or without additional caching? Or perhaps I'm overcomplicating things :smile: ?

agundermann commented 10 years ago

Updated the commit now that RcLoader is fixed.

sokra commented 10 years ago

okey looks fine. Just one minor thing: we must tell webpack about what files we read from fs. It is explained here: http://webpack.github.io/docs/how-to-write-a-loader.html#mark-dependencies

Just call this.addDependency for the .jshintrc file.

sokra commented 10 years ago

and move jshint to peerDependencies and change it to the ^2.5.0 notation.

http://webpack.github.io/docs/how-to-write-a-loader.html#use-a-library-as-peerdependencies-when-they-wrap-it

dashed commented 10 years ago

@sokra Anything else needed for this PR?

sokra commented 10 years ago

merged... there was a little bug. It didn't look into the current directory (rcloader expects a filename not a directory name). I fixed it. Published as 0.8.0...

Thanks for your good work...

dashed commented 10 years ago

Thanks <3.

agundermann commented 10 years ago

Awesome. Glad I could contribute :smile:

bbottema commented 8 years ago

@sokra, It doesn't work for me in v1.12.13. It only works if I include the .jshintrc as json in the webpack config.

luizfilipe commented 7 years ago

How is the usage for the .jshintrc file? I'm just asking because this is not documented

dashed commented 7 years ago

@luizfilipe seems like a PR opportunity :)