jshint-loader
jshint-loader copied to clipboard
Pass a path to .jshintrc
Hi guys,
Is there a way to pass a path to .jshintrc
?
The structure of my app has recently changed so i'm now requiring files in sibling folders to the initial project. Webpack is respecting this setup with some resolve
options, but it seems that the jshint-loader is always looking for .jshintrc
in the root of the project it's importing from at the time.
| - A
| |- node_modules
| |- app
| |- .jshintrc
|
| - B
| |- app
|
| - C
| |- app
In this instance as the jshint-loader
goes to bundle a dependency in B
it'll look for a .jshintrc
in the root of B
and not resolve back to A
's .jshintrc
Ideally I don't want to duplicate the same .jshintrc
file across multiple projects.
Any suggestions appreciated!
This should be possible. The loader uses rcloader, which looks for the closest resource file relative to another file. It also allows for an override option to always return the resource file path for every file. We would need to add plumbing for that, but it should be doable.
In the meantime, can you copy .jshintrc
to the parent directory of A
as part of a build? rcloader will then walk up the tree of the B
and find it at the parent of B
.
Hi @jvmccarthy , I have duplicated the file for now, not a big problem, just thought it was a worthwhile improvement.
I know this option is supported by the csslint-loader, with the configFile
option. So it might be worth looking into their implementation.
Thanks again for a very handy loader! :+1:
@oller Thanks for the pointer. I took a quick look, and it looks like csslint has a different API than jshint where you can simply passing configFile
. I took another look at jshint's API, and part of the difficulty here is that they tied finding .jshintrc
into their CLI. That's probably why rcloader was used.
I was leaning towards calling the option configFile
also, so that's nice for consistency.
Any update here?