compat-eslint: SyntheticLazyNode base β architectural boundary for synthetic intermediates#91
Merged
Merged
Conversation
β¦nthetic intermediates Synthetic intermediate classes (TSTypeAnnotation, ClassBody, ChainExpression wrapper, etc.) opted out of map registration via a `registerInMaps=false` constructor arg. Easy to forget β and a forgotten synthetic class produces silently-wrong parents on bottom-up materialise because the wrapper-route tables don't see it. Replace the boolean param with a `SyntheticLazyNode` abstract base. The 14 synthetic-creating classes now `extend SyntheticLazyNode` instead of `extend LazyNode`; the base overrides `_registersInMaps()` to return false. Adding a 15th synthetic class is now a visible architectural act in code review (extends a different base + needs a navigation-table entry). Grep `extends SyntheticLazyNode` to find all current synthetic classes. JSXOpeningElementNode is hybrid (synthetic only when wrapping a JsxSelfClosingElement); keeps the LazyNode base but overrides `_registersInMaps()` to dispatch on `this._ts.kind`. Drops the now-unneeded `synthetic` constructor arg. Also drops a dead `registerInMaps` param on JSXIdentifierNode (all 6 call sites passed `true`) and stale comments referencing the removed flag. Tested: predicate-coverage / lazy-estree / scope-compat / selector-analysis / ts-ast-scan / compat-pipeline + dogfood (107 rules Γ 30 files clean) + Dify cold/warm bench (no regression vs master).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TSTypeAnnotation/ClassBody/ChainExpression-wrapper) used to opt out of map registration via aregisterInMaps=falseconstructor flag. Easy to forget when adding a new synthetic class β and a forgotten one produces silently-wrongparentreferences on bottom-up materialise.SyntheticLazyNode, an abstract base that overrides_registersInMaps()to return false. The 14 synthetic-creating classes nowextend SyntheticLazyNodeinstead ofextend LazyNode. Adding a 15th is a visible architectural act in code review.JSXOpeningElementNodeis hybrid (synthetic only when wrapping aJsxSelfClosingElement) β keepsLazyNodebase but overrides_registersInMaps()based onthis._ts.kind, so thesyntheticconstructor arg is gone too.registerInMapsparam onJSXIdentifierNode(all 6 call sites passedtrue) and stale comments referencing the removed flag.Why this is the last phase
TSJsxAttributes)KnownEstreeTypecompile-time gateSyntheticLazyNodeboundaryAfter this, every "synthetic intermediate" is grep-able in one place (
extends SyntheticLazyNode) and the registration distinction is a class boundary, not a magic constructor arg.Test plan
predicate-coverage(152/152 covered, 16 ignored)lazy-estree.test(parity sweep + factory tests + phantom-types invariant)scope-compat(24/24 fixtures clean)selector-analysis,ts-ast-scan,compat-pipelinedogfood.jsβ 107 rules Γ 30 files, 0 divergences, 0 crashes