Registry / testing / eslint-plugin-antfu

eslint-plugin-antfu

JSON →
library3.2.2jsnpmunverified

Anthony Fu's opinionated ESLint plugin providing rules like consistent-chaining, consistent-list-newline, top-level-function, and no-top-level-await. Current stable version is 3.2.2, released under MIT license. v3.0.0 dropped CJS support (ESM-only). Designed for use with antfu/eslint-config. Active development with frequent releases. Ships TypeScript types. Peer dependency on eslint.

npm install eslint-plugin-antfu
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-ANTF
E
eslint-plugin-antfu
testingjavascriptv3.2.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin
import antfu from 'eslint-plugin-antfu'; export default [antfu.configs.recommended];
const antfu = require('eslint-plugin-antfu');
ESM-only since v3.0.0; default export is the plugin object.
rules
import { rules } from 'eslint-plugin-antfu';
Named export for rules object; also available via plugin.rules.
configs
import { configs } from 'eslint-plugin-antfu';
const { configs } = require('eslint-plugin-antfu');
ESM-only since v3.0.0; configs object contains 'recommended' and 'all'.

Shows how to import the plugin and apply its recommended config along with custom rule options in flat ESLint config.

// eslint.config.js import antfu from 'eslint-plugin-antfu'; export default [ antfu.configs.recommended, { rules: { 'antfu/consistent-chaining': ['warn', { allowLeadingPropertyAccess: false }], 'antfu/consistent-list-newline': ['error', { multiline: 'always' }], 'antfu/top-level-function': ['error'], 'antfu/no-top-level-await': ['error'], }, }, ];
Debug
Known issues
breakingv3.0.0 drops CJS support; require() will fail.
fix
Use ESM imports: import antfu from 'eslint-plugin-antfu'.
affects: >=3.0.0
gotchaRule 'consistent-chaining' option 'allowLeadingPropertyAccess' was renamed from 'allowFirstPropertyAccess' in v2.6.0.
fix
Use 'allowLeadingPropertyAccess' instead of deprecated 'allowFirstPropertyAccess'.
affects: >=2.6.0
gotchaThe plugin is opinionated and intended for use with antfu/eslint-config; mixing with other configs may cause conflicts.
fix
Use antfu/eslint-config as base or carefully merge configs.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using CommonJS require() on an ESM-only package (v3+).
fix
Switch to ESM imports or downgrade to v2.x.
TypeError: antfu.configs is not iterable
Incorrectly using antfu.configs.recommended inside an array without spreading or without flat config.
fix
Ensure your ESLint config uses flat config format: export default [antfu.configs.recommended].
Rule 'antfu/consistent-chaining' has unknown option 'allowFirstPropertyAccess'.
Using deprecated option name from pre-2.6.0.
fix
Replace 'allowFirstPropertyAccess' with 'allowLeadingPropertyAccess'.
Upgrade
Version history
3.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-antfu — npm install eslint-plugin-antfu · libregistry