Skip to content

Fix no-new-null for native private members - #5947

Merged
Bharat Middha (bmiddha) merged 1 commit into
mainfrom
bmiddha/fix-no-new-null-native-private
Aug 21, 2026
Merged

Fix no-new-null for native private members#5947
Bharat Middha (bmiddha) merged 1 commit into
mainfrom
bmiddha/fix-no-new-null-native-private

Conversation

@bmiddha

@bmiddha Bharat Middha (bmiddha) commented Aug 20, 2026

Copy link
Copy Markdown
Member

Summary

  • treat class members keyed by an ECMAScript PrivateIdentifier as private
  • stop @rushstack/no-new-null from reporting null types that cannot escape through native private fields, methods, getters, or setters
  • add regression coverage for each native private member form

Validation

  • reproduced six false positives with the regression test before the fix
  • rush build --to @rushstack/eslint-plugin --verbose
  • rush test --only @rushstack/eslint-plugin --verbose (197 tests)

Dependents

#5939, #5941, #5942, and #5943 are stacked on this fix because their native-private migrations expose the false positive.

Treat PrivateIdentifier class keys like TypeScript private members so no-new-null does not report private API types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8ebd5bf2-c44b-42d5-be25-e7936d4b0a14

Copilot AI 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.

Pull request overview

Updates no-new-null to recognize native ECMAScript private class members as non-public.

Changes:

  • Detects PrivateIdentifier member keys.
  • Adds regression coverage for private fields, methods, getters, and setters.
  • Records a patch release change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
eslint/eslint-plugin/src/no-new-null.ts Excludes native private members from reports.
eslint/eslint-plugin/src/test/no-new-null.test.ts Adds native-private regression cases.
common/changes/@rushstack/eslint-plugin/native-private-null_2026-08-19-22-58-08.json Adds the patch change record.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bmiddha
Bharat Middha (bmiddha) merged commit 1ab4d11 into main Aug 21, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Needs triage to Closed in Bug Triage Aug 21, 2026
@bmiddha
Bharat Middha (bmiddha) deleted the bmiddha/fix-no-new-null-native-private branch August 21, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

3 participants