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/useAwait suppression breaks when async function without awaits has a biome-ignore comment inside of it #5029

Closed
1 task done
RobinHeidenis opened this issue Feb 4, 2025 · 1 comment
Labels
S-Needs triage Status: this issue needs to be triaged

Comments

@RobinHeidenis
Copy link

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.12.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

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:
  suspicious/noCatchAssign
  complexity/useLiteralKeys
  complexity/noMultipleSpacesInRegularExpressionLiterals
  suspicious/useNamespaceKeyword
  complexity/noUselessEmptyExport
  suspicious/noAssignInExpressions
  suspicious/noDuplicateSelectorsKeyframeBlock
  suspicious/noDuplicateParameters
  correctness/noConstructorReturn
  style/useSelfClosingElements
  style/useTemplate
  correctness/noUnusedLabels
  correctness/noUnreachableSuper
  suspicious/noCompareNegZero
  a11y/noAutofocus
  correctness/noUnsafeOptionalChaining
  correctness/noConstAssign
  suspicious/noControlCharactersInRegex
  style/noVar
  suspicious/noDoubleEquals
  suspicious/noEmptyInterface
  suspicious/noConstEnum
  nursery/noDuplicateElseIf
  correctness/noPrecisionLoss
  nursery/noRestrictedImports
  correctness/noSetterReturn
  correctness/noInvalidConstructorSuper
  suspicious/noImplicitAnyLet
  a11y/useKeyWithClickEvents
  suspicious/noDuplicateObjectKeys
  suspicious/noUnsafeDeclarationMerging
  correctness/noInnerDeclarations
  correctness/useArrayLiterals
  style/noUselessElse
  correctness/noInvalidDirectionInLinearGradient
  suspicious/noImportantInKeyframe
  complexity/noUselessLabel
  complexity/noUselessCatch
  a11y/useAriaPropsForRole
  style/useCollapsedElseIf
  correctness/noNonoctalDecimalEscape
  suspicious/noDuplicateTestHooks
  complexity/noStaticOnlyClass
  complexity/noUselessUndefinedInitialization
  a11y/noInteractiveElementToNoninteractiveRole
  suspicious/noLabelVar
  correctness/noUnnecessaryContinue
  suspicious/noApproximativeNumericConstant
  correctness/noEmptyCharacterClassInRegex
  correctness/noUnknownUnit
  suspicious/noSparseArray
  a11y/useIframeTitle
  nursery/noExportedImports
  a11y/noSvgWithoutTitle
  correctness/noVoidElementsWithChildren
  correctness/useJsxKeyInIterable
  style/useExportType
  complexity/noUselessLoneBlockStatements
  style/noArguments
  a11y/useValidAriaValues
  suspicious/noGlobalAssign
  suspicious/noCommentText
  suspicious/noThenProperty
  suspicious/useGetterReturn
  a11y/noPositiveTabindex
  correctness/noRenderReturnValue
  correctness/useExhaustiveDependencies
  security/noGlobalEval
  style/noYodaExpression
  a11y/noRedundantRoles
  correctness/noUnusedVariables
  suspicious/noSelfCompare
  suspicious/noAsyncPromiseExecutor
  nursery/noIrregularWhitespace
  security/noDangerouslySetInnerHtml
  style/useNodejsImportProtocol
  suspicious/noArrayIndexKey
  complexity/noWith
  suspicious/noDuplicateClassMembers
  complexity/noExtraBooleanCast
  performance/noAccumulatingSpread
  suspicious/noConfusingLabels
  correctness/noChildrenProp
  correctness/noUnknownFunction
  correctness/noInvalidPositionAtImportRule
  a11y/noAriaUnsupportedElements
  nursery/noCommonJs
  correctness/noFlatMapIdentity
  a11y/noBlankTarget
  a11y/useHeadingContent
  correctness/useValidForDirection
  correctness/noInvalidUseBeforeDeclaration
  a11y/noAriaHiddenOnFocusable
  a11y/useGenericFontNames
  style/useBlockStatements
  style/noNegationElse
  suspicious/useAwait
  correctness/noUnusedFunctionParameters
  style/noUnusedTemplateLiteral
  style/useExponentiationOperator
  correctness/noUndeclaredVariables
  nursery/useAdjacentOverloadSignatures
  style/noNamespace
  suspicious/noDuplicateAtImportRules
  complexity/noUselessFragments
  complexity/noUselessStringConcat
  correctness/noUnusedImports
  suspicious/noEmptyBlock
  suspicious/noFunctionAssign
  performance/noDelete
  suspicious/noUnsafeNegation
  a11y/useValidLang
  suspicious/useValidTypeof
  a11y/useValidAriaRole
  correctness/noConstantCondition
  a11y/useAriaActivedescendantWithTabindex
  style/useDefaultParameterLast
  complexity/noEmptyTypeParameters
  correctness/noUnknownProperty
  nursery/useTrimStartEnd
  complexity/noUselessTernary
  suspicious/noExplicitAny
  correctness/noSwitchDeclarations
  complexity/noUselessTypeConstraint
  suspicious/noRedundantUseStrict
  style/useLiteralEnumMembers
  suspicious/noGlobalIsNan
  suspicious/noMisleadingCharacterClass
  a11y/noLabelWithoutControl
  suspicious/noRedeclare
  correctness/noStringCaseMismatch
  suspicious/noFallthroughSwitchClause
  complexity/noUselessThisAlias
  correctness/noUnreachable
  complexity/noThisInStatic
  complexity/useOptionalChain
  suspicious/noDuplicateCase
  style/noParameterAssign
  a11y/useValidAnchor
  complexity/useRegexLiterals
  correctness/noSelfAssign
  correctness/noInvalidBuiltinInstantiation
  nursery/useGuardForIn
  style/useShorthandFunctionType
  suspicious/noShadowRestrictedNames
  style/useThrowNewError
  suspicious/noEmptyBlockStatements
  a11y/useMediaCaption
  nursery/useAtIndex
  correctness/noUnsafeFinally
  nursery/useCollapsedIf
  style/useEnumInitializers
  a11y/useHtmlLang
  correctness/noUndeclaredDependencies
  style/useWhile
  suspicious/noConsole
  complexity/useArrowFunction
  style/noInferrableTypes
  a11y/noNoninteractiveTabindex
  complexity/useSimpleNumberKeys
  correctness/useYield
  style/useNumericLiterals
  suspicious/noImportAssign
  suspicious/useDefaultSwitchClauseLast
  correctness/noGlobalObjectCalls
  a11y/useAltText
  performance/noBarrelFile
  suspicious/noSuspiciousSemicolonInJsx
  complexity/noBannedTypes
  style/useThrowOnlyError
  suspicious/noPrototypeBuiltins
  style/useAsConstAssertion
  suspicious/noDebugger
  suspicious/noMisleadingInstantiator
  a11y/useFocusableInteractive
  correctness/noUnmatchableAnbSelector
  suspicious/noDuplicateJsxProps
  correctness/noEmptyPattern
  complexity/noExcessiveNestedTestSuites
  performance/noReExportAll
  security/noDangerouslySetInnerHtmlWithChildren
  a11y/useKeyWithMouseEvents
  suspicious/noExtraNonNullAssertion
  suspicious/noShorthandPropertyOverrides
  style/useConst
  complexity/useFlatMap
  correctness/useIsNan
  suspicious/noGlobalIsFinite
  style/useConsistentBuiltinInstantiation
  suspicious/noDuplicateFontNames
  a11y/noDistractingElements
  style/useConsistentArrayType
  style/useForOf
  a11y/useValidAriaProps
  a11y/noRedundantAlt
  complexity/useDateNow
  suspicious/noConfusingVoidType
  suspicious/noFocusedTests
  a11y/useButtonType
  a11y/useSemanticElements
  correctness/noInvalidGridAreas
  style/useShorthandAssign
  suspicious/useErrorMessage
  correctness/noConstantMathMinMaxClamp
  correctness/noUnusedPrivateClassMembers
  correctness/noVoidTypeReturn
  correctness/noUnknownMediaFeatureName
  nursery/noUselessEscapeInRegex
  a11y/useAnchorContent
  complexity/noUselessRename
  nursery/noSubstr
  style/useNumberNamespace
  complexity/noUselessConstructor
  a11y/noAccessKey
  style/useSingleVarDeclarator
  suspicious/noExportsInTest
  suspicious/useNumberToFixedDigitsArgument
  a11y/noNoninteractiveElementToInteractiveRole
  nursery/noTemplateCurlyInString
  style/noCommaOperator
  suspicious/useIsArray
  a11y/noHeaderScope
  suspicious/noMisrefactoredShorthandAssign
  complexity/noForEach
  suspicious/noClassAssign
  style/useImportType

Workspace:
  Open Documents:               0

Rule name

lint/suspicious/useAwait

Playground link

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

Expected result

The lint/suspicious/useAwait suppression comment should be applied and Biome should not report an error, even if the async function without awaits in it has a biome-ignore comment inside of it.

For the playground: removing the biome-ignore comment on line 3 'fixes' the situation, but obviously reports an error in that position. I've discovered that it does not really matter where the biome-ignore comment is, and if it's even applicable in that situation. As long as there is any biome-ignore comment, the useAwait rule breaks.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@RobinHeidenis RobinHeidenis added the S-Needs triage Status: this issue needs to be triaged label Feb 4, 2025
@ematipico
Copy link
Member

I believe this was fixed in #4714

Duplicate of #4519

The fix was done in next, which is not yet wired with main, that's why you still see the issue

@ematipico ematipico closed this as not planned Won't fix, can't repro, duplicate, stale Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs triage Status: this issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants