Fix max-statements-per-line
See original GitHub issueWhile reviewing https://github.com/eslint/eslint/pull/7044, I find that max-statements-per-line
has an undocumented and confusing behavior. For some reason, we allow an option of max: 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#L167
This 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:
- Ensuring
max
is 1 or larger - Removing the empty block check
This would be semver-patch because we are reducing the number of warnings this rule produces.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:11 (11 by maintainers)
@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
@btmills yes, what @ilyavolodin said. The minimum for
max
should be set to 1 in the schema.