antfu/eslint-plugin-antfu

Anthony extended ESLint rules.

TypeScript

177

170 commits

updated Sep 2, 2026

See the code

README

eslint-plugin-antfu

npm version npm downloads

Anthony's opinionated ESLint rules, used as the foundation of @antfu/eslint-config.

Install

pnpm add -D eslint-plugin-antfu

Most users should consume these rules via @antfu/eslint-config, which wires them up with sensible defaults alongside the rest of Anthony's ESLint setup. Install this plugin directly only when you want to pick and choose individual rules.

Usage

Register the plugin in your flat config and enable the rules you want:

// eslint.config.js
import antfu from 'eslint-plugin-antfu'

export default [
  {
    plugins: {
      antfu,
    },
    rules: {
      'antfu/consistent-list-newline': 'error',
      'antfu/if-newline': 'error',
      'antfu/top-level-function': 'error',
    },
  },
]

Rules

RuleDescription
consistent-chainingEnforce consistent line breaks for chaining member accessπŸ”§βš™οΈ
consistent-list-newlineEnforce consistent line breaks inside braces and parenthesesπŸ”§βš™οΈ
curlyOpinionated curly bracket enforcement that allows both styles on one-linersπŸ”§
if-newlineEnforce a newline between if and its consequentπŸ”§
import-dedupeAuto-fix duplicate named imports from the same sourceπŸ”§
indent-unindentEnforce consistent indentation inside unindent tagged template stringsπŸ”§βš™οΈ
no-import-distPrevent importing from a local dist folder
no-import-node-modules-by-pathPrevent importing from node_modules by relative or absolute path
no-top-level-awaitPrevent top-level await
no-ts-export-equalPrevent TypeScript's export = syntax in .ts/.tsx/.mts/.cts files
top-level-functionEnforce top-level functions to be declared with the function keywordπŸ”§

Sponsors

Sponsors

License

MIT License Β© 2023-PRESENT Anthony Fu

Contributors

antfu

148 commits

hyoban

9 commits

9romise

2 commits

ntnyq

2 commits

antfu/eslint-plugin-antfu

Anthony extended ESLint rules.

TypeScript

177

170 commits

updated Sep 2, 2026

See the code

README

eslint-plugin-antfu

npm version npm downloads

Anthony's opinionated ESLint rules, used as the foundation of @antfu/eslint-config.

Install

pnpm add -D eslint-plugin-antfu

Most users should consume these rules via @antfu/eslint-config, which wires them up with sensible defaults alongside the rest of Anthony's ESLint setup. Install this plugin directly only when you want to pick and choose individual rules.

Usage

Register the plugin in your flat config and enable the rules you want:

// eslint.config.js
import antfu from 'eslint-plugin-antfu'

export default [
  {
    plugins: {
      antfu,
    },
    rules: {
      'antfu/consistent-list-newline': 'error',
      'antfu/if-newline': 'error',
      'antfu/top-level-function': 'error',
    },
  },
]

Rules

RuleDescription
consistent-chainingEnforce consistent line breaks for chaining member accessπŸ”§βš™οΈ
consistent-list-newlineEnforce consistent line breaks inside braces and parenthesesπŸ”§βš™οΈ
curlyOpinionated curly bracket enforcement that allows both styles on one-linersπŸ”§
if-newlineEnforce a newline between if and its consequentπŸ”§
import-dedupeAuto-fix duplicate named imports from the same sourceπŸ”§
indent-unindentEnforce consistent indentation inside unindent tagged template stringsπŸ”§βš™οΈ
no-import-distPrevent importing from a local dist folder
no-import-node-modules-by-pathPrevent importing from node_modules by relative or absolute path
no-top-level-awaitPrevent top-level await
no-ts-export-equalPrevent TypeScript's export = syntax in .ts/.tsx/.mts/.cts files
top-level-functionEnforce top-level functions to be declared with the function keywordπŸ”§

Sponsors

Sponsors

License

MIT License Β© 2023-PRESENT Anthony Fu

Contributors

antfu

148 commits

hyoban

9 commits

9romise

2 commits

ntnyq

2 commits

Languages

TypeScript

98.9%

JavaScript

1.1%