eslint-plugin-you-dont-need-recompose
v1.0.2
Published
Eslint plugin to help avoid part of recompose in hooks favor
Downloads
6,200
Maintainers
Readme
eslint-plugin-you-dont-need-recompose
Eslint rules to avoid parts of recompose lib
TL;DR
Eslint plugin.
- Rule for import of each method and recompose itself.
plugin:you-dont-need-recompose/recommended
to avoid HOCs that used state or hook-replacable thing but don't alert HOCs like 'branch' or 'mapProps'.plugin:you-dont-need-recompose/acdlite
to avoid any recompose import. (would be useful to avoid any recompose in part of codebase without touching old parts)
How to use
Install
yarn add -D eslint-plugin-you-dont-need-recompose
Update your eslint config
"extends" : ["plugin:you-dont-need-recompose/recommended"],
You don't need recompose
If you are starting a brand new project it is totally fine to avoid adding recompose in first place. Hooks providing alternative way of managin major part of problems recompose solved. So, no recompose - no problem. More details here and on recompose page.
Unpopular
opinion
What if you already have some app with recompose and that's fine till your all new code comes with hooks? Maybe you'd still like to use HOCs and hooks together but to avoid some parts of recompose.
This eslint plugin could help you.
Plugin provides rule for each recompose method. So you can set each method with any level of warning.
Most likely you'd like to use one of presets: recommended
or acdlite
.
recommended
Contains error only for this set of methods:
- withState
- withStateHandlers
- shouldUpdate
- pure
- onlyUpdateForKeys
- onlyUpdateForPropTypes
- withContext
- getContext
- lifecycle
- withReducer
- withPropsOnChange
acdlite
Single rule to deprecate any usage of recompose at all.
Inspired by
License
MIT