New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[[FEAT]] Support .jshintrc "extends" with no specific path. #2449
Conversation
Extending the abilities of the .jshintrc option "extends". The new behaviour resembles the "root" option of .editorconfig files. When the boolean value true is used: JSHint will walk up the directory tree and look for a .jshintrc file. If no .jshintrc file is found (root directory reached): Nothing will happen, and the original .jshintrc file will be used as is. If a .jshintrc file is found: JSHint will behave as if the file's path was explicitly paseed as the "extends" option. This includes recursive behavior for this feature.
Thanks for the patch! Can you talk a bit about the motivation for this feature? |
Most of the times I use the Taking this into consideration, Use Case
I believe most of the times something like this will be used:
And not something like this:
So there is no reason to have to write
Moving the directory I planned on writing another use case, but I feel like I wrote too much :) |
Thanks for the info!
JSHint will exit immediately if any
I'm not so sure about that. The value
That's definitely true. It also makes the project's configuration a little more opaque; human readers will also have to do this recursive lookup in order to understand how JSHint will behave. And there's the performance overhead to consider--each invocation would trigger a number of I/O operations as JSHint pokes around the filesystem to find configuration files that rarely move. As is characteristic of a lot of implicit functionality in software, there is a fair amount of subjectivity in handling exceptional cases. As the I'm feeling lukewarm about this feature because I think explicitness is valuable in configuration files. As a fellow programmer, I appreciate your desire to automate this process, but I think this introduces more complexity for a rare use case--how often are users completely re-organizing their project's directory structure? |
Thanks for considering my suggestion. I had some time to think about this, and I still believe this is a good behavior to add to JSHint - So, I'll try to convince you a bit more (hope that's OK). I'll concentrate on the intuitiveness since this is the reason I made the patch, and if the patch does not achieve that - Well, that's a deal breaker. When I used the Other tools using this behavior, make it expected. e.g. .jscsrc, .editorconfig, .gitignore, ... Other JSHint options usually accept booleans. The ones that do accept strings, usually also accept booleans and in that case, using a string usually invokes a special or less common behavior. This makes the booleans expected, especially for invoking the common behavior. The common usage is usually expected to have/get a shortcut, or even be/become the default. Since it is rare to see a project/team using cascading The name |
Of course it is! (Just as long as you don't mind occassional delays on my part)
My objection applies to the behavior in JSCS and EditorConfig, as well: the
So git configuration lookup automatically stops at project boundaries.
I appreciate your experience as a user of JSHint, but that expectation only To say that the value
The ESLint project has a similar purpose as this one, and so it's probably wise to consider how the maintainers and users have handled this issue. The behavior you are requesting was initially the default in ESLint, but as they found, it is not without its share of edge cases, and that project now supports explicit configuration file extensions. |
Extending the abilities of the .jshintrc file option
"extends"
.The new behavior resembles the
root
option of .editorconfig files.When the boolean value
true
is used:JSHint will walk up the directory tree and look for a .jshintrc file.
If no .jshintrc file is found (root directory reached):
Nothing will happen, and the original .jshintrc file will be used as is.
If a .jshintrc file is found:
JSHint will behave as if the file's path was explicitly passed as the
"extends"
option.This includes recursive behavior for this feature.