{"id":19687,"library":"eslint-plugin-antfu","title":"eslint-plugin-antfu","description":"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.","status":"active","version":"3.2.2","language":"javascript","source_language":"en","source_url":"https://github.com/antfu/eslint-plugin-antfu","tags":["javascript","eslint-plugin","typescript"],"install":[{"cmd":"npm install eslint-plugin-antfu","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-antfu","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-antfu","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v3.0.0; default export is the plugin object.","wrong":"const antfu = require('eslint-plugin-antfu');","symbol":"plugin","correct":"import antfu from 'eslint-plugin-antfu'; export default [antfu.configs.recommended];"},{"note":"Named export for rules object; also available via plugin.rules.","wrong":null,"symbol":"rules","correct":"import { rules } from 'eslint-plugin-antfu';"},{"note":"ESM-only since v3.0.0; configs object contains 'recommended' and 'all'.","wrong":"const { configs } = require('eslint-plugin-antfu');","symbol":"configs","correct":"import { configs } from 'eslint-plugin-antfu';"}],"quickstart":{"code":"// eslint.config.js\nimport antfu from 'eslint-plugin-antfu';\n\nexport default [\n  antfu.configs.recommended,\n  {\n    rules: {\n      'antfu/consistent-chaining': ['warn', { allowLeadingPropertyAccess: false }],\n      'antfu/consistent-list-newline': ['error', { multiline: 'always' }],\n      'antfu/top-level-function': ['error'],\n      'antfu/no-top-level-await': ['error'],\n    },\n  },\n];\n","lang":"typescript","description":"Shows how to import the plugin and apply its recommended config along with custom rule options in flat ESLint config."},"warnings":[{"fix":"Use ESM imports: import antfu from 'eslint-plugin-antfu'.","message":"v3.0.0 drops CJS support; require() will fail.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use 'allowLeadingPropertyAccess' instead of deprecated 'allowFirstPropertyAccess'.","message":"Rule 'consistent-chaining' option 'allowLeadingPropertyAccess' was renamed from 'allowFirstPropertyAccess' in v2.6.0.","severity":"gotcha","affected_versions":">=2.6.0"},{"fix":"Use antfu/eslint-config as base or carefully merge configs.","message":"The plugin is opinionated and intended for use with antfu/eslint-config; mixing with other configs may cause conflicts.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Switch to ESM imports or downgrade to v2.x.","cause":"Using CommonJS require() on an ESM-only package (v3+).","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Ensure your ESLint config uses flat config format: export default [antfu.configs.recommended].","cause":"Incorrectly using antfu.configs.recommended inside an array without spreading or without flat config.","error":"TypeError: antfu.configs is not iterable"},{"fix":"Replace 'allowFirstPropertyAccess' with 'allowLeadingPropertyAccess'.","cause":"Using deprecated option name from pre-2.6.0.","error":"Rule 'antfu/consistent-chaining' has unknown option 'allowFirstPropertyAccess'."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}