Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Ignoring nested .jshint files #30

Closed
erikdonohoo opened this issue Apr 25, 2014 · 11 comments
Closed

Ignoring nested .jshint files #30

erikdonohoo opened this issue Apr 25, 2014 · 11 comments
Labels

Comments

@erikdonohoo
Copy link

I have a .jshint file in my root, and also one in the root of my test folder. The files inside the test folder should respect the .jshint inside the test folder, but instead it looks like its going for the one another level up on the project root. The default behavior should be to use the first .jshint file it encounters. If this is what current behavior is believed to be, then I believe there is a bug

@Joezo
Copy link
Owner

Joezo commented Apr 28, 2014

If i'm honest the implementation for finding the correct config file to use and how it uses it isn't quite right at the moment. Will get around to sorting this out though if nobody puts in a pull request :)

@Joezo Joezo added the bug label Apr 28, 2014
@atuttle
Copy link

atuttle commented May 9, 2014

Is it supposed to be .jshint or .jshintrc?

@erikdonohoo
Copy link
Author

It is supposed to be .jshintrc files—
Sent from Mailbox

On Fri, May 9, 2014 at 7:45 AM, Adam Tuttle notifications@github.com
wrote:

Is it supposed to be .jshint or .jshintrc?

Reply to this email directly or view it on GitHub:
#30 (comment)

@atuttle
Copy link

atuttle commented May 9, 2014

@Joezo I see how config is searched for and loaded here

I wouldn't mind taking a stab at trying to improve it. Did you have anything specific in mind?

@erikdonohoo
Copy link
Author

Ideally when a file is saved (or being edited) a search would start from the directory of the file open and continue up the tree until a .jshintrc file is found. This way if you have a different configuration for jshint in a test directory than you do for your project overall, those rules would be respected instead

@erikdonohoo
Copy link
Author

But this loading and searching for configuration would need to occur each time the active file is changed or saved, not just when atom opens.

@Joezo
Copy link
Owner

Joezo commented May 9, 2014

I'm not sure the search for config would need to happen each time a file is saved, just when is it opened would suffice? We could keep a hash of what config file is relevant to each open file so that we don't even need to search every time we switch file. Obviously we would need to if a new file was opened. The only concern there is if a file is moved, or a new config file is placed in the folder after the we've already searched. I'm really open to suggestions though and as long as the code works and doesn't slow things down i'd be happy to accept PRs. Please do have a go!

@erikdonohoo
Copy link
Author

Keeping the hash is a good call. If the hash has a full file path to a config to use then when a file is moved it would be invalidated and a new config would need to be found for it. And when a new .jshintrc is created somewhere in he project the cache could just be invalidated so that searches could take this into account.

@Joezo
Copy link
Owner

Joezo commented May 9, 2014

Sounds like a good plan to me 👍

@atuttle
Copy link

atuttle commented May 21, 2014

Just found this: https://github.com/tkellen/node-liftoff -- maybe it would be useful here?

@Joezo
Copy link
Owner

Joezo commented Jun 26, 2014

This is now resolved and will be usable in the next release

@Joezo Joezo closed this as completed Jun 26, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants