Skip to content
This repository has been archived by the owner on Jul 18, 2019. It is now read-only.

Pass a path to .jshintrc #20

Open
oller opened this issue Mar 9, 2016 · 4 comments
Open

Pass a path to .jshintrc #20

oller opened this issue Mar 9, 2016 · 4 comments
Assignees

Comments

@oller
Copy link

oller commented Mar 9, 2016

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!

@jvmccarthy
Copy link

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.

@jvmccarthy jvmccarthy self-assigned this Mar 16, 2016
@oller
Copy link
Author

oller commented Mar 18, 2016

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! 👍

@jvmccarthy
Copy link

@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.

@goranovs
Copy link

goranovs commented Oct 1, 2018

Any update here?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants