biome: ๐Ÿ’… Function parameters with spread operator are not correctly checked by `noUnusedFunctionParameters`

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v22.13.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.9.2"

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:                  true
  GraphQL enabled:              false
  Recommended:                  true
  All:                          false
  Enabled rules:
  performance/noDelete
  suspicious/noCatchAssign
  suspicious/noUnsafeNegation
  complexity/useLiteralKeys
  style/useImportType
  complexity/noMultipleSpacesInRegularExpressionLiterals
  a11y/useValidLang
  complexity/noUselessEmptyExport
  suspicious/useNamespaceKeyword
  suspicious/useValidTypeof
  a11y/useValidAriaRole
  correctness/noConstantCondition
  a11y/useAriaActivedescendantWithTabindex
  suspicious/noAssignInExpressions
  style/useDefaultParameterLast
  complexity/noEmptyTypeParameters
  correctness/noConstructorReturn
  style/useSelfClosingElements
  suspicious/noDuplicateParameters
  suspicious/noDuplicateSelectorsKeyframeBlock
  correctness/noUnknownProperty
  correctness/noUnusedLabels
  complexity/noUselessTernary
  correctness/noUnreachableSuper
  suspicious/noCompareNegZero
  suspicious/noExplicitAny
  correctness/noUnsafeOptionalChaining
  correctness/noConstAssign
  suspicious/noControlCharactersInRegex
  complexity/noUselessTypeConstraint
  style/noVar
  suspicious/noDoubleEquals
  suspicious/noRedundantUseStrict
  style/useLiteralEnumMembers
  suspicious/noEmptyInterface
  suspicious/noConstEnum
  suspicious/noMisleadingCharacterClass
  correctness/noPrecisionLoss
  a11y/noLabelWithoutControl
  suspicious/noRedeclare
  correctness/noStringCaseMismatch
  correctness/noSetterReturn
  correctness/noInvalidConstructorSuper
  suspicious/noImplicitAnyLet
  suspicious/noFallthroughSwitchClause
  suspicious/noUnsafeDeclarationMerging
  complexity/noUselessThisAlias
  correctness/noUnreachable
  a11y/useKeyWithClickEvents
  suspicious/noDuplicateObjectKeys
  complexity/noThisInStatic
  complexity/useOptionalChain
  correctness/noInnerDeclarations
  suspicious/noDuplicateCase
  a11y/useValidAnchor
  complexity/useRegexLiterals
  correctness/noSelfAssign
  correctness/noInvalidBuiltinInstantiation
  style/noUselessElse
  style/useShorthandFunctionType
  suspicious/noShadowRestrictedNames
  correctness/noInvalidDirectionInLinearGradient
  suspicious/noImportantInKeyframe
  complexity/noUselessLabel
  complexity/noUselessCatch
  correctness/noUnsafeFinally
  a11y/useAriaPropsForRole
  correctness/noNonoctalDecimalEscape
  style/useEnumInitializers
  a11y/useHtmlLang
  suspicious/noDuplicateTestHooks
  complexity/noStaticOnlyClass
  style/useWhile
  style/noInferrableTypes
  style/useNumericLiterals
  a11y/noNoninteractiveTabindex
  complexity/useSimpleNumberKeys
  correctness/useYield
  a11y/noInteractiveElementToNoninteractiveRole
  suspicious/noImportAssign
  correctness/noUnnecessaryContinue
  suspicious/noApproximativeNumericConstant
  suspicious/noLabelVar
  suspicious/useDefaultSwitchClauseLast
  correctness/noGlobalObjectCalls
  correctness/noUnknownUnit
  a11y/useAltText
  correctness/noEmptyCharacterClassInRegex
  suspicious/noSparseArray
  a11y/useIframeTitle
  complexity/noBannedTypes
  a11y/noSvgWithoutTitle
  correctness/noVoidElementsWithChildren
  style/useAsConstAssertion
  correctness/useJsxKeyInIterable
  style/useExportType
  complexity/noUselessLoneBlockStatements
  style/noArguments
  a11y/useValidAriaValues
  suspicious/noMisleadingInstantiator
  suspicious/noDebugger
  a11y/useFocusableInteractive
  suspicious/noGlobalAssign
  suspicious/noCommentText
  suspicious/noDuplicateJsxProps
  correctness/noUnmatchableAnbSelector
  a11y/noPositiveTabindex
  correctness/noEmptyPattern
  complexity/noExcessiveNestedTestSuites
  security/noDangerouslySetInnerHtmlWithChildren
  a11y/useKeyWithMouseEvents
  suspicious/noExtraNonNullAssertion
  suspicious/noShorthandPropertyOverrides
  correctness/noRenderReturnValue
  correctness/useExhaustiveDependencies
  security/noGlobalEval
  style/noNonNullAssertion
  a11y/noRedundantRoles
  complexity/useFlatMap
  correctness/useIsNan
  correctness/noUnusedVariables
  correctness/useHookAtTopLevel
  style/useConst
  suspicious/noGlobalIsFinite
  suspicious/noAsyncPromiseExecutor
  suspicious/noDuplicateFontNames
  suspicious/noSelfCompare
  suspicious/useGetterReturn
  security/noDangerouslySetInnerHtml
  style/useNodejsImportProtocol
  a11y/noDistractingElements
  complexity/noWith
  suspicious/noDuplicateClassMembers
  complexity/noExtraBooleanCast
  performance/noAccumulatingSpread
  a11y/useValidAriaProps
  a11y/noRedundantAlt
  correctness/noChildrenProp
  correctness/noUnknownFunction
  correctness/noInvalidPositionAtImportRule
  suspicious/noConfusingLabels
  suspicious/noConfusingVoidType
  suspicious/noFocusedTests
  a11y/useButtonType
  a11y/noAriaUnsupportedElements
  correctness/noInvalidGridAreas
  correctness/noFlatMapIdentity
  suspicious/noSuspiciousSemicolonInJsx
  a11y/noBlankTarget
  a11y/useHeadingContent
  correctness/useValidForDirection
  correctness/noVoidTypeReturn
  correctness/noInvalidUseBeforeDeclaration
  a11y/noAriaHiddenOnFocusable
  a11y/useGenericFontNames
  correctness/noUnknownMediaFeatureName
  a11y/useAnchorContent
  complexity/noUselessRename
  complexity/noUselessConstructor
  a11y/noAccessKey
  correctness/noUnusedFunctionParameters
  style/useExponentiationOperator
  complexity/noUselessSwitchCase
  suspicious/noExportsInTest
  a11y/noNoninteractiveElementToInteractiveRole
  style/noCommaOperator
  suspicious/noDuplicateAtImportRules
  suspicious/useIsArray
  a11y/noHeaderScope
  complexity/noUselessFragments
  suspicious/noMisrefactoredShorthandAssign
  suspicious/noEmptyBlock
  correctness/noUnusedImports
  suspicious/noClassAssign
  suspicious/noFunctionAssign

Workspace:
  Open Documents:               0

Rule name

noUnusedFunctionParameters

Playground link

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

Expected result

Unused property in an object function parameter should be be caught, similarly to other linters

Code of Conduct

  • I agree to follow Biomeโ€™s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

Hm, yes, itโ€™s a good precedent - probably amending noUnusedFunctionParameters to work the same way (option to toggle checking such constructs) is the most reasonable approach?

A new option is a new feature, so letโ€™s make sure to merge it only when v2.1 ready to go

@vladimir-ivanov Thanks for bringing it to light.

Similarly to noUnusedVariables I think we should introduce a ignoreRestSiblings option.

TBH I am not sure why noUnusedFunctionParameters is a dedicated rule. noUnusedVariables have very similar semantics, and it checks not only variables but also function declarations. Canโ€™t they be merged into one rule?

If I have a good memory, some users complained that we reported unused parameters that precede used parameters. Instead of ignoring them, we split the rules in two and kept the original behavior. Also, TSC separates them into two settings (noUnusedParams and noUnusedLocals).

I think it isnโ€™t by design. The other rule offers an option to toggle the rest variable check: https://next.biomejs.dev/linter/rules/no-unused-variables/#options