Skip to content

[Fix] no-named-as-default-member: ignore computed property access and destructuring - #3320

Open
CHX606 wants to merge 1 commit into
import-js:mainfrom
CHX606:fix/no-named-as-default-member-computed
Open

CHX606 wants to merge 1 commit into
import-js:mainfrom
CHX606:fix/no-named-as-default-member-computed

Conversation

@CHX606

@CHX606 CHX606 commented Nov 24, 2026

Copy link
Copy Markdown

Summary

  • Ignore computed member expressions (e.g. obj[key], obj?.[key]) and non-identifier properties (such as private fields obj.#prop) in no-named-as-default-member, since computed identifier brackets evaluate a runtime expression rather than accessing a static property named after the identifier.
  • Ignore computed or non-identifier keys when destructuring a default import (const { [key]: val } = obj).
  • Add regression test cases covering computed member access, computed destructuring, optional chaining, private fields, and Babel/TypeScript parsers.

Fixes #1952

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.62%. Comparing base (a60d715) to head (13ba3f2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3320      +/-   ##
==========================================
+ Coverage   79.59%   79.62%   +0.02%     
==========================================
  Files          98       98              
  Lines        4549     4549              
  Branches     1543     1576      +33     
==========================================
+ Hits         3621     3622       +1     
+ Misses        928      927       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

no-named-as-default-member rule is broken in specific cases

1 participant