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

oxlint: max-lines should not display offending code #2775

Closed
aparajita opened this issue Mar 20, 2024 · 5 comments · Fixed by #2778
Closed

oxlint: max-lines should not display offending code #2775

aparajita opened this issue Mar 20, 2024 · 5 comments · Fixed by #2778
Assignees

Comments

@aparajita
Copy link

When max-lines fails, it displays the entire file — which could be several hundred lines — as offending code. This is clearly unnecessary and undesirable.

@aparajita
Copy link
Author

Thank you, what will it display now?

@Dunqing
Copy link
Member

Dunqing commented Mar 22, 2024

Thank you, what will it display now?

will now only report lines that exceed the maximum allowed

image

@aparajita
Copy link
Author

Honestly it isn't necessary to display any lines. Because if the file is too long, we can easily end up moving entire functions, and it would be sheer luck if they happened to be at the end of the file. So I would submit that showing excess lines is not at all helpful in most cases to the process of shortening the file.

@mysteryven
Copy link
Member

mysteryven commented Mar 22, 2024

Because if the file is too long, we can easily end up moving entire functions, and it would be sheer luck if they happened to be at the end of the file.

I agree with this, so initially I think it is OK to report all lines and let the user choose which part needs to be deleted. after all, people open this rule, they need to fix it, although it does get a little annoying.

I would submit that showing excess lines is not at all helpful in most cases to the process of shortening the file.

I think some people will encounter this error when they are writing code in this file line by line, it's friendly to notice them they write too many lines, they may decide to write remain part in another file.

Look through ESLint's issue about max-line, not find folk's report about this(perhaps I missed it), I think we can follow the ESLint behavior for now.

@aparajita
Copy link
Author

Fair enough. Then how about adding a config option to not display the offending lines?

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

Successfully merging a pull request may close this issue.

3 participants