or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-conventional-changelog-eslint

ESLint preset for conventional-changelog that provides standardized commit message parsing and changelog generation following ESLint's commit conventions.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/conventional-changelog-eslint@6.0.x

To install, run

npx @tessl/cli install tessl/npm-conventional-changelog-eslint@6.0.0

index.mddocs/

Conventional Changelog ESLint

Conventional Changelog ESLint is a preset for the conventional-changelog system that provides standardized commit message parsing and changelog generation following ESLint's commit conventions. It enables automatic changelog generation for projects that follow ESLint's structured commit message format with specific tags and formatting rules.

Package Information

  • Package Name: conventional-changelog-eslint
  • Package Type: npm
  • Language: JavaScript (ESM)
  • Installation: npm install conventional-changelog-eslint
  • Node Version: >=18

Core Imports

import createPreset from "conventional-changelog-eslint";
// Named exports also available
import { createParserOpts, createWriterOpts, whatBump } from "conventional-changelog-eslint";

For CommonJS environments (though the package is ESM-only):

const createPreset = require("conventional-changelog-eslint").default;
const { createParserOpts, createWriterOpts, whatBump } = require("conventional-changelog-eslint");

Basic Usage

import conventionalChangelogCore from "conventional-changelog-core";
import createPreset from "conventional-changelog-eslint";

// Generate changelog using the ESLint preset
const preset = await createPreset();

for await (const chunk of conventionalChangelogCore({
  config: preset
})) {
  console.log(chunk.toString());
}

ESLint Commit Convention

The preset follows ESLint's specific commit message format:

Tag: Short description (fixes #1234)

Longer description here if necessary

Supported Tags

  • Fix: Bug fixes
  • Update: Backwards-compatible enhancements or rule changes
  • New: New features implementation
  • Breaking: Backwards-incompatible changes
  • Docs: Documentation changes only
  • Build: Build process changes only
  • Upgrade: Dependency upgrades
  • Chore: Refactoring, tests, non-user-facing changes

Capabilities

Preset Configuration

Creates a complete preset configuration with parser, writer, and version bump logic.

/**
 * Creates a preset configuration for conventional-changelog (default export)
 * @returns Promise resolving to preset configuration object
 */
export default function createPreset(): Promise<PresetConfig>;

/**
 * Create parser options for ESLint commit format
 * @returns Parser configuration object
 */
export function createParserOpts(): ParserOptions;

/**
 * Create writer options with templates for changelog generation
 * @returns Promise resolving to writer configuration object
 */
export function createWriterOpts(): Promise<WriterOptions>;

/**
 * Determine version bump level based on commit tags
 * @param commits - Array of parsed commit objects
 * @returns Bump result with level and reason
 */
export function whatBump(commits: CommitObject[]): BumpResult;

interface PresetConfig {
  /** Parser options for commit message parsing */
  parser: ParserOptions;
  /** Writer options for changelog generation */
  writer: WriterOptions;
  /** Version bump logic function */
  whatBump: (commits: CommitObject[]) => BumpResult;
}

Parser Configuration

The preset's parser configuration handles ESLint's commit message format.

interface ParserOptions {
  /** Regex pattern to parse ESLint commit format: /^(\w*):\s*(.*)$/ */
  headerPattern: RegExp;
  /** Maps regex groups to commit properties: ['tag', 'message'] */
  headerCorrespondence: string[];
}

Writer Configuration

The preset's writer configuration includes templates and formatting rules for changelog generation.

interface WriterOptions {
  /** Main changelog template */
  mainTemplate: string;
  /** Header template for version sections */
  headerPartial: string;
  /** Commit entry template */
  commitPartial: string;
  /** Transform function for commit objects */
  transform: (commit: CommitObject) => TransformedCommit | undefined;
  /** Groups commits by this property */
  groupBy: string;
  /** Sort order for commit groups */
  commitGroupsSort: string;
  /** Sort order for commits within groups */
  commitsSort: string[];
}

interface CommitObject {
  /** ESLint commit tag (Fix, Update, New, etc.) */
  tag?: string;
  /** Commit message content */
  message?: string;
  /** Git commit hash */
  hash: string;
  /** Commit header line */
  header?: string;
  /** Issue references */
  references?: Reference[];
}

interface TransformedCommit {
  /** Shortened commit hash (7 characters) */
  shortHash: string;
  /** ESLint commit tag (transformed from original) */
  tag?: string;
  /** Commit message content (transformed from original) */
  message?: string;
  /** Git commit hash (original) */
  hash?: string;
  /** Commit header line (original) */
  header?: string;
  /** Issue references (original) */
  references?: Reference[];
}

interface Reference {
  /** Issue number */
  issue: string;
  /** Repository owner */
  owner?: string;
  /** Repository name */
  repository?: string;
}

Version Bump Logic

The preset includes version bump logic that determines semantic version level based on commit tags.

interface BumpResult {
  /** Bump level: 0 (major), 1 (minor), 2 (patch) */
  level: number;
  /** Human-readable reason for the bump decision */
  reason: string;
}

Bump Logic Rules:

  • Breaking commits → Major version bump (level 0)
  • New commits → Minor version bump (level 1)
  • All other commits → Patch version bump (level 2)

Individual Function Access

Direct access to individual configuration functions is available via named exports.

Parser Options Creation

Creates parser configuration for ESLint commit format parsing.

/**
 * Create parser options for ESLint commit format
 * @returns Parser configuration object with header pattern and correspondence
 */
function createParserOpts(): ParserOptions;

Usage Example:

import { createParserOpts } from "conventional-changelog-eslint";

const parserOpts = createParserOpts();
// Returns: { headerPattern: /^(\w*):\s*(.*)$/, headerCorrespondence: ['tag', 'message'] }

Writer Options Creation

Creates writer configuration with Handlebars templates loaded from files.

/**
 * Create writer options with templates for changelog generation
 * @returns Promise resolving to writer configuration object with templates loaded
 */
function createWriterOpts(): Promise<WriterOptions>;

Usage Example:

import { createWriterOpts } from "conventional-changelog-eslint";

const writerOpts = await createWriterOpts();
// Returns writer configuration with loaded templates and transform function

Direct Bump Logic Access

Direct access to the version bump determination logic.

/**
 * Determine version bump level based on commit tags
 * @param commits - Array of parsed commit objects with tag property
 * @returns Bump result with level (0=major, 1=minor, 2=patch) and reason
 */
function whatBump(commits: CommitObject[]): BumpResult;

Usage Example:

import { whatBump } from "conventional-changelog-eslint";

const commits = [
  { tag: 'Breaking', message: 'remove deprecated API' },
  { tag: 'New', message: 'add feature X' }
];

const result = whatBump(commits);
// Returns: { level: 0, reason: 'There are 1 breaking changes and 1 features' }

Template System

The preset includes Handlebars templates for changelog formatting:

Main Template

Structures the overall changelog with version headers and commit groups.

Main Template

Structures the overall changelog:

{{> header}}

{{#each commitGroups}}

{{#if title}}
### {{title}}

{{/if}}
{{#each commits}}
{{> commit root=@root}}
{{/each}}
{{/each}}

Header Template

Formats version headers with links and dates:

{{#if isPatch}}##{{else}}#{{/if}} {{#if @root.linkCompare}}[{{version}}]({{@root.host}}/{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}/compare/{{previousTag}}...{{currentTag}}){{else}}{{version}}{{/if}}{{#if title}} "{{title}}"{{/if}}{{#if date}} ({{date}}){{/if}}

Commit Template

Formats individual commit entries with hash links and issue references:

* {{#if message}}{{message}}{{else}}{{header}}{{/if}}

{{~!-- commit hash --}} {{#if @root.linkReferences}}([{{shortHash}}]({{#if @root.host}}{{@root.host}}/{{/if}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}/{{@root.commit}}/{{hash}})){{else}}{{hash~}}{{/if}}

{{~!-- commit references --}}{{#if references}}, closes{{~#each references}} {{#if @root.linkReferences}}[{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}#{{this.issue}}]({{#if @root.host}}{{@root.host}}/{{/if}}{{#if this.repository}}{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}{{else}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}{{/if}}/{{@root.issue}}/{{this.issue}}){{else}}{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}#{{this.issue}}{{/if}}{{/each}}{{/if}}

Integration

This preset is designed to work with:

  • conventional-changelog-core: Primary changelog generation engine
  • conventional-changelog: CLI tools and higher-level APIs
  • standard-version: Automated versioning and CHANGELOG generation
  • semantic-release: Automated package publishing with conventional commits

Integration Example:

import conventionalChangelogCore from "conventional-changelog-core";
import createPreset from "conventional-changelog-eslint";

const preset = await createPreset();

// Generate changelog for current version
const changelogStream = conventionalChangelogCore({
  config: preset,
  releaseCount: 1
});

let changelog = "";
for await (const chunk of changelogStream) {
  changelog += chunk.toString();
}

console.log(changelog);