eslint-plugin-typefest

July 7, 2026 ยท View on GitHub

npm license. npm total downloads. latest GitHub release. GitHub stars. GitHub forks. GitHub open issues. codecov. Mutation testing badge.

ESLint plugin for teams that want consistent TypeScript-first conventions based on:

The plugin ships focused rule sets for modern flat config usage, with parser setup included in each preset config.

Table of contents

  1. Installation
  2. Quick start (flat config)
  3. Presets
  4. Configuration examples by preset
  5. Global settings
  6. Rules
  7. Contributors โœจ

Installation

npm install --save-dev eslint-plugin-typefest typescript

@typescript-eslint/parser is loaded automatically by plugin presets.

Compatibility

  • Supported ESLint versions: 9.x and 10.x
  • Config system: Flat Config only (eslint.config.*)
  • Node.js runtime: >=22.0.0

Quick start (flat config)

import typefest from "eslint-plugin-typefest";

export default [typefest.configs.recommended];

That is enough for TypeScript files (**/*.{ts,tsx,mts,cts}).

Presets

This plugin intentionally exports eight presets:

Preset
๐ŸŸข typefest.configs.minimal
๐ŸŸก typefest.configs.recommended
๐ŸŸ  typefest.configs["recommended-type-checked"]
๐Ÿ”ด typefest.configs.strict
๐ŸŸฃ typefest.configs.all
๐Ÿงช typefest.configs.experimental
๐Ÿ’  typefest.configs["type-fest/types"]
โœด๏ธ typefest.configs["ts-extras/type-guards"]

Configuration examples by preset

import typefest from "eslint-plugin-typefest";

export default [
 // Smallest baseline footprint.
 typefest.configs.minimal,

 // Balanced default for most teams.
 // typefest.configs.recommended,

 // Recommended plus type-aware ts-extras helper rules.
 // typefest.configs["recommended-type-checked"],

 // Recommended plus additional stable runtime utilities.
 // typefest.configs.strict,

 // Every stable rule.
 // typefest.configs.all,

 // Every stable rule plus experimental candidate rules.
 // typefest.configs.experimental,

 // Focused subsets:
 // typefest.configs["type-fest/types"],
 // typefest.configs["ts-extras/type-guards"],
];

Parser setup behavior

Each preset already includes:

  • files: ["**/*.{ts,tsx,mts,cts}"]
  • languageOptions.parser (@typescript-eslint/parser)
  • languageOptions.parserOptions:
    • ecmaVersion: "latest"
    • projectService: true (for presets that include typed rules, such as recommended-type-checked, strict, all, and experimental)
    • sourceType: "module"

End users usually do not need to wire parser config manually.

If you need custom parser options (for example tsconfigRootDir), extend a preset:

import typefest from "eslint-plugin-typefest";

const recommended = typefest.configs.recommended;

export default [
 {
  ...recommended,
  languageOptions: {
   ...recommended.languageOptions,
   parserOptions: {
    ...recommended.languageOptions?.parserOptions,
    // Add projectService only when you opt into a type-aware preset.
   },
  },
 },
];

Global settings

You can globally disable autofixes that add missing imports while still keeping rule reports and non-import autofixes enabled.

import typefest from "eslint-plugin-typefest";

export default [
 {
  ...typefest.configs.recommended,
  settings: {
   typefest: {
    // Disable all autofixes while keeping suggestions enabled.
    // disableAllAutofixes: true,

    // Disable only autofixes that add missing imports.
    disableImportInsertionFixes: true,
   },
  },
 },
];

When settings.typefest.disableImportInsertionFixes is true, rules that would normally add a missing type-fest or ts-extras import will report without applying that import-adding autofix. Autofixes that do not require inserting a new import (for example, when the replacement symbol is already in scope) still apply.

When settings.typefest.disableAllAutofixes is true, all rule autofixes are suppressed, but reports and suggestions remain available.

If both settings are enabled, disableAllAutofixes takes precedence for autofix behavior.

Rules

RuleFixPreset key
prefer-ts-extras-array-at๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-array-concat๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-array-first๐Ÿ”ง ๐Ÿ’ก๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-array-includes๐Ÿ”ง ๐Ÿ’ก๐ŸŸ  ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-array-join๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-array-last๐Ÿ”ง ๐Ÿ’ก๐ŸŸ  ๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-as-writable๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-assert-defined๐Ÿ”ง ๐Ÿ’ก๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-assert-error๐Ÿ’ก๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-assert-never๐Ÿ’ก๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-assert-present๐Ÿ”ง ๐Ÿ’ก๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-defined๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-defined-filter๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-empty๐Ÿ”ง๐ŸŸ  ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-equal-type๐Ÿ’ก๐ŸŸฃ
prefer-ts-extras-is-finite๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-infinite๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-integer๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-present๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-present-filter๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-property-defined๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-property-present๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-is-safe-integer๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-key-in๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-not๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-object-assign๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-object-entries๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-object-from-entries๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-object-has-in๐Ÿ”ง ๐Ÿ’ก๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-object-has-own๐Ÿ”ง ๐Ÿ’ก๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-object-keys๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-object-map-valuesโ€”๐Ÿงช
prefer-ts-extras-object-values๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-ts-extras-safe-cast-to๐Ÿ”ง๐ŸŸ  ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-set-has๐Ÿ”ง ๐Ÿ’ก๐ŸŸ  ๐Ÿ”ด ๐ŸŸฃ โœด๏ธ
prefer-ts-extras-string-split๐Ÿ”ง๐Ÿ”ด ๐ŸŸฃ
prefer-type-fest-absolute๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-abstract-constructor๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-and๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-and-all๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-array-element๐Ÿ”ง๐ŸŸ  ๐Ÿ”ด ๐ŸŸฃ
prefer-type-fest-array-length๐Ÿ”ง๐ŸŸ  ๐Ÿ”ด ๐ŸŸฃ
prefer-type-fest-array-values๐Ÿ”ง๐ŸŸ  ๐Ÿ”ด ๐ŸŸฃ
prefer-type-fest-arrayable๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-async-return-type๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-asyncifyโ€”๐Ÿงช
prefer-type-fest-conditional-exceptโ€”๐Ÿงช
prefer-type-fest-conditional-keysโ€”๐Ÿงช
prefer-type-fest-conditional-pick๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-conditional-pick-deep๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-constructor๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-distributed-omitโ€”๐Ÿงช
prefer-type-fest-distributed-pickโ€”๐Ÿงช
prefer-type-fest-entries๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-entry๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-except๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-extract-rest-element๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-has-optional-keys๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-has-readonly-keys๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-has-required-keys๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-has-writable-keys๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-if๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-is-any๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-is-never๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-is-null๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-is-nullable๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-is-tuple๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-is-undefined๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-is-unknown๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-iterable-element๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-json-array๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-json-object๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-json-primitive๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-json-value๐Ÿ’ก๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-keys-of-union๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-less-than๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-less-than-or-equal๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-literal-union๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-mergeโ€”๐Ÿงช
prefer-type-fest-merge-exclusive๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-non-empty-tuple๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-non-nullable-deep๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-omit-index-signature๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-optional๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-optional-keys-of๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-or๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-or-all๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-partial-deep๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-pick-index-signatureโ€”๐Ÿงช
prefer-type-fest-primitive๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-promisable๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-readonly-deep๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-readonly-keys-of๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-require-all-or-none๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-require-at-least-one๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-require-exactly-one๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-require-one-or-none๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-required-deep๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-required-keys-of๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-schema๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-set-non-nullable๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-set-optional๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-set-readonly๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-set-required๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-set-return-typeโ€”๐Ÿงช
prefer-type-fest-simplify๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-string-length๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-stringifiedโ€”๐Ÿงช
prefer-type-fest-tagged-brands๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-tuple-of๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-union-length๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-union-member๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-union-to-intersectionโ€”๐Ÿงช
prefer-type-fest-union-to-tuple๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-unknown-array๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-unknown-map๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-unknown-record๐Ÿ”ง๐ŸŸข ๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-unknown-set๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-unwrap-tagged๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-value-of๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-writable๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-writable-deep๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 
prefer-type-fest-writable-keys-of๐Ÿ”ง๐ŸŸก ๐Ÿ”ด ๐ŸŸฃ ๐Ÿ’ 

Contributors โœจ

All Contributors.

Thanks goes to these wonderful people (emoji key):

Nick2bad4u
Nick2bad4u

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿค” ๐Ÿš‡ ๐Ÿšง ๐Ÿ‘€ โš ๏ธ ๐Ÿ”ง
Snyk bot
Snyk bot

๐Ÿ›ก๏ธ ๐Ÿš‡ ๐Ÿšง ๐Ÿ‘€
StepSecurity Bot
StepSecurity Bot

๐Ÿ›ก๏ธ ๐Ÿš‡ ๐Ÿšง
dependabot[bot]
dependabot[bot]

๐Ÿš‡ ๐Ÿ›ก๏ธ
github-actions[bot]
github-actions[bot]

๐Ÿ’ป ๐Ÿš‡