7.1.1
Note: 7.1.0 accidentally removed the component-hook-factories rule, causing errors for users who referenced it in their ESLint config. This is now fixed.
7.1.0
This release adds ESLint v10 support, improves performance by skipping compilation for non-React files, and includes compiler lint improvements including better set-state-in-effect detection, improved ref validation, and more helpful error reporting.
- Add ESLint v10 support. (@azat-io in #35720)
- Skip compilation for non-React files to improve performance. (@josephsavona in #35589)
- Fix exhaustive deps bug with Flow type casting. (@jorge-cab in #35691)
- Fix
useEffectEventchecks in component syntax. (@jbrown215 in #35041) - Improved
set-state-in-effectvalidation with fewer false negatives. (@jorge-cab in #35134, @josephsavona in #35147, @jackpope in #35214, @chesnokov-tony in #35419, @jsleitor in #36107) - Improved ref validation for non-mutating functions and event handler props. (@josephsavona in #35893, @kolvian in #35062)
- Compiler now reports all errors instead of stopping at the first. (@josephsavona in #35873–#35884)
- Improved source locations and error display in compiler diagnostics. (@nathanmarks in #35348, @josephsavona in #34963)
7.0.1
- Disallowed passing inline
useEffectEventvalues as JSX props to guard against accidental propagation. (#34820 by @jf-eirinha) - Switch to
export =so eslint-plugin-react-hooks emits correct types for consumers in Node16 ESM projects. (#34949 by @karlhorky) - Tightened the typing of
configs.flatso theconfigsexport is always defined. (#34950 by @poteto) - Fix named import runtime errors. (#34951, #34953 by @karlhorky)
7.0.0
This release slims down presets to just 2 configurations (recommended and recommended-latest), and all compiler rules are enabled by default.
- Breaking: Removed
recommended-latest-legacyandflat/recommendedconfigs. The plugin now providesrecommended(legacy and flat configs with all recommended rules), andrecommended-latest(legacy and flat configs with all recommended rules plus new bleeding edge experimental compiler rules). (@poteto in #34757)
6.1.1
Note: 6.1.0 accidentally allowed use of recommended without flat config, causing errors when used with ESLint v9's defineConfig() helper. This has been fixed in 6.1.1.
- Fix
recommendedconfig for flat config compatibility. Therecommendedconfig has been converted to flat config format. Non-flat config users should userecommended-legacyinstead. (@poteto in #34700) - Add
recommended-latestandrecommended-latest-legacyconfigs that include React Compiler rules. (@poteto in #34675) - Remove unused
NoUnusedOptOutDirectivesrule. (@poteto in #34703) - Remove
hermes-parserand dependency. (@poteto in #34719) - Remove
@babel/plugin-proposal-private-methodsdependency. (@ArnaudBarre and @josephsavona in #34715) - Update for Zod v3/v4 compatibility. (@kolian and @josephsavona in #34717)
6.1.0
Note: Version 6.0.0 was mistakenly released and immediately deprecated and untagged on npm. This is the first official 6.x major release and includes breaking changes.
- Breaking: Require Node.js 18 or newer. (@michaelfaith in #32458)
- Breaking: Flat config is now the default
recommendedpreset. Legacy config moved torecommended-legacy. (@michaelfaith in #32457) - New Violations: Disallow calling
usewithin try/catch blocks. (@poteto in #34040) - New Violations: Disallow calling
useEffectEventfunctions in arbitrary closures. (@jbrown215 in #33544) - Handle
React.useEffectin addition touseEffectin rules-of-hooks. (@Ayc0 in #34076) - Added
react-hookssettings config option that to acceptadditionalEffectHooksthat are used across exhaustive-deps and rules-of-hooks rules. (@jbrown215) in #34497
6.0.0
Accidentally released. See 6.1.0 for the actual changes.
5.2.0
- Support flat config (@michaelfaith in #30774)
- Convert the plugin to TypeScript and provide package type declarations (@michaelfaith in #32279, #32283, #32240, #32400 and @poteto in #32420)
- Fix false positive error in components with
do/whileloops (@tyxla in #31720) - Detect issues in class properties (@mjesun & @ecraig12345 in #31823)
5.1.0
- Add support for
do/whileloops (@tyxla in #28714) - Fix error when callback argument is an identifier with an
asexpression (@mskelton in #31119)
5.0.0
- New Violations: Component names now need to start with an uppercase letter instead of a non-lowercase letter. This means
_Buttonor_componentare no longer valid. (@kassens) in #25162
- Consider dispatch from
useActionStatestable. (@eps1lon in #29665) - Add support for ESLint v9. (@eps1lon in #28773)
- Accept
asexpression in callback. (@StyleShit in #28202) - Accept
asexpressions in deps array. (@StyleShit in #28189) - Treat
React.use()the same asuse(). (@kassens in #27769) - Move
use()lint to non-experimental. (@kassens in #27768) - Support Flow
asexpressions. (@cpojer in #27590) - Allow
useEffect(fn, undefined). (@kassens in #27525) - Disallow hooks in async functions. (@acdlite in #27045)
- Rename experimental
useEventtouseEffectEvent. (@sebmarkbage in #25881) - Lint for presence of
useEventfunctions in dependency lists. (@poteto in #25512) - Check
useEventreferences instead. (@poteto in #25319) - Update
RulesOfHookswithuseEventrules. (@poteto in #25285)
4.6.0
4.5.0
4.4.0
- No changes, this was an automated release together with React 18.
4.3.0
- Support ESLint 8. (@MichaelDeBoey in #22248)
- Fix a crash with an empty effect. (@ChrisRu in #20385)
- Improve the error message. (@callmetwan in #20692)
- Handle optional chained methods as dependency. (@AriPerkkio in #20247)
- Assume the new
useTransitionsignature in the rule. (@rickhanlonii in #20976)
4.2.0
- No changes, this was an automated release together with React 17.
4.1.2
4.1.1
- Improve support for optional chaining. (@pfongkye in #19680)
- Fix a false positive warning for TypeScript parameters. (@NeoRaider in #19751)
4.1.0
- New Violations: Warn when dependencies change on every render. (@captbaritone in #19590)
4.0.8
4.0.7
4.0.6
4.0.5
- Fix a crash when the dependency array has an empty element. (@yeonjuan in #19145)
- Fix a false positive warning that occurs with optional chaining. (@fredvollmer in #19061)
4.0.4
- Fix a false positive warning that occurs with optional chaining. (@fredvollmer in #19061)
- Support nullish coalescing and optional chaining. (@yanneves in #19008)
4.0.3
- Remove the heuristic that checks all Hooks ending with
Effectdue to too many false positives. (@gaearon in #19004)
4.0.2
- Prevent Hooks that have
Effectin the middle from being considered effects. (@surgeboris in #18907)
4.0.1
- Declare support for ESLint 7. (@MichaelDeBoey in #18878)
4.0.0
- New Violations: Consider
PascalCase.useFoo()calls as Hooks. (@cyan33 in #18722) - New Violations: Check callback body when it's not written inline. (@gaearon in #18435)
- New Violations: Check dependencies for all Hooks ending with
Effect. (@airjp73 in #18580) - Add a way to enable the dangerous autofix. (@gaearon in #18437)
- Offer a more sensible suggestion when encountering an assignment. (@Zzzen in #16784)
- Consider TypeScript casts of
useRefas constant. (@sophiebits in #18496) - Add documentation. (@ghmcadams in #16607)
3.0.0
- New Violations: Forbid calling Hooks from classes. (@ianobermiller in #18341)
- Add a recommended config. (@SimenB in #14762)
2.5.0
- Fix a misleading error message in loops. (@M-Izadmehr in #16853)
2.4.0
- New Violations: Run checks for functions passed to
forwardRef. (@dprgarner in #17255) - New Violations: Check for ref usage in any Hook containing the word
Effect. (@gaearon in #17663) - Disable dangerous autofix and use ESLint Suggestions API instead. (@wdoug in #17385)
2.0.0
- New Violations: Forbid calling Hooks at the top level. (@gaearon in #16455)
- Fix a crash when referencing arguments in arrow functions. (@hristo-kanchev in #16356)
1.x
The 1.x releases aren’t noted in this changelog, but you can find them in the commit history.