brackets-jshint icon indicating copy to clipboard operation
brackets-jshint copied to clipboard

Support extends in .jshintrc

Open Qantas94Heavy opened this issue 10 years ago • 12 comments

It's good that .jshintrc files now don't have to be in the project root, but when I try to place one in a subfolder, that becomes the only file used. Could we change this to match the behaviour of the JSHint CLI, which implements this sort of thing (jshint/jshint#1314)?

Qantas94Heavy avatar Aug 26 '14 09:08 Qantas94Heavy

So to be clear, you want to support extends? If so - I'm ok with that. Don't know when I'd have time though but I'd accept a PR.

cfjedimaster avatar Aug 26 '14 12:08 cfjedimaster

I'd be happy with just searching for the .jshint file up the directory tree.

For example within the project we have all frotend-related assets in /resources folder and that's where I've placed the file.

piotr-cz avatar Dec 17 '14 14:12 piotr-cz

Supposedly, #55 implements it (enabled by default). Is it broken?

EDIT: ah, I see. @Qantas94Heavy, you mean supporting extends in .jshintrc. Sorry #55 is not applicable then. @cfjedimaster, perhaps it makes sense to update the title to clearly indicate the issue.

busykai avatar Dec 17 '14 19:12 busykai

@piotr-cz, just in case, the file should be called .jshintrc, not .jshint.

busykai avatar Dec 17 '14 19:12 busykai

I made a typo in comment, I'm having .jshintrc. If I'm not mistaken,#55 does not apply when a .jshintrc is inside a projects subdirectory

project root:
/assets
  /js
    /.jshintrc
    /scripts.js

See JSHint documentation

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

it's not about supporting extends

piotr-cz avatar Dec 17 '14 22:12 piotr-cz

Inheritance would be nice. For example, in my 'test' directory, I would like to have

{ jasmine: true, mocha: true }

in my test directory, but not necessarily in my src (or root) directory.

ajssd avatar Dec 19 '14 17:12 ajssd

@piotr-cz, .jshintrc should apply to scripts.js files in your example. It will not apply to any files outside the assets/js directory. Please file another issue if you still have questions, this one is about supporting extends option.

@Qantas94Heavy or @cfjedimaster, could you please correct the title to indicate clearly what's being requested?

busykai avatar Dec 19 '14 19:12 busykai

I honestly do not understand the issue here - reading a third time.

cfjedimaster avatar Dec 19 '14 19:12 cfjedimaster

Ok now?

cfjedimaster avatar Dec 19 '14 19:12 cfjedimaster

@Qantas94Heavy: As suggested I've just added #69, please look if this is what you mean. Anyway It's my case.

piotr-cz avatar Dec 22 '14 09:12 piotr-cz

Support for extends was added by #54 (looking at the code). @Qantas94Heavy, did you try it? Is it not working?

busykai avatar Dec 22 '14 14:12 busykai

Sorry about all the confusion caused here @cfjedimaster , I was indeed referring to extends.

@busykai I tried this again with a .jshintrc in the root with globalstrict enabled and another .jshintrc in a subdirectory with some globals, but without any globalstrict property set, but the files in the subdirectory were still getting 'Use the function form of "use strict"'.

Qantas94Heavy avatar Dec 24 '14 04:12 Qantas94Heavy