MCPcopy Index your code
hub / github.com/eslint-functional/eslint-plugin-functional

github.com/eslint-functional/eslint-plugin-functional @v10.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v10.0.0 ↗ · + Follow
222 symbols 876 edges 86 files 81 documented · 36% 4 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

eslint-logo

eslint-plugin-functional

npm version Release Coverage Status semantic-release code style: prettier MIT license GitHub Discussions

An ESLint plugin to disable mutation and promote functional programming in JavaScript and TypeScript.

Donate

Any donations would be much appreciated. 😄

Enterprise Users

eslint-plugin-functional is available as part of the Tidelift Subscription.

Tidelift is working with the maintainers of eslint-plugin-functional and a growing network of open source maintainers to ensure your open source software supply chain meets enterprise standards now and into the future. Learn more.

Getting Started

See our getting started guide.

Rulesets

The following rulesets are made available by this plugin.

Presets:

  • Strict (configs.strict)\ Enforce recommended rules designed to strictly enforce functional programming.

  • Recommended (configs.recommended)\ Has the same goal as the strict preset but a little more lenient, allowing for functional-like coding styles and nicer integration with non-functional 3rd-party libraries.

  • Lite (configs.lite)\ Good if you're new to functional programming or are converting a large codebase.

Categorized:

  • Currying (configs.currying)\ JavaScript functions support syntax that is not compatible with curried functions. To enforce currying, this syntax should be prevented.

  • No Exceptions (configs.noExceptions)\ Functional programming style does not use run-time exceptions. Instead expressions produces values to indicate errors.

  • No Mutations (configs.noMutations)\ Prevent mutating any data as that's not functional

  • No Other Paradigms (configs.noOtherParadigms)\ JavaScript is multi-paradigm, allowing not only functional, but object-oriented as well as other programming styles. To promote a functional style, prevent the use of other paradigm styles.

  • No Statements (configs.noStatements)\ In functional programming everything is an expression that produces a value. JavaScript has a lot of syntax that is just statements that does not produce a value. That syntax has to be prevented to promote a functional style.

  • Stylistic (configs.stylistic)\ Enforce code styles that can be considered to be more functional.

Other:

  • All (configs.all)\ Enables all rules defined in this plugin.

  • Off (configs.off)\ Disable all rules defined in this plugin.

  • Disable Type Checked (configs.disableTypeChecked)\ Disable all rules that require type information.

  • External Vanilla Recommended (configs.externalVanillaRecommended)\ Configures recommended vanilla ESLint rules.

  • External TypeScript Recommended (configs.externalTypeScriptRecommended)\ Configures recommended TypeScript ESLint rules. Enabling this ruleset will also enable the vanilla one.

The below section gives details on which rules are enabled by each ruleset.

Rules

💼 Configurations enabled in.\ ⚠️ Configurations set to warn in.\ 🚫 Configurations disabled in.\ badge-currying Set in the currying configuration.\ ☑️ Set in the lite configuration.\ badge-noExceptions Set in the noExceptions configuration.\ badge-noMutations Set in the noMutations configuration.\ badge-noOtherParadigms Set in the noOtherParadigms configuration.\ badge-noStatements Set in the noStatements configuration.\ ✅ Set in the recommended configuration.\ 🔒 Set in the strict configuration.\ 🎨 Set in the stylistic configuration.\ 🔧 Automatically fixable by the --fix CLI option.\ 💡 Manually fixable by editor suggestions.\ 💭 Requires type information.\ ❌ Deprecated.

Currying

Name Description 💼 ⚠️ 🚫 🔧 💡 💭
functional-parameters Enforce functional parameters. badge-currying ☑️ ✅ 🔒 💭

No Exceptions

Name Description 💼 ⚠️ 🚫 🔧 💡 💭
no-promise-reject Disallow rejecting promises.
no-throw-statements Disallow throwing exceptions. ☑️ badge-noExceptions ✅ 🔒 💭
no-try-statements Disallow try-catch[-finally] and try-finally patterns. badge-noExceptions 🔒 ☑️ ✅

No Mutations

Name                          Description 💼 ⚠️ 🚫 🔧 💡 💭
immutable-data Enforce treating data as immutable. ☑️ badge-noMutations ✅ 🔒 💭
no-let Disallow mutable variables. ☑️ badge-noMutations ✅ 🔒
prefer-immutable-types Require function parameters to be typed as certain immutability ☑️ badge-noMutations ✅ 🔒 🔧 💡 💭
prefer-readonly-type Prefer readonly types over mutable types. 🔧 💭
type-declaration-immutability Enforce the immutability of types based on patterns. ☑️ badge-noMutations ✅ 🔒 🔧 💡 💭

No Other Paradigms

Name                 Description 💼 ⚠️ 🚫 🔧 💡 💭
no-class-inheritance Disallow inheritance in classes. ☑️ badge-noOtherParadigms ✅ 🔒
no-classes Disallow classes. badge-noOtherParadigms ✅ 🔒 ☑️
no-mixed-types Restrict types so that only members of the same kind are allowed in them. ☑️ badge-noOtherParadigms ✅ 🔒 💭
no-this-expressions Disallow this access. badge-noOtherParadigms 🔒 ☑️ ✅

No Statements

Name Description 💼 ⚠️ 🚫 🔧 💡 💭
no-conditional-statements Disallow conditional statements. badge-noStatements ✅ 🔒 ☑️ 💭
no-expression-statements Disallow expression statements. badge-noStatements ✅ 🔒 ☑️ 💭
no-loop-statements Disallow imperative loops. ☑️ badge-noStatements ✅ 🔒
no-return-void Disallow functions that don't return anything. ☑️ badge-noStatements ✅ 🔒 💭

Stylistic

Name                       Description 💼 ⚠️ 🚫 🔧 💡 💭
prefer-property-signatures Prefer property signatures over method signatures. 🎨 💭
prefer-tacit Replaces x => f(x) with just f. 🎨 💡 💭
readonly-type Require consistently using either readonly keywords or Readonly<T> 🎨 🔧 💭

External Recommended Rules

In addition to the above rules, there are a few other rules we recommended.

These rules are what are included in the external recommended rulesets.

Vanilla Rules

  • no-var\ Without this rule, it is still possible to create mutable var variables.

  • [no-param-reassign](https://eslint.org/docs/r

Extension points exported contracts — how you extend this code

SharedConfigurationSettings (Interface)
(no doc)
src/settings/immutability.ts
ImportMeta (Interface)
(no doc)
typings/node.d.ts
ObjectConstructor (Interface)
(no doc)
typings/es.d.ts
ArrayConstructor (Interface)
(no doc)
typings/es.d.ts
ReadonlyArray (Interface)
(no doc)
typings/es.d.ts
Array (Interface)
(no doc)
typings/es.d.ts

Core symbols most depended-on inside this repo

shouldIgnorePattern
called by 27
src/options/ignore.ts
getTypeOfNode
called by 20
src/utils/rule.ts
isIdentifier
called by 20
src/utils/type-guards.ts
createRule
called by 18
src/utils/rule.ts
isMemberExpression
called by 16
src/utils/type-guards.ts
isArray
called by 15
typings/es.d.ts
shouldIgnoreClasses
called by 13
src/options/ignore.ts
getAncestorOfType
called by 11
src/utils/tree.ts

Shape

Function 211
Interface 6
Method 4
Enum 1

Languages

TypeScript100%

Modules by API surface

src/utils/type-guards.ts74 symbols
src/utils/tree.ts23 symbols
src/rules/prefer-immutable-types.ts13 symbols
src/utils/rule.ts12 symbols
src/rules/no-conditional-statements.ts11 symbols
src/utils/type-specifier.ts9 symbols
typings/es.d.ts8 symbols
src/rules/type-declaration-immutability.ts8 symbols
src/rules/prefer-tacit.ts8 symbols
src/options/ignore.ts7 symbols
src/rules/prefer-readonly-type.ts6 symbols
src/rules/immutable-data.ts6 symbols

For agents

$ claude mcp add eslint-plugin-functional \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page