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.
npm install eslint-fix-utilsVerified import paths — ran on the pinned version, not inferred.
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.
Update Node to ^20.19.0 || ^22.12.0 || >=24.0.0. Use native ESM or a bundler that handles ESM.
Upgrade Node to >=20 or stick with v0.2.x.
Use addObjectProperty, removeArrayElement, etc., instead of fixAddObjectProperty if you need custom fix logic.
Switch to import syntax or use dynamic import().
Ensure you call the function with the correct signature: addObjectProperty(context, fixer, node, key, value).
Run npm install --save-dev @types/estree or add it to your devDependencies.