Thanks to visit codestin.com
Credit goes to github.com

Skip to content

noFloatingPromise lint error #6985

@SethWen

Description

@SethWen

Environment information

biome 2.1.2

Rule name

noFloatingPromise

Playground link

https://biomejs.dev/playground/?lintRules=noFloatingPromises&code=ZgB1AG4AYwB0AGkAbwBuACAAZABvAFMAdABoACgAKQAgAHsACgAgACAAIAAgAGMAbwBuAHMAdAAgAGkAbgBuAGUAcgBGAG4AIAA9ACAAKAApACAAPQA%2BACAAewAKACAAIAAgACAAIAAgACAAIAByAGUAdAB1AHIAbgAgAFAAcgBvAG0AaQBzAGUALgByAGUAcwBvAGwAdgBlACgAMQApADsACgAgACAAIAAgAH0ACgAgACAAIAAgAHIAZQB0AHUAcgBuACAAJwBoAGEAaAAnAAoAfQAKAAoAZABvAFMAdABoACgAKQA%3D

Expected result

function doSth() {
    const innerFn = () => {
        return Promise.resolve(1);
    }
    return 'hah'
}


//   ✖ A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.
doSth()

However the doSth is not an async function.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-LinterArea: linterL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions