Skip to content

💅 False positive by lint/nursery/noUselessUndefined #6577

@atheck

Description

@atheck

Environment information

CLI:
  Version:                      2.0.5
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  BIOME_THREADS:                unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           v22.14.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         npm/10.9.2

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         biome.jsonc
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  true

Linter:
  JavaScript enabled:           unset
  JSON enabled:                 unset
  CSS enabled:                  unset
  GraphQL enabled:              unset
  Recommended:                  unset
  Enabled rules:
    a11y/noAccessKey
    a11y/noAriaHiddenOnFocusable
    a11y/noAriaUnsupportedElements
    a11y/noAutofocus
    a11y/noDistractingElements
    a11y/noHeaderScope
    a11y/noInteractiveElementToNoninteractiveRole
    a11y/noLabelWithoutControl
    a11y/noNoninteractiveElementToInteractiveRole
    a11y/noNoninteractiveTabindex
    a11y/noPositiveTabindex
    a11y/noRedundantAlt
    a11y/noRedundantRoles
    a11y/noStaticElementInteractions
    a11y/noSvgWithoutTitle
    a11y/useAltText
    a11y/useAnchorContent
    a11y/useAriaActivedescendantWithTabindex
    a11y/useAriaPropsForRole
    a11y/useAriaPropsSupportedByRole
    a11y/useButtonType
    a11y/useFocusableInteractive
    a11y/useGenericFontNames
    a11y/useHeadingContent
    a11y/useHtmlLang
    a11y/useIframeTitle
    a11y/useKeyWithClickEvents
    a11y/useKeyWithMouseEvents
    a11y/useMediaCaption
    a11y/useSemanticElements
    a11y/useValidAnchor
    a11y/useValidAriaProps
    a11y/useValidAriaRole
    a11y/useValidAriaValues
    a11y/useValidAutocomplete
    a11y/useValidLang
    complexity/noAdjacentSpacesInRegex
    complexity/noArguments
    complexity/noBannedTypes
    complexity/noCommaOperator
    complexity/noEmptyTypeParameters
    complexity/noExcessiveNestedTestSuites
    complexity/noExtraBooleanCast
    complexity/noFlatMapIdentity
    complexity/noStaticOnlyClass
    complexity/noThisInStatic
    complexity/noUselessCatch
    complexity/noUselessConstructor
    complexity/noUselessContinue
    complexity/noUselessEmptyExport
    complexity/noUselessEscapeInRegex
    complexity/noUselessFragments
    complexity/noUselessLabel
    complexity/noUselessLoneBlockStatements
    complexity/noUselessRename
    complexity/noUselessStringConcat
    complexity/noUselessStringRaw
    complexity/noUselessSwitchCase
    complexity/noUselessTernary
    complexity/noUselessThisAlias
    complexity/noUselessTypeConstraint
    complexity/noUselessUndefinedInitialization
    complexity/noVoid
    complexity/useArrowFunction
    complexity/useDateNow
    complexity/useFlatMap
    complexity/useLiteralKeys
    complexity/useNumericLiterals
    complexity/useOptionalChain
    complexity/useRegexLiterals
    complexity/useSimpleNumberKeys
    complexity/useWhile
    correctness/noChildrenProp
    correctness/noConstAssign
    correctness/noConstantCondition
    correctness/noConstantMathMinMaxClamp
    correctness/noConstructorReturn
    correctness/noEmptyCharacterClassInRegex
    correctness/noEmptyPattern
    correctness/noGlobalObjectCalls
    correctness/noInnerDeclarations
    correctness/noInvalidBuiltinInstantiation
    correctness/noInvalidConstructorSuper
    correctness/noInvalidDirectionInLinearGradient
    correctness/noInvalidGridAreas
    correctness/noInvalidPositionAtImportRule
    correctness/noMissingVarFunction
    correctness/noNonoctalDecimalEscape
    correctness/noPrecisionLoss
    correctness/noRenderReturnValue
    correctness/noSelfAssign
    correctness/noSetterReturn
    correctness/noStringCaseMismatch
    correctness/noSwitchDeclarations
    correctness/noUnknownFunction
    correctness/noUnknownMediaFeatureName
    correctness/noUnknownProperty
    correctness/noUnknownPseudoClass
    correctness/noUnknownPseudoElement
    correctness/noUnknownTypeSelector
    correctness/noUnknownUnit
    correctness/noUnmatchableAnbSelector
    correctness/noUnreachable
    correctness/noUnreachableSuper
    correctness/noUnsafeFinally
    correctness/noUnsafeOptionalChaining
    correctness/noUnusedFunctionParameters
    correctness/noUnusedImports
    correctness/noUnusedLabels
    correctness/noUnusedPrivateClassMembers
    correctness/noUnusedVariables
    correctness/noVoidElementsWithChildren
    correctness/noVoidTypeReturn
    correctness/useExhaustiveDependencies
    correctness/useHookAtTopLevel
    correctness/useIsNan
    correctness/useJsxKeyInIterable
    correctness/useValidForDirection
    correctness/useValidTypeof
    correctness/useYield
    nursery/noAwaitInLoop
    nursery/noBitwiseOperators
    nursery/noConstantBinaryExpression
    nursery/noFloatingPromises
    nursery/noGlobalDirnameFilename
    nursery/noImportCycles
    nursery/noImportantStyles
    nursery/noNestedComponentDefinitions
    nursery/noNoninteractiveElementInteractions
    nursery/noProcessGlobal
    nursery/noReactPropAssign
    nursery/noTsIgnore
    nursery/noUnknownAtRule
    nursery/noUselessBackrefInRegex
    nursery/noUselessEscapeInString
    nursery/noUselessUndefined
    nursery/useAdjacentGetterSetter
    nursery/useConsistentObjectDefinition
    nursery/useConsistentResponse
    nursery/useExhaustiveSwitchCases
    nursery/useExportsLast
    nursery/useGoogleFontPreconnect
    nursery/useIndexOf
    nursery/useJsonImportAttribute
    nursery/useNumericSeparators
    nursery/useObjectSpread
    nursery/useParseIntRadix
    nursery/useSingleJsDocAsterisk
    nursery/useSymbolDescription
    nursery/useUniqueElementIds
    performance/noAccumulatingSpread
    performance/noBarrelFile
    performance/noDelete
    performance/noDynamicNamespaceImportAccess
    performance/noNamespaceImport
    performance/noReExportAll
    performance/useTopLevelRegex
    security/noBlankTarget
    security/noDangerouslySetInnerHtml
    security/noDangerouslySetInnerHtmlWithChildren
    security/noGlobalEval
    style/noCommonJs
    style/noDefaultExport
    style/noDescendingSpecificity
    style/noDoneCallback
    style/noInferrableTypes
    style/noNamespace
    style/noNegationElse
    style/noNestedTernary
    style/noNonNullAssertion
    style/noParameterAssign
    style/noProcessEnv
    style/noShoutyConstants
    style/noSubstr
    style/noUnusedTemplateLiteral
    style/noUselessElse
    style/noValueAtRule
    style/noYodaExpression
    style/useArrayLiterals
    style/useAsConstAssertion
    style/useAtIndex
    style/useBlockStatements
    style/useCollapsedElseIf
    style/useCollapsedIf
    style/useConsistentArrayType
    style/useConsistentBuiltinInstantiation
    style/useConsistentMemberAccessibility
    style/useConst
    style/useDefaultParameterLast
    style/useDeprecatedReason
    style/useEnumInitializers
    style/useExplicitLengthCheck
    style/useExponentiationOperator
    style/useExportType
    style/useForOf
    style/useImportType
    style/useLiteralEnumMembers
    style/useNamingConvention
    style/useNodeAssertStrict
    style/useNumberNamespace
    style/useSelfClosingElements
    style/useShorthandAssign
    style/useShorthandFunctionType
    style/useSingleVarDeclarator
    style/useTemplate
    style/useThrowNewError
    style/useThrowOnlyError
    style/useTrimStartEnd
    suspicious/noApproximativeNumericConstant
    suspicious/noArrayIndexKey
    suspicious/noAssignInExpressions
    suspicious/noAsyncPromiseExecutor
    suspicious/noCatchAssign
    suspicious/noClassAssign
    suspicious/noCommentText
    suspicious/noCompareNegZero
    suspicious/noConfusingLabels
    suspicious/noConfusingVoidType
    suspicious/noConsole
    suspicious/noConstEnum
    suspicious/noControlCharactersInRegex
    suspicious/noDebugger
    suspicious/noDocumentCookie
    suspicious/noDoubleEquals
    suspicious/noDuplicateAtImportRules
    suspicious/noDuplicateCase
    suspicious/noDuplicateClassMembers
    suspicious/noDuplicateCustomProperties
    suspicious/noDuplicateElseIf
    suspicious/noDuplicateFields
    suspicious/noDuplicateFontNames
    suspicious/noDuplicateJsxProps
    suspicious/noDuplicateObjectKeys
    suspicious/noDuplicateParameters
    suspicious/noDuplicateProperties
    suspicious/noDuplicateSelectorsKeyframeBlock
    suspicious/noDuplicateTestHooks
    suspicious/noEmptyBlock
    suspicious/noEmptyBlockStatements
    suspicious/noEvolvingTypes
    suspicious/noExplicitAny
    suspicious/noExportsInTest
    suspicious/noExtraNonNullAssertion
    suspicious/noFallthroughSwitchClause
    suspicious/noFocusedTests
    suspicious/noFunctionAssign
    suspicious/noGlobalAssign
    suspicious/noGlobalIsFinite
    suspicious/noGlobalIsNan
    suspicious/noImplicitAnyLet
    suspicious/noImportAssign
    suspicious/noImportantInKeyframe
    suspicious/noIrregularWhitespace
    suspicious/noLabelVar
    suspicious/noMisleadingCharacterClass
    suspicious/noMisleadingInstantiator
    suspicious/noMisplacedAssertion
    suspicious/noMisrefactoredShorthandAssign
    suspicious/noOctalEscape
    suspicious/noPrototypeBuiltins
    suspicious/noRedeclare
    suspicious/noSelfCompare
    suspicious/noShadowRestrictedNames
    suspicious/noShorthandPropertyOverrides
    suspicious/noSkippedTests
    suspicious/noSparseArray
    suspicious/noSuspiciousSemicolonInJsx
    suspicious/noTemplateCurlyInString
    suspicious/noThenProperty
    suspicious/noUnsafeDeclarationMerging
    suspicious/noUnsafeNegation
    suspicious/noVar
    suspicious/noWith
    suspicious/useAdjacentOverloadSignatures
    suspicious/useDefaultSwitchClauseLast
    suspicious/useErrorMessage
    suspicious/useGetterReturn
    suspicious/useGoogleFontDisplay
    suspicious/useGuardForIn
    suspicious/useIsArray
    suspicious/useNamespaceKeyword
    suspicious/useNumberToFixedDigitsArgument
    suspicious/useStrictMode

Rule name

lint/nursery/noUselessUndefined

Playground link

https://biomejs.dev/playground/?lintRules=all&code=KAApACAAPQA%2BACAAdQBuAGQAZQBmAGkAbgBlAGQA&language=ts

Expected result

unicorn/no-useless-undefined does not flag this when the option "checkArrowFunctionBody" is set to false.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LinterArea: linterL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugS-Help-wantedStatus: you're familiar with the code base and want to help the projectgood first issueGood for newcomers

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions