refactor(linter): typescript/explicit_module_boundary_types do not construct IdentifierName#23044
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
This PR updates the typescript/explicit_module_boundary_types linter rule to avoid constructing AST node types directly (specifically IdentifierName), aligning the rule with the post-#[non_exhaustive] AST construction requirement that new AST nodes be built via AstBuilder. It introduces a lightweight TargetSymbol wrapper to carry only the Span + symbol name needed for diagnostics and allowedNames checks.
Changes:
- Replace
IdentifierName-based storage for “target symbol” metadata with a newTargetSymbol { span, name }struct. - Remove now-unneeded imports (
Cell,Ident,NodeId) tied to manual AST node construction. - Update allowed-name checks to use
&strfor function names and target symbol names.
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
…construct `IdentifierName` (#23044) #23046 adds `#[non_exhaustive]` to all AST node types, which forces all AST node construction to go through `AstBuilder`. `typescript/explicit_module_boundary_types` rule was manually constructing `IdentifierName`s, which violates this rule. The rule doesn't actually need to construct `IdentifierName`s - it was just using the type as a convenient way to store a `Span` + `&str` pair. Replace it with a `TargetSymbol` type which contains that data.
4136a3d to
388af9d
Compare

#23046 adds
#[non_exhaustive]to all AST node types, which forces all AST node construction to go throughAstBuilder.typescript/explicit_module_boundary_typesrule was manually constructingIdentifierNames, which violates this rule.The rule doesn't actually need to construct
IdentifierNames - it was just using the type as a convenient way to store aSpan+&strpair. Replace it with aTargetSymboltype which contains that data.