This ESLint plugin enforces immutability in JavaScript by providing three rules: no-let (forces use of const instead of let/var), no-this (disallows this in favor of functional components), and no-mutation (prevents assignment to member expressions, blocking object mutation even with const). Version 1.0.0 is stable. It integrates with Redux+React workflows, using Babel's object-rest-spread plugin for immutable updates. Differentiates from general eslint rules by specifically targeting Redux/React patterns, with no runtime cost compared to Object.freeze().
npm install eslint-plugin-immutableVerified import paths — ran on the pinned version, not inferred.
Shows installation, configuration, and examples of code that violates each rule.
Use only functional components and avoid classes entirely.
Supplement with eslint-plugin-immutable's no-array-mutation rule or use array spread/immutable library.
Replace for-loops with array methods like map, filter, reduce, or forEach.
Replace 'let' with 'const' or refactor to use array methods.
Use object spread: const newObj = { ...oldObj, prop: newValue };Convert to a stateless functional component using props parameter.