MCPcopy Index your code
hub / github.com/antfu/eslint-plugin-antfu

github.com/antfu/eslint-plugin-antfu @v3.2.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.2.3 ↗ · + Follow
42 symbols 106 edges 29 files 2 documented · 5% 2 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
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

Rule Description
consistent-chaining Enforce consistent line breaks for chaining member access 🔧 ⚙️
consistent-list-newline Enforce consistent line breaks inside braces and parentheses 🔧 ⚙️
curly Opinionated curly bracket enforcement that allows both styles on one-liners 🔧
if-newline Enforce a newline between if and its consequent 🔧
import-dedupe Auto-fix duplicate named imports from the same source 🔧
indent-unindent Enforce consistent indentation inside unindent tagged template strings 🔧 ⚙️
no-import-dist Prevent importing from a local dist folder
no-import-node-modules-by-path Prevent importing from node_modules by relative or absolute path
no-top-level-await Prevent top-level await
no-ts-export-equal Prevent TypeScript's export = syntax in .ts/.tsx/.mts/.cts files
top-level-function Enforce top-level functions to be declared with the function keyword 🔧

Sponsors

Sponsors

License

MIT License © 2023-PRESENT Anthony Fu

Core symbols most depended-on inside this repo

check
called by 21
src/rules/consistent-list-newline.ts
run
called by 11
src/rules/_test.ts
check
called by 6
src/rules/curly.ts
removeLines
called by 2
src/rules/consistent-list-newline.ts
getDelimiter
called by 2
src/rules/consistent-list-newline.ts
hasComments
called by 2
src/rules/consistent-list-newline.ts
exportType
called by 2
src/rules/consistent-list-newline.ts
RuleCreator
called by 1
src/utils.ts

Shape

Function 42

Languages

TypeScript100%

Modules by API surface

src/rules/consistent-list-newline.ts14 symbols
src/rules/curly.ts11 symbols
src/utils.ts3 symbols
src/rules/top-level-function.ts2 symbols
src/rules/indent-unindent.ts2 symbols
src/rules/import-dedupe.ts2 symbols
src/rules/if-newline.ts2 symbols
src/rules/consistent-chaining.ts2 symbols
src/rules/no-ts-export-equal.ts1 symbols
src/rules/no-ts-export-equal.test.ts1 symbols
src/rules/no-import-dist.ts1 symbols
src/rules/_test.ts1 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add eslint-plugin-antfu \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page