{"id":19633,"library":"eslint-fix-utils","title":"eslint-fix-utils","description":"A library of utilities for ESLint rule fixers and suggestions, providing functions to safely manipulate AST nodes (e.g., add/remove object properties, array elements) while handling commas and formatting. Current stable version is 0.4.2. Released under MIT, actively maintained. Key differentiator: offers both higher-level fixer helpers (fixAddObjectProperty, fixRemoveArrayElement) and full APIs (addObjectProperty, removeArrayElement) for custom fix logic. Requires ESLint >=8 and @types/estree >=1. ESM-only since v0.4.0.","status":"active","version":"0.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/michaelfaith/eslint-fix-utils","tags":["javascript","typescript"],"install":[{"cmd":"npm install eslint-fix-utils","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-fix-utils","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-fix-utils","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"TypeScript types for ESTree AST nodes used in all functions.","package":"@types/estree","optional":false},{"reason":"Core peer dependency for ESLint rule context and fixer APIs.","package":"eslint","optional":false}],"imports":[{"note":"ESM-only since v0.4.0. Named export, not default.","wrong":"const { addObjectProperty } = require('eslint-fix-utils')","symbol":"addObjectProperty","correct":"import { addObjectProperty } from 'eslint-fix-utils'"},{"note":"Must use named import, not default.","wrong":"import removeArrayElement from 'eslint-fix-utils'","symbol":"removeArrayElement","correct":"import { removeArrayElement } from 'eslint-fix-utils'"},{"note":"Curried fixer versions are also named exports.","symbol":"fixRemoveObjectProperty","correct":"import { fixRemoveObjectProperty } from 'eslint-fix-utils'"}],"quickstart":{"code":"import { addObjectProperty, removeArrayElement } from 'eslint-fix-utils';\n\nexport default {\n  create(context) {\n    return {\n      ObjectExpression(node) {\n        context.report({\n          node,\n          messageId: 'addProperty',\n          fix: (fixer) => {\n            return addObjectProperty(context, fixer, node, 'type', 'module');\n          },\n        });\n      },\n    };\n  },\n};\n","lang":"typescript","description":"Shows how to use addObjectProperty in an ESLint rule to add a property to an object expression. Demonstrates named imports and the fix function pattern."},"warnings":[{"fix":"Update Node to ^20.19.0 || ^22.12.0 || >=24.0.0. Use native ESM or a bundler that handles ESM.","message":"v0.4.0 drops support for Node 18 and switches to ESM-only with bundled exports.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Upgrade Node to >=20 or stick with v0.2.x.","message":"v0.3.0 removed support for Node 18.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Use addObjectProperty, removeArrayElement, etc., instead of fixAddObjectProperty if you need custom fix logic.","message":"All 'fix' prefixed functions are wrappers; consider using the full API variants directly for more control.","severity":"deprecated","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Switch to import syntax or use dynamic import().","cause":"Package is ESM-only since v0.4.0, but required with require().","error":"ERR_REQUIRE_ESM: require() of ES Module /path/to/eslint-fix-utils/index.js from /path/to/your-file.js not supported."},{"fix":"Ensure you call the function with the correct signature: addObjectProperty(context, fixer, node, key, value).","cause":"When using the full API functions, the fixer argument must be provided as a separate parameter.","error":"TypeError: fixer is not a function"},{"fix":"Run npm install --save-dev @types/estree or add it to your devDependencies.","cause":"@types/estree is a peer dependency and not installed automatically.","error":"Cannot find module '@types/estree' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}