eslint-plugin-remeda
v1.4.0
Published
ESLint plugin for Remeda library.
Downloads
328
Maintainers
Readme
ESLint Plugin Remeda
ESLint plugin for Remeda.
Installation
First, you'll first need to install ESLint:
npm add eslint -D
Next, install eslint-plugin-remeda
:
npm add eslint-plugin-remeda -D
Preamble
This plugin was originally derived from eslint-plugin-lodash-f (fork of eslint-plugin-lodash) and used that as a base to build upon.
Rules
Enable all of the rules that you would like to use. All rules are off by default, unless you use one of the plugin's configurations which turn all relevant rules on.
- collection-method-value: Use value returned from collection methods properly.
- collection-return: Always return a value in iteratees of Remeda collection methods that aren't
forEach
. - prefer-filter: Prefer
R.filter
overR.forEach
with anif
statement inside. - prefer-find: Prefer
R.find
overR.filter
followed by selecting the first result. - prefer-flat-map: Prefer
R.flatMap
over consecutiveR.map
andR.flat
. - prefer-map: Prefer
R.map
overR.forEach
with apush
inside. - prefer-nullish-coalescing: Prefer
??
when doing a comparison with a non-nullish value as test. - prefer-constant: Prefer
R.constant
over functions returning literals. - prefer-is-empty: Prefer
R.isEmpty
over manual checking for length value. - prefer-is-nil: Prefer
R.isNil
over checks for both null and undefined. - prefer-remeda-typecheck: Prefer using
R.is*
methods overtypeof
andinstanceof
checks when applicable. - prefer-do-nothing: Prefer
R.doNothing
over empty functions. - prefer-some: Prefer using
R.some
over comparingfindIndex
to -1. - prefer-times: Prefer
R.times
overR.map
without using the iteratee's arguments.
Contributing
Contributions are always welcome! For more info, read our contribution guide.