Closed jugglinmike closed 9 years ago
@waldyrious What do you think?
Thanks for the clarifications, @jugglinmike. However, I am still confused as to where (if anywhere) one can find the list of default settings. I am asking because it seems that, e.g. when HTMLHint calls JSHint, it assumes no options by default (see https://github.com/yaniswang/HTMLHint/issues/56). Maybe that's an error on HTMLHint's side, but still I think it would be useful, for the sake of reference, to be able to refer to a full list of JSHint's default options. For example, this text says "If you would like to make JSHint less strict" -- but less strict than what? Is trial and error the only way we can know how strict it is?
I am still confused as to where (if anywhere) one can find the list of default settings.
The reason you are having trouble finding the default list of settings is because such a list does not exist. Because JSHint defines its options in terms of "enforcing" and "relaxing", you can think of the default behavior as simply, "All available options set to false
".
Is trial and error the only way we can know how strict it is?
If you would like to learn about the constraints JSHint will place on your code by default, you can focus on the Relaxing options. (Note that the descriptions are written in terms of disabling this functionality exactly because they are enabled by default.)
I see. So the if the default configuration is a set of settings X, the relaxing rules subtract from it (i.e. the whole of the relaxing rules equals ¬X), and the enforcing rules add new rules to it, as in (X+Y). Is that right?
Wouldn't it be simpler to have a single type of option, with the current "relaxing" rules being reversed in meaning, and thus true by default, and the current "enforcing" options being false by default?
Yes, I think it definitely would. I'll close this and the related issues because it now looks like your basic concern cannot be addressed through documentation alone. Feel free to follow up with an issue against JSHint itself. Just be aware that the change you are proposing is a breaking one (requiring it be deferred till the next major release) and in low demand (meaning it will not be prioritized very highly).
Glad to hear you believe it would be a good idea. I will submit an issue for the change to be implemented, but in the meantime I believe having the documentation better reflect the current behavior would be a net positive, so this PR still has value. I'll think of a phrasing that might make it clear for those who had the same doubts as I did, and suggest here for updating this PR.
@jugglinmike how about something along these lines?
<h3 id="default-behavior">Default behavior</h3>
JSHint has a set of rules it imposes by default. These can be adjusted by specifying
<a href="http://jshint.com/docs/options/#relaxing-options">"relaxing" options</a>
(to disable specific rules in the default set) or
<a href="http://jshint.com/docs/options/#enforcing-options">"enforcing" options</a>
(to use additional rules in addition to those in the default set).
JSHint may be configured with whatever combination of these options you like.
The full list of Relaxing options essentially defines the default behavior of JSHint
(so running JSHint with all the relaxing options turned on will produce no warnings).
More clearly define how JSHint will behave in the absence of a user-defined configuration file.