babel-preset-commitlint

raw JSON →
9.0.1 verified Fri May 01 auth: no javascript maintenance

Babel preset for commitlint, a tool that lints commit messages against configurable rules. This package provides a Babel preset configuration for commitlint, useful when using commitlint with Babel. The current stable version is 9.0.1 (last released on 2021-05-20), part of the commitlint v9 series. Note that commitlint itself has evolved to v17+, and babel-preset-commitlint may be obsolete; the modern approach is to use `@commitlint/cli` directly with conventional-changelog presets. This package has minimal maintenance and is likely deprecated or superseded by other commitlint packages.

error Error: Cannot find module 'babel-preset-commitlint'
cause The package is not installed or is missing from node_modules.
fix
Run npm install --save-dev babel-preset-commitlint to install it.
error Error: Preset 'babel-preset-commitlint' requires a BABEL_ENV or NODE_ENV
cause The preset may need an environment variable set, but it's not documented.
fix
Set BABEL_ENV or NODE_ENV to 'production', 'development', or 'test' as needed.
deprecated babel-preset-commitlint is outdated; commitlint has evolved and this preset is no longer maintained.
fix Use @commitlint/cli directly and configure via commitlint.config.js instead of relying on Babel preset.
breaking commitlint v9 introduced breaking changes; babel-preset-commitlint@9.0.1 may not work with newer commitlint versions.
fix Upgrade to @commitlint/cli and configure without the Babel preset.
gotcha This preset is intended for use with commitlint, but it is a separate package; users often mistakenly think it replaces the commitlint CLI.
fix Install @commitlint/cli as the main linting tool; babel-preset-commitlint only provides Babel integration.
npm install babel-preset-commitlint
yarn add babel-preset-commitlint
pnpm add babel-preset-commitlint

Shows how to configure Babel preset in Babel config to enable commitlint linting.

// In .babelrc or babel.config.js
module.exports = {
  presets: [
    'babel-preset-commitlint'
  ]
};

// Then run commitlint as usual, e.g., commitlint -E HUSKY_GIT_PARAMS