Skip to content

fix(linter/explicit-module-boundary-types): ignore constructor callbacks#20221

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/03-11-fix_linter_ignore_constructor_callbacks_in_explicit-module-boundary-types
Mar 11, 2026
Merged

fix(linter/explicit-module-boundary-types): ignore constructor callbacks#20221
graphite-app[bot] merged 1 commit intomainfrom
c/03-11-fix_linter_ignore_constructor_callbacks_in_explicit-module-boundary-types

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Mar 11, 2026

  • 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

Copilot AI review requested due to automatic review settings March 11, 2026 09:06
Copy link
Contributor Author

camc314 commented Mar 11, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Mar 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_expression override 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 11, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 52 skipped benchmarks1


Comparing c/03-11-fix_linter_ignore_constructor_callbacks_in_explicit-module-boundary-types (ae73169) with main (856781f)

Open in CodSpeed

Footnotes

  1. 52 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camc314 camc314 changed the title fix(linter): ignore constructor callbacks in explicit-module-boundary-types fix(linter/explicit-module-boundary-types): ignore constructor callbacks Mar 11, 2026
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 11, 2026
@camc314 camc314 self-assigned this Mar 11, 2026
Copy link
Contributor Author

camc314 commented Mar 11, 2026

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
@graphite-app graphite-app bot force-pushed the c/03-11-fix_linter_ignore_constructor_callbacks_in_explicit-module-boundary-types branch from ae73169 to 691f556 Compare March 11, 2026 09:18
@graphite-app graphite-app bot merged commit 691f556 into main Mar 11, 2026
21 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 11, 2026
@graphite-app graphite-app bot deleted the c/03-11-fix_linter_ignore_constructor_callbacks_in_explicit-module-boundary-types branch March 11, 2026 09:24
leaysgur added a commit that referenced this pull request Mar 12, 2026
# 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: false positive for explicit-module-boundary-types

2 participants