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

linter: eslint/no-lone-blocks errors on if & else blocks containing only a comment #8697

Closed
MichaelGoff opened this issue Jan 24, 2025 · 0 comments · Fixed by #8720
Closed
Labels
A-linter Area - Linter C-bug Category - Bug good first issue Experience Level - Good for newcomers

Comments

@MichaelGoff
Copy link

What version of Oxlint are you using?

0.15.8

What command did you run?

npx oxlint

What does your .oxlint.json config file look like?

{
  "rules": {
    "no-lone-blocks": "error"
  }
}

What happened?

Oxlint errors on if, else, or else if blocks containing only a comment. Eslint does not error on these cases.

Example case

if (foo) {
  // do nothing
}
else if (bar) {
  // do nothing again
}
else {
  console.log('not foo');
}

if (baz) {
  console.log(baz);
} 
else {
  // do nothing
}
@MichaelGoff MichaelGoff added A-linter Area - Linter C-bug Category - Bug labels Jan 24, 2025
@Boshen Boshen added the good first issue Experience Level - Good for newcomers label Jan 25, 2025
@Boshen Boshen closed this as completed in 1de6f85 Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug good first issue Experience Level - Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants