@ospm/eslint-plugin-react-unhookify weekly downloads statistics
By ospm · npm · ESLint plugins
ESLint plugin to remove React hooks (useMemo, useCallback) and memo HOC for cleaner React code
@ospm/eslint-plugin-react-unhookify has 34,770 recorded weekly downloads on npm, ranking #849 of 2,703 tracked listings.
About @ospm/eslint-plugin-react-unhookify
eslint-plugin-react-unhookify
ESLint plugin to remove React hooks (useMemo, useCallback) and memo HOC for cleaner React code.
Note: With React Compiler 1.0 now stable, automatic memoization is handled at build time. This plugin is most useful for:
- Projects using React Compiler
- Codebases where manual memoization was over-used
- Migrating legacy code before adopting React Compiler
Philosophy
This plugin follows the philosophy that:
- Memoization should be intentional: Only use memoization when you have measured performance problems
- Code simplicity matters: Unnecessary memoization adds complexity without benefits
- React is fast: Modern React is already optimized, and premature optimization can hurt more than help
- Developer experience: Cleaner code is easier to read, maintain, and debug
React Compiler 1.0 Context
React Compiler 1.0 (released October 2025) provides automatic memoization at build time, making manual useMemo, useCallback, and React.memo unnecessary in most cases.
Key Benefits of React Compiler
- Automatic optimization: Analyzes component data flow and memoizes automatically
- Better than manual: Can memoize in cases where hooks cannot be used (e.g., after early returns)
- Production proven: Battle-tested at Meta with 12% faster loads and 2.5× faster interactions
- Zero code changes: Works without requiring code rewrites
When to Use This Plugin vs React Compiler
| Scenario | Recommended Approach |
|---|---|
| New projects | Use React Compiler 1.0 |
| Existing projects | Adopt React Compiler incrementally, use this plugin to clean up over-memoization |
| Legacy codebases | Use this plugin to remove unnecessary memoization before compiler adoption |
| Performance-critical code | Use React Compiler + manual memoization only as escape hatches |
React Compiler Recommendations
For new code: Rely on the compiler for memoization and use
useMemo/useCallbackonly when you need precise control.For existing code: Either leave existing memoization in place (removing it can change compilation output) or carefully test before removing.
Rules
remove-use-memo
Removes React.useMemo calls and inlines the computed value to simplify code by eliminating unnecessary memoization.
❌ Incorrect
const expensiveValue = React.useMemo(() => computeExpensiveValue(a, b), [a, b]);
const memoizedResult = useMemo(() => a + b, [a, b]);
✅ Correct
const expensiveValue = computeExpensiveValue(a, b);
const result = a + b;
Edge Cases (will NOT be flagged):
useMemocalls containing other React hooks (for safety)- Complex functions with multiple statements
- Incorrect
useMemosignatures
remove-use-callback
Removes React.useCallback calls and inlines the function to simplify code by eliminating unnecessary memoization.
❌ Incorrect
const handleClick = React.useCallback(() => {
doSomething();
}, [doSomething]);
const handleChange = useCallback((event) => {
console.log(event.target.value);
}, []);
✅ Correct
const handleClick = () => {
doSomething();
};
const handleChange = (event) => {
console.log(event.target.value);
};
remove-memo
Removes React.memo HOC calls and uses the component directly to simplify code by eliminating unnecessary memoization.
❌ Incorrect
const MyComponent = React.memo(() => {
return <div>Hello</div>;
});
const MemoizedComponent = memo(({ name }) => {
return <div>Hello {name}</div>;
});
✅ Correct
const MyComponent = () => {
return <div>Hello</div>;
};
Installation
Option 1: React Compiler 1.0 (Recommended for new projects)
npm install --save-dev --save-exact babel-plugin-react-compiler@latest
npm install --save-dev eslint-plugin-react-hooks@latest
Option 2: This Plugin (For legacy cleanup or pre-compiler migration)
npm install @ospm/eslint-plugin-react-unhookify --save-dev
Option 3: Combined Approach
Use React Compiler for automatic optimization and this plugin to clean up legacy memoization:
npm install --save-dev --save-exact babel-plugin-react-compiler@latest
npm install --save-dev eslint-plugin-react-hooks@latest
npm install @ospm/eslint-plugin-react-unhookify --save-dev
Comparison: React Compiler vs Manual Memoization
| Feature | React Compiler 1.0 | Manual Memoization | This Plugin |
|---|---|---|---|
| Automatic optimization | ✅ Build-time analysis | ❌ Manual implementation | ❌ Manual cleanup |
| Performance | 12% faster loads, 2.5× interactions | Varies by implementation | Removes unnecessary overhead |
| Code simplicity | ✅ No manual hooks needed | ❌ Adds boilerplate | ✅ Cleaner code |
| Control | Limited (escape hatches available) | ✅ Full control | ✅ Selective removal |
| Learning curve | Low (install and enable) | High (need to understand patterns) | Low (auto-fix available) |
| Best for | Most applications | Performance-critical cases | Legacy code cleanup |
Usage
Flat config (ESLint 9+)
import reactUnhookify from '@ospm/eslint-plugin-react-unhookify';
export default [
{
plugins: {
'react-unhookify': reactUnhookify,
},
rules: {
'react-unhookify/remove-use-memo': 'error',
'react-unhookify/remove-use-callback': 'error',
'react-unhookify/remove-memo': 'error',
},
},
];
Legacy config (ESLint 8)
module.exports = {
plugins: ['react-unhookify'],
rules: {
'react-unhookify/remove-use-memo': 'error',
'react-unhookify/remove-use-callback': 'error',
'react-unhookify/remove-memo': 'error',
},
};
Recommended Configuration
This plugin exports a recommended configuration that enables all rules.
Flat config…
Description from the npm listing.
- eslint
- eslint-plugin
- react
- react-hooks
- usememo
- usecallback
- memo
- performance
- optimization
- cleanup
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (1)Similar npm ESLint plugins plugins
All 20 @ospm/eslint-plugin-react-unhookify alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@ospm/eslint-plugin-react-unhookify. First seen Oct 31, 2026; last successful collection Oct 31, 2026. See the methodology.