dillon1000/react
Commit
Browse files ValidateHooksUsage
Adds a validation pass to check that the only thing you can do with hooks is call them. A follow-up PR (still early WIP) will check the other aspect of the rules of hooks, that they are not called conditionally. That's a more involved algorithm.
Changed paths16 files
First-parent comparisoncompiler/forget/packages/snap/src/compiler-worker.ts ModifiedM compiler/forget/src/CompilerPipeline.ts ModifiedM compiler/forget/src/HIR/Environment.ts ModifiedA compiler/forget/src/HIR/ValidateHooksUsage.ts AddedM compiler/forget/src/HIR/index.ts ModifiedM compiler/forget/src/Optimization/DeadCodeElimination.ts ModifiedM compiler/forget/src/__tests__/compiler-test.ts ModifiedA compiler/forget/src/__tests__/fixtures/compiler/error.invalid-assign-hook-to-local.expect.md AddedR compiler/forget/src/__tests__/fixtures/compiler/useRef-rename-mutable.js →compiler/forget/src/__tests__/fixtures/compiler/error.invalid-assign-hook-to-local.js RenamedA compiler/forget/src/__tests__/fixtures/compiler/error.invalid-pass-hook-as-call-arg.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/error.invalid-pass-hook-as-call-arg.js AddedA compiler/forget/src/__tests__/fixtures/compiler/error.invalid-pass-hook-as-prop.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/error.invalid-pass-hook-as-prop.js AddedA compiler/forget/src/__tests__/fixtures/compiler/error.invalid-ternary-with-hook-values.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/error.invalid-ternary-with-hook-values.js AddedD compiler/forget/src/__tests__/fixtures/compiler/useRef-rename-mutable.expect.md DeletedPatch
Files changed
Rendering syntax-highlighted changes…