Skip to content

fix: commitlint doesn't support atom preset #3547

Open
@ffxsam

Description

@ffxsam

Expected Behavior

I've set up the CLI for local use, according to the instructions.

commitlint.config.js
/* eslint-disable no-undef */
// import type { UserConfig } from '@commitlint/types';
// import { RuleConfigSeverity } from '@commitlint/types';

const Configuration = {
  /*
   * Resolve and load @commitlint/config-conventional from node_modules.
   * Referenced packages must be installed
   */
  extends: ['@commitlint/config-conventional'],
  /*
   * Resolve and load conventional-changelog-atom from node_modules.
   * Referenced packages must be installed
   */
  parserPreset: 'conventional-changelog-atom',
  /*
   * Resolve and load @commitlint/format from node_modules.
   * Referenced package must be installed
   */
  formatter: '@commitlint/format',
  /*
   * Any rules defined here will override rules from @commitlint/config-conventional
   */
  rules: {
    'type-enum': [2, 'always', ['feat', 'fix', 'chore', 'docs']],
    'scope-enum': [2, 'always', ['core', 'cli', 'docs', 'test']],
  },
  /*
   * Functions that return true if commitlint should ignore the given message.
   */
  ignores: [(commit) => commit === ''],
  /*
   * Whether commitlint uses the default ignore rules.
   */
  defaultIgnores: true,
  /*
   * Custom URL to show upon failure
   */
  helpUrl:
    'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
  /*
   * Custom prompt configs
   */
  prompt: {
    messages: {},
    questions: {
      type: {
        description: 'please input type:',
      },
    },
  },
};

module.exports = Configuration;

When I commit with a message like "chore(test): Perfectly valid commit message", I should at least see an error telling me the possible enums.

Current Behavior

It complains about type & subject being empty.

✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...
⧗   input: chore(test): Perfectly valid commit message
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

No response

Steps to Reproduce

1. mkdir fresh && cd fresh
2. pnpm i -D @commitlint/config-conventional conventional-changelog-atom @commitlint/format @commitlint/cli
3. # copy config from above
4. echo 'chore(test): Testing' | pnpm commitlint

Context

No response

commitlint --version

@commitlint/cli@17.4.4

git --version

git version 2.39.1

node --version

v18.12.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions