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

💅 lint/suspicious/noExtraNonNullAssertion triggers for (a!) #3352

Open
1 task done
pfgithub opened this issue Jul 4, 2024 · 0 comments
Open
1 task done

💅 lint/suspicious/noExtraNonNullAssertion triggers for (a!) #3352

pfgithub opened this issue Jul 4, 2024 · 0 comments
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@pfgithub
Copy link

pfgithub commented Jul 4, 2024

Environment information

CLI:
  Version:                      1.8.3
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.17.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "bun/1.1.16"

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

Linter:
  JavaScript enabled:           true
  JSON enabled:                 true
  CSS enabled:                  false
  Recommended:                  false
  All:                          false
  Enabled rules:
  suspicious/noExtraNonNullAssertion

Workspace:
  Open Documents:               0

Rule name

lint/suspicious/noExtraNonNullAssertion

Playground link

https://biomejs.dev/playground/?code=ZgB1AG4AYwB0AGkAbwBuACAAZABlAG0AbwAoAHYAYQBsAHUAZQA6ACAAcwB0AHIAaQBuAGcAIAB8ACAAbgB1AGwAbAApADoAIABzAHQAcgBpAG4AZwAgAHsACgAgACAAcgBlAHQAdQByAG4AIAAoAHYAYQBsAHUAZQAhACkAOwAKAH0A

Expected result

Forbidden extra non-null assertion should not trigger, and definitely shouldn't be safely auto-fixable.

As it is, forbidden extra non-null assertion triggers and auto-fixes to remove the non-null assertion, despite it clearly being required

  ✖ Forbidden extra non-null assertion.
  
    1 │ function demo(value: string | null): string {
  > 2 │   return (value!);
      │           ^^^^^^
    3 │ }
    4 │ 
  
  ℹ Safe fix: Remove extra non-null assertion.
  
    2 │   return (value!);
      │                -  

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Sec-ant Sec-ant added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Jul 5, 2024
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
Projects
None yet
Development

No branches or pull requests

2 participants