eslint-plugin-immutable-2

June 18, 2026 ยท View on GitHub

npm license. npm total downloads. latest GitHub release. GitHub stars. GitHub forks. GitHub open issues. codecov. Mutation testing badge.

ESLint plugin for teams that want TypeScript-first immutability and functional-style conventions in modern flat config projects.

The plugin ships focused flat-config presets with parser setup already wired in. Typed parser services remain opt-in so consumers can decide when they want the extra semantic precision.

Table of contents

  1. Installation
  2. Quick start (flat config)
  3. Presets
  4. Configuration examples by preset
  5. Type-aware precision
  6. Rules
  7. Contributors โœจ

Installation

npm install --save-dev eslint-plugin-immutable-2 typescript

@typescript-eslint/parser is loaded automatically by plugin presets.

Compatibility

  • Supported ESLint versions: 9.x and 10.x
  • Config system: Flat Config only (eslint.config.*)
  • Node.js runtime: >=22.0.0

Quick start (flat config)

import immutable from "eslint-plugin-immutable-2";

export default [immutable.configs.recommended];

That is enough for the default JS/TS preset file globs (**/*.{js,cjs,mjs,jsx,ts,tsx,mts,cts}).

Presets

This plugin intentionally exports five presets:

PresetConfig keyUse when
๐ŸŸข Functional Liteimmutable.configs["functional-lite"]You want a moderate step up from immutable with lightweight structural functional rules.
๐ŸŸก Functionalimmutable.configs.functionalYou want the strict functional tier without turning on every rule in the plugin.
๐ŸŸ  Immutableimmutable.configs.immutableYou want the broader immutable baseline with no-let, readonly typing, and method-shape discipline.
๐Ÿ”ต Recommendedimmutable.configs.recommendedYou want the default low-friction entrypoint focused on high-signal mutation hazards.
๐ŸŸฃ Allimmutable.configs.allYou want every rule in this plugin enabled.

Configuration examples by preset

import immutable from "eslint-plugin-immutable-2";

export default [
 // Default low-friction starting point.
 immutable.configs.recommended,

 // Broader immutable baseline with readonly typing and declaration discipline.
 // immutable.configs.immutable,

 // Small structural functional step-up on top of the immutable baseline.
 // immutable.configs["functional-lite"],

 // Strict functional-style coverage without enabling every rule.
 // immutable.configs.functional,

 // Every rule in the plugin.
 // immutable.configs.all,
];

Parser setup behavior

Each preset already includes:

  • files: ["**/*.{js,cjs,mjs,jsx,ts,tsx,mts,cts}"]
  • languageOptions.parser (@typescript-eslint/parser)
  • languageOptions.parserOptions:
    • ecmaVersion: "latest"
    • sourceType: "module"

End users usually do not need to wire parser config manually.

If you need custom parser options (for example project, projectService, or tsconfigRootDir), extend a preset:

import immutable from "eslint-plugin-immutable-2";

const recommended = immutable.configs.recommended;

export default [
 {
  ...recommended,
  languageOptions: {
   ...recommended.languageOptions,
   parserOptions: {
    ...recommended.languageOptions?.parserOptions,
    projectService: true,
   },
  },
 },
];

Type-aware precision

The plugin presets already set the parser and base parser options, but they do not automatically enable project/projectService for you.

If you want the most accurate checker-backed behavior from rules such as immutable-data and the implicit-array inference branch of readonly-array, extend a preset with typed parser services:

import immutable from "eslint-plugin-immutable-2";

export default [
 {
  ...recommended,
  languageOptions: {
   ...recommended.languageOptions,
   parserOptions: {
    ...recommended.languageOptions?.parserOptions,
    projectService: true,
   },
  },
 },
];

Without parser services, the plugin still loads and syntax-first rules still run, but checker-backed branches may fall back to conservative behavior.

The plugin does not currently expose any custom settings.immutable runtime switches. Behavior is controlled through preset choice and per-rule options.

Rules

RuleFixPreset key
immutable-dataโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-abort-controller-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-atomics-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-buffer-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-cache-api-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-classโ€”๐ŸŸก ๐ŸŸฃ
no-conditional-statementโ€”๐ŸŸข ๐ŸŸก ๐ŸŸฃ
no-cookie-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-data-view-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-date-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-dom-token-list-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-expression-statementโ€”๐ŸŸก ๐ŸŸฃ
no-form-data-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-headers-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-history-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-let๐Ÿ’ก๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐ŸŸฃ
no-location-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-loop-statementโ€”๐ŸŸข ๐ŸŸก ๐ŸŸฃ
no-map-set-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-method-signature๐Ÿ’ก๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐ŸŸฃ
no-mixed-interfaceโ€”๐ŸŸข ๐ŸŸก ๐ŸŸฃ
no-process-env-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-reflect-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-regexp-lastindex-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-rejectโ€”๐ŸŸฃ
no-stateful-regexpโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-storage-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-thisโ€”๐ŸŸก ๐ŸŸฃ
no-throwโ€”๐ŸŸก ๐ŸŸฃ
no-tryโ€”๐ŸŸก ๐ŸŸฃ
no-typed-array-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-url-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
no-url-search-params-mutationโ€”๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐Ÿ”ต ๐ŸŸฃ
readonly-array๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐ŸŸฃ
readonly-keyword๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐ŸŸ  ๐ŸŸฃ

Contributors โœจ

All Contributors.

Thanks goes to these wonderful people (emoji key):

Nick2bad4u
Nick2bad4u

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿค” ๐Ÿš‡ ๐Ÿšง ๐Ÿ‘€ โš ๏ธ ๐Ÿ”ง
Snyk bot
Snyk bot

๐Ÿ›ก๏ธ ๐Ÿš‡ ๐Ÿšง ๐Ÿ‘€
StepSecurity Bot
StepSecurity Bot

๐Ÿ›ก๏ธ ๐Ÿš‡ ๐Ÿšง
dependabot[bot]
dependabot[bot]

๐Ÿš‡ ๐Ÿ›ก๏ธ
github-actions[bot]
github-actions[bot]

๐Ÿ’ป ๐Ÿš‡