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
Fix max-statements-per-line #7051
Comments
@nzakas what is the desired behavior when |
@nzakas I would like to make a PR for this, this will be my first PR in the code base if you are ok with me taking this on. Thank you |
@ilyavolodin thank you, will hopefully have a PR open in a few days. Will let you know if I have any questions about execution etc. |
@btmills yes, what @ilyavolodin said. The minimum for |
@sstern6 Thanks for volunteering to take this on! If you have questions, feel free to either leave a comment in the issue or stop by our Gitter chat. |
@ilyavolodin @nzakas got it, thanks! If we're making the schema more restrictive, then this should be a semver-minor change, right? |
@btmills Was just about to say that. I'm actually not sure if even semver-minor would be enough, since it's a breaking change for anyone using |
I can't see a scenario where someone is using |
@nzakas Confirmed on online demo: /* eslint max-statements-per-line: ["error", { "max": 0 }] */
something(); Result:
Now that I've seen this behavior, I agree it's useless and buggy and does not need a semver-major release to fix. |
In that case, I'm perfectly fine calling this a bug and doing as a semver-patch |
…n schema of the rule(fixes eslint#7051)
While reviewing #7044, I find that
max-statements-per-line
has an undocumented and confusing behavior. For some reason, we allow an option ofmax: 0
, which seems like a mistake (though intentional because there are tests). It looks like the only time this is triggered is when there's an empty blocks statement and there's a special case for that in the code: https://github.com/eslint/eslint/blob/master/lib/rules/max-statements-per-line.js#L167This seems very broken because it doesn't make sense to ever have max statements be 0 per line, and we already have
no-empty
to catch empty blocks.I think we should fix this by:
max
is 1 or largerThis would be semver-patch because we are reducing the number of warnings this rule produces.
@mysticatea @scriptdaemon
The text was updated successfully, but these errors were encountered: