package react-rules-of-hooks-ppx
This ppx validates the rules of React hooks in reason-react components
Install
dune-project
Dependency
Authors
Maintainers
Sources
react-rules-of-hooks-ppx-1.1.0.tbz
sha256=74e2877586bf3ee984ade800636affaadd08273d4c997bdd92dccc0e4ddffc71
sha512=49eb112d8155c14fb075b3b2da3d7261bbedad71a0d79ee995bb1cecf4b25d7edcb7a4ee5e7774fe46daa62242ba8ee08c5eb5a33948b59e01f1243ab7a43f4c
doc/CHANGES.html
Changes
1.1.0
- [FEAT] Disable order of hooks attribute
[@disable_order_of_hooks] - [CHORE] Add mlx as
:with-testand:with-dev-setup(previously only:with-dev-setup) - [FIX] Add support for snake_case hooks (
use_state,use_effect,use_custom_hook) - [FIX] SVG
<use>element no longer incorrectly flagged as a hook (JSX elements excluded from hook detection) - [FIX] False positive when multiple hooks are defined
- [FIX] Hooks name can be "use"
- [FIX] Fix static deps scope leaking between components (useState setters, useReducer dispatchers, useRef results now properly scoped per component)
- [FIX] JSX context reset bug where multiple hooks in the same JSX element weren't all flagged as violations
- [FEAT] Add
Pexp_letopsupport for monadiclet+/and+syntax in exhaustive deps checking - [TEST] Add test cases inspired by React's eslint-plugin-react-hooks
- [FEAT] Add
REACT_HOOKS_PPX_TIMINGenv var to print timing diagnostics - [FIX] Use Set for O(log n) lookups, single-pass AST analysis, caching
- [FIX] Simplify diff function
- [FIX] Replace
List.length > 0with<> [] - [FIX] Optimize
find_duplicatesto deduplicate during traversal
1.0.0
- [FEAT] Detect hooks called conditionally, in loops, or in nested functions
- [FEAT] Detect hooks called outside of
[@react.component]functions or custom hooks - [FEAT] Check exhaustive dependencies in
useEffect,useMemo,useCallback,useLayoutEffect, anduseInsertionEffect - [FEAT] Disable order of hooks check globally with
-order-of-hooksppx flag - [FEAT] Disable exhaustive deps check globally with
-exhaustive-depsppx flag - [FEAT] Suppress exhaustive deps warning locally with
[@disable_exhaustive_deps]attribute - [FEAT]
-correctionsflag to generate.ppx-correctedfiles with suggested fixes for missing dependencies - [FIX] Improve
-correctionsaccording to the reason-react interface