fix(no-export): don't report on assignment to locals named module#1976
Conversation
G-Rath
left a comment
There was a problem hiding this comment.
I'm heading to bed right now but can review tomorrow.
Could you pull some of these changes out into dedicated PRs so they can have their own changelog entries? That'll also hopefully help with getting coverage sorted
Require the exact exports property name instead of matching export typos, and ignore assignments when module or exports refers to a local binding. Co-authored-by: Cursor <cursoragent@cursor.com>
Add a test case for module[exports] assignments when exports refers to the global CommonJS binding, satisfying the 100% coverage requirement. Co-authored-by: Cursor <cursoragent@cursor.com>
0de8487 to
43b2ac0
Compare
Hi @G-Rath, I've refactored the pr into three, another two are #1977 and #1978. And now you can review them when you're available. |
G-Rath
left a comment
There was a problem hiding this comment.
if I've understood right, this is mainly about ensuring we're checking the global module and exports? if so I'd be keen to land that specifically next as it's a clear bug
Yes, that's right. This PR is now scoped to the global CommonJS |
|
cool in that case can you not drop support for |
Okay, I've updated. |
| 'export default function () {}', | ||
| 'module.exports = function(){}', | ||
| 'module.exports.myThing = "valid";', | ||
| dedent` |
There was a problem hiding this comment.
this is the main test I expect to see in your diff for "don't report on assignment to locals named module" - so long as the other tests and the related code required to support them is present, you have changes to make
There was a problem hiding this comment.
this is the main test I expect to see in your diff for "don't report on assignment to locals named
module" - so long as the other tests and the related code required to support them is present, you have changes to make
Updated.
…nt-plugin-jest into fix/no-export-rule-update * 'fix/no-export-rule-update' of github.com:eryue0220/eslint-plugin-jest: chore(deps): update danger/danger-js action to v13.0.10 (jest-community#1983) chore(release): 29.15.3 [skip ci] fix(no-export): treat describe blocks as test files (jest-community#1978)
module
## [29.15.4](v29.15.3...v29.15.4) (2026-06-30) ### Bug Fixes * **no-export:** don't report on assignment to locals named `module` ([#1976](#1976)) ([da02c0c](da02c0c))
|
🎉 This PR is included in version 29.15.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes false positives in
jest/no-exportwhen detecting CommonJS export assignments in test files.exportsproperty name instead of matchingexporttypos via/^exports?$/.moduleorexportsrefers to a local binding.Follow-up PRs will cover missed detection patterns (
module["exports"], nested chains) and treatingdescribeblocks as test files.