cfjedimaster / brackets-jshint

Adds JSHint support to Brackets
MIT License
131 stars 41 forks source link

Read parent folder .jshintrc #52

Closed ryanburnett closed 10 years ago

ryanburnett commented 10 years ago

First off, I love your plugin (so nice to use this instead of JSLint) :+1:

My folder structure is:

When I place my .jshintrc file into each project folder it works perfectly. However, when I move it into my Sites folder it stops working, giving me these errors:

This seems to not match the behavior described in the JSHint docs:

In case of .jshintrc, JSHint will start looking for this file in the same directory as the file that's being linted. If not found, it will move one level up the directory tree all the way up to the filesystem root.

I'd like to have just one .jshintrc file in the parent Sites folder that each project folder reads. Is this possible?

Thank you :)

cfjedimaster commented 10 years ago

Are you saying you get those errors in Bracket's DevTools output?

On Thu, May 22, 2014 at 4:00 PM, Ryan Burnett notifications@github.comwrote:

First off, I love your plugin (so nice to use this instead of JSLint) [image: :+1:]

My folder structure is:

  • Home
    • Sites
    • Project 1
    • Project 2
    • etc.

When I place my .jshintrc file into each project folder it works perfectly. However, when I move it into my Sites folder it stops working, giving me these errors:

  • 'angular' is not defined
  • 'alert' is not defined

This seems to not match the behavior described in the JSHint docshttp://www.jshint.com/docs/ :

In case of .jshintrc, JSHint will start looking for this file in the same directory as the file that's being linted. If not found, it will move one level up the directory tree all the way up to the filesystem root.

I'd like to have just one .jshintrc file in the parent Sites that each project folder reads. Is this possible?

Thank you :)

— Reply to this email directly or view it on GitHubhttps://github.com/cfjedimaster/brackets-jshint/issues/52 .

Raymond Camden, Web Developer for Adobe

Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden

ryanburnett commented 10 years ago

Hi Raymond!

I'm seeing this in the linting window:

screenshot 2014-05-22 17 46 46

P.S. Great to hear from you! I've been a fan since your CF blog days :)

cfjedimaster commented 10 years ago

Ah, so those aren't errors with the extension per se, you mean it isn't picking up the jshintrc which would have suppressed them, right?

On Thu, May 22, 2014 at 4:49 PM, Ryan Burnett notifications@github.comwrote:

Hi Raymond!

I'm seeing this in the linting window at the bottom of the window:

[image: screenshot 2014-05-22 17 46 46]https://cloud.githubusercontent.com/assets/741858/3060709/b32999c2-e1fa-11e3-8d42-f0d998136cd3.png

P.S. Great to hear from you! I've been a fan since your CF blog days :)

— Reply to this email directly or view it on GitHubhttps://github.com/cfjedimaster/brackets-jshint/issues/52#issuecomment-43948489 .

Raymond Camden, Web Developer for Adobe

Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden

ryanburnett commented 10 years ago

Right, it's not picking up the parent folder's .jshintrc file (these errors don't appear if I move the .jshintrc file into the respective project folder).

Just wondering if there's a way for Brackets to pick up a parent folder's .jshintrc file.

Apologies if I posted this issue in the wrong place.

cfjedimaster commented 10 years ago

This is precisely the right place. Are you using the latest version?

On Thu, May 22, 2014 at 4:58 PM, Ryan Burnett notifications@github.comwrote:

Right, it's not picking up the parent folder's .jshintrc file (these errors don't appear if I move the .jshintrc file into the respective project folder).

Just wondering if there's a way for Brackets to pick up a parent folder's .jshintrc file.

Apologies if I posted this issue in the wrong place.

— Reply to this email directly or view it on GitHubhttps://github.com/cfjedimaster/brackets-jshint/issues/52#issuecomment-43949366 .

Raymond Camden, Web Developer for Adobe

Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden

ryanburnett commented 10 years ago

Yes. I'm running:

Thanks Raymond!

busykai commented 10 years ago

@ryanburnett, the extension (unlike node version of jshint) stops at the project root on purpose, so if you have a .jshintrc at the parent folder, it won't be picked. that is, if you have directory /home/user/src/html/project1 opened in Brackets, and two config files /home/user/src/html/.jshintrc and /home/user/src/html/project1/.jshintrc, only the latter would be picked since it is below the project root. i didn't want to scan the entire filesystem up to the root. the behavior you observe is by [current] design. i guess we can make it a pref to scan the entire file tree hierarchy for those who want to do that up to / (or c:/ or whatever the drive letter is on windows), just like jshint-node does that. @cfjedimaster, what do you think?

busykai commented 10 years ago

@ryanburnett, by the way, as a quick experiment, you could open your sites folder in Brackets (File->Open Folder) and then open the same file that was previously giving you an error, it shouldn't give you any linting errors (make sure you don't have .jshintrc in your Project x directories though or they will be picked up).

cfjedimaster commented 10 years ago

@busykai - I'm trying to imagine a situation where we would not want to go up to /. I'd have to imagine that most people do as @ryanburnett did - some core folder, like sites, with a bunch of projects under it. I know I do. And my core folder is empty except for folders. But - I could see using a root .jshintrc there. (In fact, I wish Bracet's preferences feature also did this so I could set my preferences one time.)

So unless you know a reason not too, I'd vote we make this change. And by we, I mean you. ;)

On Thu, May 22, 2014 at 9:58 PM, busykai notifications@github.com wrote:

@ryanburnett https://github.com/ryanburnett, by the way, as a quick experiment, you could open your sites folder in Brackets (File->Open Folder) and then open the same file that was previously giving you an error, it shouldn't give you any linting errors (make sure you don't have .jshintrc in your Project x directories though or they will be picked up).

— Reply to this email directly or view it on GitHubhttps://github.com/cfjedimaster/brackets-jshint/issues/52#issuecomment-43966877 .

Raymond Camden, Web Developer for Adobe

Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden

busykai commented 10 years ago

@cfjedimaster, OK. :) Me it is.

I'll make it preference with default to scan everything.

I use git a lot and each project is quite different, so in my mind there' s no "one .jshintrc fits all" case. I do see, however, how it could be handy for a collection of similar projects such as @ryanburnett demonstrated. Will look for a gap to squeeze this piece of code in (some time next week, perhaps).

cfjedimaster commented 10 years ago

Thanks - as always. FYI, @ryanburnett - busykai here has done about 100% of the cool updates lately - so if you like this plugin, he deserves most of the credit!

On Fri, May 23, 2014 at 11:00 AM, busykai notifications@github.com wrote:

@cfjedimaster https://github.com/cfjedimaster, OK. :) Me it is.

I'll make it preference with default to scan everything.

I use git a lot and each project is quite different, so in my mind there' s no "one .jshintrc fits all" case. I do see, however, how it could be handy for a collection of similar projects such as @ryanburnetthttps://github.com/ryanburnettdemonstrated. Will look for a gap to squeeze this piece of code in (some time next week, perhaps).

— Reply to this email directly or view it on GitHubhttps://github.com/cfjedimaster/brackets-jshint/issues/52#issuecomment-44029402 .

Raymond Camden, Web Developer for Adobe

Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden

ryanburnett commented 10 years ago

@busykai Thanks so much for the awesome plugin and working on this update. Really makes writing js much easier :)

busykai commented 10 years ago

@ryanburnett, my pleasure! glad it is helpful! @cfjedimaster thanks for your kind words!

ryanburnett commented 10 years ago

Awesome thanks @busykai!

Works like a charm :+1:

Please reclose :)

busykai commented 10 years ago

Cool! :+1: :)