Commit e38115e
fix(linter): catch missing return type on exported arrow/function expressions (#19587)
## Summary
- `run_on_exported_expression_inner` called `walk::walk_arrow_function_expression` (the raw walk function) instead of `checker.visit_arrow_function_expression`. The raw walk visits AST children but bypasses
`ExplicitTypesChecker::visit_arrow_function_expression`, which is the method that calls `check_arrow_without_return`. Block-body arrow functions with no inner function expressions produced no diagnostic.
- Added symmetric fix for `FunctionExpression`: `export default (function() { ... })` was silently ignored by the `_` arm.
### Incorrect behavior before fix
```ts
// Not flagged by oxlint, but should be
export default ({
connectorTypeEnumCase,
connectorFriendlyName,
}: {
connectorTypeEnumCase: string;
connectorFriendlyName: string;
}) => {
return `${connectorTypeEnumCase}`;
};
```
### Snapshot correction
`export default () => (true ? () => {} : (): void => {})` now points to the outer exported arrow (the module boundary) instead of the inner `() => {}`.
## Test plan
- [ ] Existing `explicit_module_boundary_types` tests all pass
- [ ] New fail test: destructured-param arrow with block body
- [ ] New fail test: `export default (function() { ... })`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Cameron <cameron.clark@hey.com>1 parent 419d3fd commit e38115e
File tree
2 files changed
+44
-4
lines changed- crates/oxc_linter/src
- rules/typescript
- snapshots
2 files changed
+44
-4
lines changedLines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
236 | 239 | | |
237 | 240 | | |
238 | 241 | | |
| |||
2000 | 2003 | | |
2001 | 2004 | | |
2002 | 2005 | | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
2003 | 2023 | | |
2004 | 2024 | | |
2005 | 2025 | | |
| |||
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
118 | | - | |
| 117 | + | |
119 | 118 | | |
120 | | - | |
| 119 | + | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| |||
717 | 716 | | |
718 | 717 | | |
719 | 718 | | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
0 commit comments