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.
- Installation
- Quick start (flat config)
- Presets
- Configuration examples by preset
- Global settings
- Rules
- Contributors β¨
npm install --save-dev eslint-plugin-typefest typescript
@typescript-eslint/parseris loaded automatically by plugin presets.
- Supported ESLint versions:
9.xand10.x - Config system: Flat Config only (
eslint.config.*) - Node.js runtime:
>=22.0.0
import typefest from "eslint-plugin-typefest";
export default [typefest.configs.recommended];That is enough for TypeScript files (**/*.{ts,tsx,mts,cts}).
This plugin intentionally exports eight presets:
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"],
];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 asrecommended-type-checked,strict,all, andexperimental)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.
},
},
},
];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.
Fixlegend:π§= autofixableπ‘= suggestions availableβ= report only
Preset keylegend:- π’ β
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"]
- π’ β
Thanks goes to these wonderful people (emoji key):
Nick2bad4u π π» π π€ π π§ π |
Snyk bot π‘οΈ π π§ π |
StepSecurity Bot π‘οΈ π π§ |
dependabot[bot] π π‘οΈ |
github-actions[bot] π» π |