Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.38 KB

no-module-imports.md

File metadata and controls

60 lines (39 loc) · 1.38 KB

Disallow imports from fp-ts modules (fp-ts/no-module-imports)

Disallow imports from fp-ts modules, such as fp-ts/Option.

The function module is an exception and it's allowed nonetheless, since it's not exported from fp-ts's index.

🔧 Fixable: This rule is automatically fixable using the --fix flag on the command line.

Rule Details

Possible configurations:

allowTypes (boolean)

  • false: disallow importing any member from a module. This is the default value.
  • true: allow importing type members from a module.

allowedModules (string[])

List of allowed modules, defaults to ["function", "pipeable"].

Example of incorrect code for this rule, when configured with { allowTypes: false }

import { Option, some } from "fp-ts/Option";

const x: Option<number> = some(42);

Example of correct code for this rule, when configured with { allowTypes: false }:

import { option } from "fp-ts";

const x: option.Option<number> = option.some(42);

Example of correct code for this rule, when configured with { allowTypes: true }

import { option } from "fp-ts";
import { Option } from "fp-ts/Option";

const x: Option<number> = option.some(42);

Example of correct code for this rule, when configured with { allowedModules: ["Option"] }:

import { Option, some } from "fp-ts/Option";

const x: Option<number> = some(42);