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

🐛 Improper no lone statements #567

Closed
1 task done
NikolaRHristov opened this issue Oct 20, 2023 · 2 comments · Fixed by #584
Closed
1 task done

🐛 Improper no lone statements #567

NikolaRHristov opened this issue Oct 20, 2023 · 2 comments · Fixed by #584
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@NikolaRHristov
Copy link
Contributor

Environment information

CLI:
  Version:                      1.3.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v21.0.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

Discovering running Biome servers...

Incompatible Biome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i Rage discovered this running server using an incompatible version of Biome.

Server:
  Version:                      1.3.1

What happened?

image image

Expected result

The block statement is purposeful and should not be removed.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Levieber
Copy link
Contributor

Levieber commented Oct 20, 2023

In addition, when I use an assignment in an else block:

Without the block, it warns about: "Block statements are preferred in this position."

But with the block, it warns about: "This block statement doesn't serve any purpose and can be safely removed."

Playground: https://biomejs.dev/playground/?lintRules=all&code=bABlAHQAIAB0AGUAcwB0ACAAPQAgAGYAYQBsAHMAZQAKAAoAaQBmACAAKAB0AGUAcwB0ACkAIAB7AAoAIAAgAHQAZQBzAHQAIAA9ACAAIgB3AG8AcgBsAGQAIgAKAH0AIABlAGwAcwBlACAAewAgAAoAIAAgAHQAZQBzAHQAIAA9ACAAIgBoAGUAbABsAG8AIgAgAAoAfQA%3D

@Conaclos Conaclos added S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Oct 20, 2023
@vasucp1207
Copy link
Member

Looks like the rule is missing a check condition for JsElseClause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants