Commit 6014afd
test: comprehensive unit-test coverage for sx-aware auto-detection
Expands the wrapped-component-interface test suite to 43 cases organised
by intent, documenting both supported patterns and known limitations of
the static walker. Sections:
- Positive: prop type signatures
* function declarations / arrow / function expression
* required vs optional sx
* string-literal property keys
* any-typed sx values
* default exports
* non-exported declarations (the consumer's import is what makes it
'exported' for the codemod's purposes)
- Positive: type alias / interface resolution
* single alias hop, intersection (Text-style generic component),
nested chain, interface
* union types where one branch carries sx
* parenthesised types
* cyclic aliases (no infinite loop)
- Negative: sx absent or out of reach
* plain components, Omit<…, "sx">, Pick utility narrowing
* sx as a string literal value of an unrelated prop
* sx mentioned only in a comment
* components with no parameters / no parameter type annotation
* sx on a sibling component
* unknown local name
* package-style imports (no source path on disk)
- Negative: documented walker limitations
* React.FC<Props> generic on the variable annotation
* forwardRef HOC wrapper
* interface 'extends' clauses
* type imports across files
- File-system edge cases
* missing file, empty file, syntax error (no throw)
* extension probing for bare absolute paths
- Adapter override semantics
* true / false / undefined fallthrough
* package-import override path
* useSxProp disabled
* missing or empty importMap
- Caching
* repeat lookups stay consistent
* (file, componentName) keying — different components in same file
do not poison each other
Co-authored-by: Kenneth Skovhus <skovhus@users.noreply.github.com>1 parent 36ca8eb commit 6014afd
1 file changed
Lines changed: 562 additions & 124 deletions
0 commit comments