Skip to content

Instantly share code, notes, and snippets.



Last active Jun 27, 2020
What would you like to do?
const load = require('@commitlint/load').default;
const lint = require('@commitlint/lint').default;
const CONFIG = {
extends: ['@commitlint/config-conventional'],
function buildLintError(lintErrors) {
return => error.message);
export async function testTitle(title) {
const lintOptions = await load(CONFIG);
const lintResult = await lint(
lintOptions.parserPreset ? lintOptions.parserPreset : {}
if (!lintResult.valid) {
throw new Error(buildLintError(lintResult.errors));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.