Any donations would be much appreciated.
See our getting started guide.
The following rulesets are made available by this plugin:
Enforce recommended rules designed to strictly enforce functional programming.
Has the same goal as the
strictpreset but a little more lenient, allowing for functional-like coding styles and nicer integration with non-functional 3rd-party libraries.
Good if you're new to functional programming or are converting a large codebase.
No Exceptions (
Functional programming style does not use run-time exceptions. Instead expressions produces values to indicate errors.
No Mutations (
Prevent mutating any data as that's not functional
No Other Paradigms (
No Statements (
Enforce code styles that can be considered to be more functional.
Enables all rules defined in this plugin.
Disable all rules defined in this plugin.
External Vanilla Recommended (
Configures recommended vanilla ESLint rules.
External Typescript Recommended (
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.
--fix CLI option.
|functional-parameters||Enforce functional parameters.|
|no-promise-reject||Disallow try-catch[-finally] and try-finally patterns.|
|no-throw-statements||Disallow throwing exceptions.|
|no-try-statements||Disallow try-catch[-finally] and try-finally patterns.|
|immutable-data||Enforce treating data as immutable.|
|no-let||Disallow mutable variables.|
|prefer-immutable-types||Require function parameters to be typed as certain immutability|
|prefer-readonly-type||Prefer readonly types over mutable types.|
|type-declaration-immutability||Enforce the immutability of types based on patterns.|
No Other Paradigms
|no-mixed-types||Restrict types so that only members of the same kind are allowed in them.|
|no-this-expressions||Disallow this access.|
|no-conditional-statements||Disallow conditional statements.|
|no-expression-statements||Disallow expression statements.|
|no-loop-statements||Disallow imperative loops.|
|no-return-void||Disallow functions that don't return anything.|
|prefer-property-signatures||Prefer property signatures over method signatures.|
|readonly-type||Require consistently using either
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.
Without this rule, it is still possible to create
varvariables that are mutable.
Don't allow function parameters to be reassigned, they should be treated as constants.
This rule provides a helpful fixer when converting from an imperative code style to a functional one.
This rule is helpful when working with classes.
Although our no-conditional-statements rule also performs this check, this rule has a fixer that will implement the unimplemented cases which can be useful.
This project started off as a port of tslint-immutable which was originally inspired by eslint-plugin-immutable.