fix(linter/explicit-module-boundary-types): ignore constructor callbacks#20221
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
Updates the TypeScript explicit-module-boundary-types rule to avoid treating new constructor arguments (notably inline callbacks) as part of an exported module boundary, preventing false positives when exporting instantiated objects.
Changes:
- Add a
visit_new_expressionoverride to skip traversing constructor arguments while still checking the callee and any type arguments. - Add a regression test ensuring an exported
new ...(<callback>)initializer does not trigger diagnostics.
You can also share your feedback on Copilot code review. Take the survey.
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
…cks (#20221) - Ignore constructor arguments when checking `explicit-module-boundary-types` so inline callbacks passed to exported `new` expressions are not treated as module-boundary functions. - Keep traversing the constructor callee so exported instances created from class expressions can still be checked. Fixes #20220
ae73169 to
691f556
Compare
# Oxlint ### 🐛 Bug Fixes - 4ea67de oxlint,oxfmt: Skip `vite.config.ts` exports `defineConfig(fn)` (#20260) (leaysgur) - cc89dbf oxlint: Skip `vite.config.ts` w/o `.lint` field in auto-discovery (#20255) (leaysgur) - 89b7ca9 linter/no-duplicate-imports: Only check aggregated exports (#20178) (kennytm) - 691f556 linter/explicit-module-boundary-types: Ignore constructor callbacks (#20221) (camc314) ### ⚡ Performance - d160dca linter/plugins: Reduce array lookups in visitor compilation (#20249) (overlookmotel) ### 📚 Documentation - 0c7da4f linter: Fix extra closing brace in example config. (#20253) (connorshea) - 13606c3 linter/plugins: Update conformance README (#20234) (overlookmotel) # Oxfmt ### 🐛 Bug Fixes - 4ea67de oxlint,oxfmt: Skip `vite.config.ts` exports `defineConfig(fn)` (#20260) (leaysgur) - 11a2b45 oxfmt: Skip `vite.config.ts` w/o `.fmt` field in auto-discovery (#20254) (leaysgur) Co-authored-by: leaysgur <6259812+leaysgur@users.noreply.github.com>

explicit-module-boundary-typesso inline callbacks passed to exportednewexpressions are not treated as module-boundary functions.Fixes #20220