Skip to content

Latest commit

 

History

History
85 lines (66 loc) · 1.79 KB

GETTING_STARTED.md

File metadata and controls

85 lines (66 loc) · 1.79 KB

Getting Started

Installation

JavaScript

# Install with npm
npm install -D eslint eslint-plugin-functional

# Install with yarn
yarn add -D eslint eslint-plugin-functional

# Install with pnpm
pnpm add -D eslint eslint-plugin-functional

TypeScript

# Install with npm
npm install -D eslint typescript-eslint eslint-plugin-functional

# Install with yarn
yarn add -D eslint typescript-eslint eslint-plugin-functional

# Install with pnpm
pnpm add -D eslint typescript-eslint eslint-plugin-functional

Usage

With TypeScript

In your eslint.config.js file, import typescript-eslint and eslint-plugin-functional and configure them as you wish.

// eslint.config.js
import functional from "eslint-plugin-functional";
import tseslint from "typescript-eslint";

export default tseslint.config({
  files: ["**/*.ts"],
  extends: [
    functional.configs.externalTypeScriptRecommended,
    functional.configs.recommended,
    functional.configs.stylistic,
    // your other plugin configs here
  ],
  languageOptions: {
    parser: tseslint.parser,
    parserOptions: {
      projectService: true,
    },
  },
  rules: {
    // any rule configs here
  },
});

Without TypeScript

In your eslint.config.js file, import eslint-plugin-functional and configure it as you wish.

If you're not using TypeScript, be sure to include the disableTypeChecked config after the other configs to disable rules that require TypeScript.

// eslint.config.js
import functional from "eslint-plugin-functional";

export default [
  functional.configs.externalVanillaRecommended,
  functional.configs.recommended,
  functional.configs.stylistic,
  functional.configs.disableTypeChecked,
  // your other plugin configs here
  {
    rules: {
      // any rule configs here
    },
  },
];