Skip to content
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

Reintroduce "length" rules to catch excess #738

Open
fregante opened this issue Nov 17, 2023 · 3 comments · May be fixed by xojs/eslint-config-xo#84
Open

Reintroduce "length" rules to catch excess #738

fregante opened this issue Nov 17, 2023 · 3 comments · May be fixed by xojs/eslint-config-xo#84
Labels

Comments

@fregante
Copy link
Member

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

@sindresorhus
Copy link
Member

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.

@fregante
Copy link
Member Author

fregante commented Nov 17, 2023

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

@sindresorhus
Copy link
Member

Alright, let's try it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants