npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-plugin-fp-ts

v0.3.2

Published

fp-ts ESLint rules

Downloads

120,727

Readme

badge npm npm

eslint-plugin-fp-ts

A collection of ESLint rules for fp-ts

Installation

Assuming ESlint is installed locally in your project:

# npm
npm install --save-dev eslint-plugin-fp-ts

# yarn
yarn add --dev eslint-plugin-fp-ts

Then enable the plugin in your .eslintrc config

{
  "plugins": ["fp-ts"]
}

and enable the rules you want, for example

{
  "plugins": ["fp-ts"],
  "rules": {
    "fp-ts/no-lib-imports": "error"
  }
}

If you want to enable rules that require type information (see the table below), then you will also need to add some extra info:

module.exports = {
  plugins: ["fp-ts"],
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: ["./tsconfig.json"],
  },
  rules: {
    "fp-ts/no-discarded-pure-expression": "error",
  },
};

If your project is a multi-package monorepo, you can follow the instructions here.

⚠️ Note that you will need to make the ESLint config file a .js file, due to the need of setting tsconfigRootDir to __dirname. This is necessary to make both editor integrations and the CLI work with the correct path. More info here: https://github.com/typescript-eslint/typescript-eslint/issues/251

List of supported rules

| Rule | Description | Fixable | Requires type-checking | | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | :-----: | :--------------------: | | fp-ts/no-lib-imports | Disallow imports from fp-ts/lib/ | 🔧 | | | fp-ts/no-pipeable | Disallow imports from the pipeable module | 🔧 | | | fp-ts/no-module-imports | Disallow imports from fp-ts modules | 🔧 | | | fp-ts/no-redundant-flow | Remove redundant uses of flow | 🔧 | | | fp-ts/prefer-traverse | Replace map + sequence with traverse | 💡 | | | fp-ts/prefer-chain | Replace map + flatten with chain | 💡 | | | fp-ts/prefer-bimap | Replace map + mapLeft with bimap | 💡 | | | fp-ts/no-discarded-pure-expression | Disallow expressions returning pure data types (like Task or IO) in statement position | 💡 | 🦄 |

Fixable legend:

🔧 = auto-fixable via --fix (or via the appropriate editor configuration)

💡 = provides in-editor suggestions that need to be applied manually

Configurations

Recommended

The plugin defines a recommended configuration with some reasonable defaults.

To use it, add it to the extends clause of your .eslintrc file:

{
  "extends": ["plugin:fp-ts/recommended"]
}

The rules included in this configuration are:

Recommended requiring type-checking

We also provide a recommended-requiring-type-checking which includes recommended rules which require type information.

This configuration needs to be included in addition to the recommended one:

{
  "extends": [
    "plugin:fp-ts/recommended",
    "plugin:fp-ts/recommended-requiring-type-checking"
  ]
}

👉 You can read more about linting with type information, including performance considerations here

All

The plugin also defines an all configuration which includes every available rule.

To use it, add it to the extends clause of your .eslintrc file:

{
  "extends": ["plugin:fp-ts/all"]
}