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
Indentation of functions inside conditionals not passing jslint #298
Comments
If you're using an inline iterator like that, I would argue that All the "jslint-happy" arg does right now is put a space between the (Coincidentally, |
As it currently stands, either the documentation should change to say "--jslint-happy" only makes it sorta content and not truly happy, or else one should support the jslint quirks. I believe that discussion of jshint (a similar yet unrelated tool) is out of scope as the option I'm discussing is not "--jshint-or-jslint-happy". I mean no disrespect to jshint. I suppose the topic about this being a bug in jslint might also be out of scope because I'd like for either the option to work or the documentation of the option to not be as misleading. Personally I don't like the above example formatted like this, which is what js-beautify does, and lean towards the indentation that jslint prefers.
|
Stricter, so technically the description is fine. I don't know if any of the active jsbeautifier's developers follow jslint's idea of beauty (it is too crazily hypercritical by default to me), but you're very welcome to submit a pull request that fixes things to jslint-happy mode to make it happier by default. This will probably raise future issues "why is jslint-happy mode indenting my code so ugly? I just want spaces in empty functions", but that's a discussion for a day when that comes. |
I need start out by saying this about the sample input code: I think I made the conscious choice to not have the minimal indenting feature work inside conditionals for exactly the reason @einars mentions. Turning it on shouldn't be too hard. |
Actually, it looks like the minimal indent does work inside conditionals and that's the problem. I need to make the indent from if/do/while parens be non-removable. //input and expected output
'use strict';
if ([].some(function () {
return false;
})) {
console.log('hello');
}
// actual output
'use strict';
if ([].some(function () {
return false;
})) {
console.log('hello');
} |
When given this file it will pass jslint's tests.
After beautifying with the -j option, the
return false;
and the next line both have one less indentation level, making jslint unhappy.The text was updated successfully, but these errors were encountered: