How to use the @commitlint/core.format function in @commitlint/core

To help you get started, we’ve selected a few @commitlint/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paulirish / commitlintbot / src / lint.js View on Github external
baseConfig.extends = baseConfig.extends || [];

  let mergedConfig;
  if (czConfigContent) {
    // Hack because of some weird expectation inside of commitlint-config-cz/lib/config').get;
    if (!baseConfig.rules['scope-enum']) baseConfig.rules['scope-enum'] = [0, 'never', 'bullshit'];
    if (!baseConfig.rules['type-enum']) baseConfig.rules['type-enum'] = [0, 'never', 'bullshit'];

    mergedConfig = mergeCZWithBaseConfig(czConfigContent, baseConfig);
  } else {
    mergedConfig = baseConfig;
  }

  const opts = await commitlint.load(mergedConfig);
  const reportObj = await commitlint.lint(prTitle, opts.rules);
  const report = await commitlint.format(reportObj, {color: false});
  return {reportObj, report};
}

@commitlint/core

Lint your commit messages

MIT
Latest version published 2 months ago

Package Health Score

93 / 100
Full package analysis