eslint-plugin-immutable-2
June 18, 2026 ยท View on GitHub
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
- Installation
- Quick start (flat config)
- Presets
- Configuration examples by preset
- Type-aware precision
- Rules
- Contributors โจ
Installation
npm install --save-dev eslint-plugin-immutable-2 typescript
@typescript-eslint/parseris loaded automatically by plugin presets.
Compatibility
- Supported ESLint versions:
9.xand10.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:
| Preset | Config key | Use when |
|---|---|---|
| ๐ข Functional Lite | immutable.configs["functional-lite"] | You want a moderate step up from immutable with lightweight structural functional rules. |
| ๐ก Functional | immutable.configs.functional | You want the strict functional tier without turning on every rule in the plugin. |
| ๐ Immutable | immutable.configs.immutable | You want the broader immutable baseline with no-let, readonly typing, and method-shape discipline. |
| ๐ต Recommended | immutable.configs.recommended | You want the default low-friction entrypoint focused on high-signal mutation hazards. |
| ๐ฃ All | immutable.configs.all | You 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
Fixlegend:๐ง= autofixable๐ก= suggestions availableโ= report only
Preset keylegend:
Contributors โจ
Thanks goes to these wonderful people (emoji key):
Nick2bad4u ๐ ๐ป ๐ ๐ค ๐ ๐ง ๐ โ ๏ธ ๐ง |
Snyk bot ๐ก๏ธ ๐ ๐ง ๐ |
StepSecurity Bot ๐ก๏ธ ๐ ๐ง |
dependabot[bot] ๐ ๐ก๏ธ |
github-actions[bot] ๐ป ๐ |