xojs/xo

Reintroduce "length" rules to catch excess

fregante opened this issue · 3 comments

It doesn't make sense to limit lines to 80ch or 120ch, but can we agree that there's zero reason to have a line 1000ch long? Surely there must be a limit?

What if we treat these rules "obvious excess catchers"?

A line-length rule with limit of 1000 characters wouldn't imply that 999 is fine, but it could still help catch egregiously bad code. True exceptions to this rule have have their own eslint-disable-next-line

Now the issue is what we can agree to be excessive.

Note that xo already has the complexity and max-params rules enabled, which have a similarly-arbitrary limit on code.

XO's "max-*" rules:

https://github.com/xojs/eslint-config-xo/blob/3a5448b349e9cfb6780b476a87bdb96439cea403/index.js#L383-L393

I dunno. I see very little value in this. I don't think I ever got a PR that violated any of these. Sometimes you do need a file with more than 1000 lines.

need a file

Do you really need it or is it inconvenient to split up?

Sometimes you do need

Then True exceptions to this rule have have their own eslint-disable-next-line, I think those would be the minority.

I don't think I ever got a PR

So it wouldn't affect you and enabling it would take little effort.

Linting also affects existing, old, large apps. I think JSX alone can easily be brought to 200 characters, I've seen this in Refined GitHub

Alright, let's try it then.