Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-functional

Package Overview
Dependencies
Maintainers
2
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-functional

ESLint rules to disable mutation and promote fp in TypeScript.

  • 6.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is eslint-plugin-functional?

eslint-plugin-functional is an ESLint plugin that enforces functional programming best practices. It helps developers write code that is more predictable, easier to test, and less prone to bugs by discouraging side effects, mutable data, and other non-functional programming patterns.

What are eslint-plugin-functional's main functionalities?

No Mutations

This feature enforces immutability by disallowing the use of `let`, `this`, and `class`. This ensures that variables and data structures remain constant throughout the code.

module.exports = {
  rules: {
    'functional/no-let': 'error',
    'functional/no-this-expression': 'error',
    'functional/no-class': 'error'
  }
};

No Expressions with Side Effects

This feature prevents the use of expressions that produce side effects, such as assignments and conditionals. This helps in maintaining pure functions that are easier to test and reason about.

module.exports = {
  rules: {
    'functional/no-expression-statement': 'error',
    'functional/no-conditional-statement': 'error'
  }
};

No Loops

This feature disallows the use of loop statements like `for`, `while`, and `do-while`. Instead, it encourages the use of higher-order functions like `map`, `filter`, and `reduce` for iteration.

module.exports = {
  rules: {
    'functional/no-loop-statement': 'error'
  }
};

Other packages similar to eslint-plugin-functional

Keywords

FAQs

Package last updated on 11 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc