The `conventional-commits-filter` package, currently at stable version 5.0.0, provides utilities for processing commit data, specifically designed to identify and remove "revert" commits and their corresponding reverted original commits. This ensures that generated changelogs or commit analyses accurately reflect the effective state of the codebase by omitting changes that were later undone. It integrates seamlessly within the conventional-changelog ecosystem, which typically follows a regular, synchronized release schedule across its components. A key differentiator is its robust handling of commit revert logic, which is crucial for maintaining a clean and meaningful commit history in projects adhering to Conventional Commits specifications. The library offers synchronous, asynchronous (Promise-based), and stream-based APIs to suit various data processing needs.
npm install conventional-commits-filterVerified import paths — ran on the pinned version, not inferred.
This example demonstrates both synchronous and stream-based filtering of an array of parsed conventional commits, showing how revert commits and their reverted counterparts are removed to yield a clean commit list.
Migrate your project to use ESM imports (`import ... from 'package'`) and ensure your `package.json` specifies `"type": "module"` or uses `.mjs` file extensions.
Upgrade your Node.js runtime to version 18 or higher to ensure compatibility and leverage modern JavaScript features.
Ensure all commit objects passed to the filter functions have been processed by `conventional-commits-parser` or a compatible parser that populates the `revert` and `hash` fields accurately.
Change `const filter = require('conventional-commits-filter')` to `import { filterRevertedCommitsSync } from 'conventional-commits-filter'`.Update your import statements to use `import` syntax and ensure your project or file is configured for ES modules (e.g., `"type": "module"` in `package.json` or using `.mjs` extension).