# eslint-plugin-antfu

> Anthony's opinionated ESLint rules

Latest version **3.2.3** (published 2026-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-antfu
pnpm add eslint-plugin-antfu
yarn add eslint-plugin-antfu
bun add eslint-plugin-antfu
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.2.3 |
| Published | 2026-05-11 |
| First published | 2022-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 35.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 177 |
| Author | Anthony Fu <anthonyfu117@hotmail.com> |
| Maintainers | antfu |
| Keywords | eslint-plugin |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-antfu
- Repository: https://github.com/antfu/eslint-plugin-antfu
- Homepage: https://github.com/antfu/eslint-plugin-antfu#readme
- Issues: https://github.com/antfu/eslint-plugin-antfu/issues
- Funding: https://github.com/sponsors/antfu
- npm.io page: https://npm.io/package/eslint-plugin-antfu

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 3.2.3 (latest) — 2026-05-11
- 3.2.2 — 2026-02-14
- 3.2.1 — 2026-02-11
- 3.2.0 — 2026-02-07
- 3.1.3 — 2026-01-06
- 3.1.1 — 2025-03-07
- 3.1.0 — 2025-02-15
- 3.0.0 — 2025-01-25
- 2.7.0 — 2024-09-20
- 2.6.0 — 2024-09-10
- 2.5.0 — 2024-09-05
- 2.4.1 — 2024-09-03
- 2.4.0 — 2024-09-03
- 2.3.6 — 2024-08-22
- 2.3.5 — 2024-08-12
- … 118 more at https://npm.io/package/eslint-plugin-antfu/versions

## README

# eslint-plugin-antfu

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]

Anthony's opinionated ESLint rules, used as the foundation of [`@antfu/eslint-config`](https://github.com/antfu/eslint-config).

## Install

```bash
pnpm add -D eslint-plugin-antfu
```

> Most users should consume these rules via [`@antfu/eslint-config`](https://github.com/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:

```js
// 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

<!-- 🔧 = fixable · ⚙️ = configurable -->

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

## Sponsors

<p align="center">
  <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
    <img src="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg" alt="Sponsors"/>
  </a>
</p>

## License

[MIT](./LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/eslint-plugin-antfu?style=flat&colorA=080f12&colorB=1fa669
[npm-version-href]: https://npmjs.com/package/eslint-plugin-antfu
[npm-downloads-src]: https://img.shields.io/npm/dm/eslint-plugin-antfu?style=flat&colorA=080f12&colorB=1fa669
[npm-downloads-href]: https://npmjs.com/package/eslint-plugin-antfu

---
_Source: https://npm.io/package/eslint-plugin-antfu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
