feat: add promise/avoid-new rule#1053
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the promise/avoid-new rule to the promise plugin, aligning behavior (and baseline tests) with eslint-plugin-promise rule avoid-new as part of the #474 rule-porting effort.
Changes:
- Implement
promise/avoid-newrule logic (reportnew Promise(...)when callee is the identifierPromise, matching upstream behavior). - Add upstream-aligned and extra edge/shape Go test suites, plus the corresponding TypeScript rule-tester suite and config registration.
- Add rule documentation and extend the project dictionary for “promisify” terms.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scripts/dictionary.txt | Adds “promisify/promisifying” to spelling dictionary. |
| packages/rslint-test-tools/tests/eslint-plugin-promise/rules/avoid-new.test.ts | Adds TS-side RuleTester coverage for avoid-new. |
| packages/rslint-test-tools/rstest.config.mts | Registers the new TS test file in the rstest include list. |
| internal/plugins/promise/rules/avoid_new/avoid_new.md | Adds documentation for the new rule. |
| internal/plugins/promise/rules/avoid_new/avoid_new.go | Implements the promise/avoid-new rule. |
| internal/plugins/promise/rules/avoid_new/avoid_new_upstream_test.go | Ports upstream valid/invalid cases with position assertions. |
| internal/plugins/promise/rules/avoid_new/avoid_new_extras_test.go | Adds additional edge-case coverage specific to this port/AST behavior. |
| internal/plugins/promise/all.go | Registers avoid_new.AvoidNewRule in the promise plugin rule list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
905c5f0 to
1fe6ad1
Compare
fansenze
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added
promise/avoid-newrule for #474.Related Links
original docs
Checklist