eslint-plugin-you-dont-need-recompose

1.0.2 • Public • Published

eslint-plugin-you-dont-need-recompose

Eslint rules to avoid parts of recompose lib

Build Status Coverage Status Maintainability Version dependencies Status code style: prettier

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

Package Sidebar

Install

npm i eslint-plugin-you-dont-need-recompose

Weekly Downloads

682

Version

1.0.2

License

MIT

Unpacked Size

15.9 kB

Total Files

11

Last publish

Collaborators

  • icrosil