Repository navigation
Conversation
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.
Problem
no-manual-tagged-constructionincorrectly flags literal_tagobjects inMatchpatterns as value construction when nested inside objects/arrays or used with multi-predicate helpers likeMatch.whenAnd:Previously,
isMatchPatternObjectonly checkednode.parentdirectly forMatch.whenorMatch.not, which failed for nested containers and missedwhenAnd/whenOr.Solution
Walk outward from the
_tagObjectExpressionthrough nested pattern containers (properties withinObjectExpression,ArrayExpression, and parentheses) to the enclosingMatchcall, ensuring the containing argument is a pattern/predicate and not a handler:flowchart TD Node["ObjectExpression with _tag"] --> Loop{"Walk Up Containers"} Loop -->|"Property.value in Object"| Obj["Parent ObjectExpression"] Loop -->|"Element in Array"| Arr["Parent ArrayExpression"] Loop -->|"Expression in Parentheses"| Paren["Parent ParenthesizedExpression"] Obj --> Loop Arr --> Loop Paren --> Loop Loop -->|"Boundary / Enclosing Call"| Call{"Enclosing Call"} Call -->|"Match.when / not / whenAnd / whenOr"| CheckArg{"Argument Position"} Call -->|"Other function or boundary"| Flag["❌ Flag as manualConstruction"] CheckArg -->|"Pattern argument (index < last)"| Pass["✅ Allowed pattern"] CheckArg -->|"Handler argument (last argument)"| FlagChanges
isMatchPatternObjectinsrc/effect/shared/tagged-values.tsto support outward container traversal.Match.when,Match.not,Match.whenAnd, andMatch.whenOr(supporting bothMatch.*andEffect.Match.*).src/effect/rules/no-manual-tagged-construction.test.ts.pnpm sync:skill-assets.