Skip to content

fix(no-export): handle nested assignment chains - #2009

Merged
G-Rath merged 1 commit into
mainfrom
no-exports-chain
Aug 27, 2026
Merged

G-Rath merged 1 commit into
mainfrom
no-exports-chain

Conversation

@G-Rath

@G-Rath G-Rath commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

I'll add support for literal accessors next

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the no-export ESLint rule to correctly detect exports when module.exports is accessed through deeper member-expression chains (e.g. module.exports.exports.exports = ...) and adds regression tests to cover the new behavior.

Changes:

  • Update the no-export rule to walk up nested MemberExpression objects until the root identifier is reached.
  • Add valid test cases covering computed-access chains (no test-case present, so rule should not report).
  • Add invalid test cases ensuring deep module.exports.* chains are reported once a Jest test/describe is present.

Reviewed changes

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

File Description
src/rules/no-export.ts Switches from a single-step unwrap to a loop to handle nested module.exports... member chains.
src/rules/tests/no-export.test.ts Adds regression coverage for nested export chains (and additional non-reporting valid cases).

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

@G-Rath
G-Rath merged commit 14b559a into main Aug 27, 2026
49 of 50 checks passed
@G-Rath
G-Rath deleted the no-exports-chain branch August 27, 2026 19:46
github-actions Bot pushed a commit that referenced this pull request Aug 27, 2026
## [29.16.4](v29.16.3...v29.16.4) (2026-08-27)

### Bug Fixes

* **no-export:** handle nested assignment chains ([#2009](#2009)) ([14b559a](14b559a))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 29.16.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants