dillon1000/react

Commit

Allow capitalized function identifiers to be allowlisted

The current allowlist for capitalized function identifiers only allows stdlib JS 
modules. This PR introduces a new compiler option to allow passing in a set of 
allowed capitalized user function identifiers. It's a hack (in the absence of a 
type system) to let us check that capitalized function calls are only possible 
for identifiers that aren't bound to a React component. 

I considered adding a mechanism in fixtures to configure compiler options 
per-fixture, but opted to keep it simple for now and special case a 
`ReactForgetSecretInternals` identifier as one allowed user function in 
transform tests.
Browse files
Changed paths4 files
First-parent comparison
M compiler/forget/src/CompilerOptions.ts ModifiedM compiler/forget/src/MiddleEnd/SketchyCodeCheck.ts ModifiedM compiler/forget/src/__tests__/CompilerOptions-test.ts ModifiedM compiler/forget/src/__tests__/transform-test.ts Modified
Patch

Files changed

Rendering syntax-highlighted changes…