biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
14.27k stars 442 forks source link

💅 Variable names are auto fixed in a breaking way #2216

Closed colin99d closed 5 months ago

colin99d commented 5 months ago

Environment information

CLI:
  Version:                      1.6.3
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "screen-256color"
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

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

Linter:
  Recommended:                  false
  All:                          true
  Rules:                        a11y/noSvgWithoutTitle = "off"
                                a11y/useAltText = "off"
                                a11y/useButtonType = "off"
                                a11y/useIframeTitle = "off"
                                a11y/useKeyWithClickEvents = "off"
                                a11y/useMediaCaption = "off"
                                a11y/useValidAnchor = "off"
                                complexity/noBannedTypes = "off"
                                complexity/noForEach = "off"
                                complexity/noUselessSwitchCase = "off"
                                correctness/noChildrenProp = "off"
                                correctness/noInnerDeclarations = "off"
                                correctness/useExhaustiveDependencies = "off"
                                nursery/useImportRestrictions = "off"
                                security/noDangerouslySetInnerHtml = "off"
                                style/noArguments = "off"
                                style/noNonNullAssertion = "off"
                                style/noParameterAssign = "off"
                                suspicious/noArrayIndexKey = "off"
                                suspicious/noAssignInExpressions = "off"
                                suspicious/noExplicitAny = "off"
                                suspicious/noPrototypeBuiltins = "off"
                                suspicious/useValidTypeof = "off"

Workspace:
  Open Documents:

Rule name

lint/style/useNamingConvention

Playground link

https://biomejs.dev/playground/?code=ZgB1AG4AYwB0AGkAbwBuACAAbABvAGEAZABXAGkAZABnAGUAdABDAG8AbQBwAG8AbgBlAG4AdAAoAHcAaQBkAGcAZQB0AEkAZAA6ACAAVwBpAGQAZwBlAHQASQBkACkAIAB7AAoAIAAgAGMAbwBuAHMAdAAgAEMAbwBtAHAAbwBuAGUAbgB0ACAAPQAgAGcAZQB0AFcAaQBkAGcAZQB0AEMAbwBtAHAAbwBuAGUAbgB0ACgAdwBpAGQAZwBlAHQASQBkACkAOwAKACAAIABpAGYAIAAoACEAQwBvAG0AcABvAG4AZQBuAHQAKQAgAHIAZQB0AHUAcgBuACAAbgB1AGwAbAA7AAoAIAAgAHIAZQB0AHUAcgBuACAAPABDAG8AbQBwAG8AbgBlAG4AdAAgAC8APgA7AAoAfQA%3D

Expected result

Right now this code: function loadWidgetComponent(widgetId: WidgetId) { const Component = getWidgetComponent(widgetId); if (!Component) return null; return <Component />; }

Is converted to: function loadWidgetComponent(widgetId: WidgetId) { const component = getWidgetComponent(widgetId); if (!component) return null; return <Component />; }

Code of Conduct

fireairforce commented 5 months ago

I want to fix this~

Conaclos commented 5 months ago

I think the issue is coming from the semantic model that failed to bind the variable Component with the JSX element Component.