biome icon indicating copy to clipboard operation
biome copied to clipboard

💅 `lint/complexity/useLiteralKeys` suggests incorrect fix

Open ematipico opened this issue 2 years ago • 1 comments

Environment information

CLI:
  Version:                      1.7.1
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.11.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/8.6.12"

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

Linter:
  Recommended:                  false
  All:                          false
  Rules:                        complexity/noBannedTypes = "error"
                                complexity/noUselessTypeConstraint = "error"
                                complexity/useLiteralKeys = "error"
                                complexity/useOptionalChain = "error"
                                correctness/noPrecisionLoss = "error"
                                correctness/noUnusedVariables = "error"
                                style/noInferrableTypes = "error"
                                style/noNamespace = "error"
                                style/useAsConstAssertion = "error"
                                style/useBlockStatements = "off"
                                style/useConsistentArrayType = "error"
                                style/useConst = "off"
                                style/useForOf = "error"
                                style/useShorthandFunctionType = "error"
                                suspicious/noEmptyBlockStatements = "off"
                                suspicious/noExplicitAny = "off"
                                suspicious/noExtraNonNullAssertion = "error"
                                suspicious/noMisleadingInstantiator = "error"
                                suspicious/noUnsafeDeclarationMerging = "error"
                                suspicious/useAwait = "off"
                                suspicious/useNamespaceKeyword = "error"

Workspace:
  Open Documents:               0

Rule name

lint/complexity/useLiteralKeys

Playground link

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

Expected result

It should suggest

flags._.[0]

Instead of

flags._[0]

Code of Conduct

  • [X] I agree to follow Biome's Code of Conduct

ematipico avatar Apr 23 '24 15:04 ematipico

It should suggest

flags._.[0]

Are you sure about this? This looks like an invalid syntax as reported by the TypeScript playground. The suggested fix seems correct to me.

Conaclos avatar May 12 '24 11:05 Conaclos