Getting Started
Install the plugin:
npm install --save-dev eslint-plugin-typefest typescript
Enable one preset in your Flat Config:
import typefest from "eslint-plugin-typefest";
export default [
typefest.configs.recommended,
];
recommended does not require type information.
If you want the same baseline plus type-aware helper rules, use
typefest.configs["recommended-type-checked"].
Alternative: manual scoped setupโ
If you prefer to apply plugin rules inside your own file-scoped config object, spread the preset rules manually.
import tsParser from "@typescript-eslint/parser";
import typefest from "eslint-plugin-typefest";
export default [
{
files: ["**/*.{ts,tsx,mts,cts}"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: "latest",
// Enable only when using a type-aware preset.
// projectService: true,
sourceType: "module",
},
},
plugins: {
typefest,
},
rules: {
...typefest.configs.recommended.rules,
},
},
];
Use this pattern when you only extend rules and want full control over parser setup per scope.
Recommended rolloutโ
- Start with
recommended(orminimalif you want low initial noise). - Fix violations in small batches.
- Move to
recommended-type-checkedwhen you are ready for typed rules. - Move to
strictonce your baseline is stable. - Use
allwhen you want every stable rule. - Use
experimentalonly when you want report-only candidate rules under active evaluation.
Need a subset instead of a full preset?โ
- ๐
typefest.configs["type-fest/types"] - โด๏ธ
typefest.configs["ts-extras/type-guards"]
See the Presets section in this sidebar for details and examples.