eslint-plugin-redux-saga
raw JSON → 1.3.2 verified Sat Apr 25 auth: no javascript maintenance
An ESLint plugin providing linting rules for redux-saga to catch common mistakes and enforce best practices. Version 1.3.2 is the current stable release, published in 2022 with a low maintenance cadence (last commit in 2020). Key differentiators: it includes three recommended rules for ensuring effects are yielded (yield-effects), preventing yield inside race entries (no-yield-in-race), and catching unhandled errors in sagas (no-unhandled-errors). Compared to alternatives like eslint-plugin-redux-saga (by the redux-saga org), this plugin is community-maintained and focuses on a smaller set of opinionated rules.
Common errors
error ESLint: Failed to load plugin 'redux-saga': Cannot find module 'eslint-plugin-redux-saga' ↓
cause The plugin is not installed or not resolvable.
fix
Run 'npm install eslint-plugin-redux-saga --save-dev' and ensure it's in node_modules.
error Configuration for rule 'redux-saga/no-yield-in-race' is invalid: Severity should be one of the following: 0 = off, 1 = warn, 2 = error ↓
cause Invalid severity value in eslintrc.
fix
Use numbers (0,1,2) or strings ('off','warn','error'). Example: "redux-saga/no-yield-in-race": 2
error ESLint: Unexpected top-level property 'extends[0]' value 'plugin:redux-saga/recommended' is not valid. ↓
cause Missing 'plugin:' prefix or incorrect string.
fix
Use "plugin:redux-saga/recommended" with the 'plugin:' prefix.
error ReferenceError: saga is not defined (when using 'yield-effects' rule) ↓
cause Saga generator functions not properly declared or used outside a function.
fix
Ensure effects are used inside a generator function and that the rule is not mistakenly applied to non-saga code.
Warnings
gotcha The plugin requires redux-saga as a peer dependency. If redux-saga is not installed, rules may behave unexpectedly or crash. ↓
fix Install redux-saga: npm install redux-saga
gotcha Rule 'no-unhandled-errors' can produce false positives if error handling is done in a parent saga or via try-catch wrapping. ↓
fix Disable or adjust rule severity, or restructure saga error handling to be explicit.
deprecated The plugin is in maintenance mode with no new updates since 2020. Future ESLint versions may introduce incompatibilities. ↓
fix Consider migrating to the official redux-saga ESLint plugin or forks with active maintenance.
gotcha ESLint 7+ requires the plugin to be compatible with flat config. This plugin does not support flat config (eslint.config.js). ↓
fix Use legacy .eslintrc format or use an alternative plugin that supports flat config.
Install
npm install eslint-plugin-redux-saga yarn add eslint-plugin-redux-saga pnpm add eslint-plugin-redux-saga Imports
- plugin wrong
{ "plugins": ["eslint-plugin-redux-saga"] }correct{ "plugins": ["redux-saga"] } - recommended config wrong
{ "extends": ["redux-saga/recommended"] }correct{ "extends": ["plugin:redux-saga/recommended"] } - Individual rules wrong
{ "rules": { "eslint-plugin-redux-saga/yield-effects": "error" } }correct{ "rules": { "redux-saga/yield-effects": "error", "redux-saga/no-yield-in-race": "warn", "redux-saga/no-unhandled-errors": "error" } } - require() in Node scripts wrong
const plugin = require('redux-saga');correctconst plugin = require('eslint-plugin-redux-saga');
Quickstart
npm install --save-dev eslint-plugin-redux-saga eslint
# or yarn add --dev eslint-plugin-redux-saga eslint
# .eslintrc.json
{
"plugins": ["redux-saga"],
"extends": ["plugin:redux-saga/recommended"],
"rules": {
"redux-saga/no-yield-in-race": "warn"
}
}