Skip to content

fix: no-async-promise-executor false positives for shadowed Promise#20740

Merged
DMartens merged 1 commit into
eslint:mainfrom
xbinaryx:no-async-promise-executor-shadowed-promise
Apr 11, 2026
Merged

fix: no-async-promise-executor false positives for shadowed Promise#20740
DMartens merged 1 commit into
eslint:mainfrom
xbinaryx:no-async-promise-executor-shadowed-promise

Conversation

@xbinaryx

@xbinaryx xbinaryx commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Prerequisites checklist

AI acknowledgment

  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

Tell us about your environment (npx eslint --env-info):

  • Node version: v22.22.2
  • npm version: v10.9.7
  • Local ESLint version: v10.2.0
  • Global ESLint version: Not found
  • Operating System: darwin

What parser are you using (place an "X" next to just one item)?

[x] Default (Espree)
[ ] @typescript-eslint/parser
[ ] @babel/eslint-parser
[ ] vue-eslint-parser
[ ] @angular-eslint/template-parser
[ ] Other

Please show your full configuration:

Configuration
export default [
	{
		rules: {
			"no-async-promise-executor": "error",
		},
	},
];

What did you do? Please include the actual source code causing the issue.

let Promise;
new Promise(async (resolve, reject) => {});

What did you expect to happen?

I expected no error, because these cases do not call the built-in global Promise constructor, so the rule should not treat the first argument as a Promise executor.

What actually happened? Please include the actual, raw output from ESLint.

The rule reported Promise executor functions should not be async.

What changes did you make? (Give an overview)

Updated no-async-promise-executor to only report when new Promise(...) refers to the actual global Promise.

Is there anything you'd like reviewers to focus on?

@eslint-github-bot eslint-github-bot Bot added the bug ESLint is working incorrectly label Apr 10, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Apr 10, 2026
@netlify

netlify Bot commented Apr 10, 2026

Copy link
Copy Markdown

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 15320c5
🔍 Latest deploy log https://app.netlify.com/projects/docs-eslint/deploys/69d88f52a0b7a20008130037

@github-actions github-actions Bot added the rule Relates to ESLint's core rules label Apr 10, 2026
@xbinaryx xbinaryx marked this pull request as ready for review April 10, 2026 06:06
@xbinaryx xbinaryx requested a review from a team as a code owner April 10, 2026 06:06

@DMartens DMartens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM, thanks.

@DMartens DMartens merged commit 84a19d2 into eslint:main Apr 11, 2026
40 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Triage to Complete in Triage Apr 11, 2026
@xbinaryx xbinaryx deleted the no-async-promise-executor-shadowed-promise branch June 23, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug ESLint is working incorrectly contributor pool rule Relates to ESLint's core rules

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants