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

bug(linter): incorrect fix for no-single-promise-in-promise-methods #4093

Closed
DonIsaac opened this issue Jul 7, 2024 · 0 comments · Fixed by #4094
Closed

bug(linter): incorrect fix for no-single-promise-in-promise-methods #4093

DonIsaac opened this issue Jul 7, 2024 · 0 comments · Fixed by #4094
Assignees
Labels
A-linter Area - Linter C-bug Category - Bug

Comments

@DonIsaac
Copy link
Collaborator

DonIsaac commented Jul 7, 2024

This happens in cases where the awaited Promise.all is assigned to a variable.

Example 1: array unpacking

const [x] = await Promise.all([getSomeData()])

// turns into
const [x] = await getSomeData()

// but should be
const x = await getSomeData()

Example 2: simple assignment targets

const arr = await Promise.all([getSomeData()])
console.log('waited for ', arr.length, 'fetch requests')

// turns into
const arr = getSomeData()
console.log('waited for ', arr.length, 'fetch requests') // not an array anymore, has incorrect semantics

// we should not auto-fix this case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant