Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@commitlint/core

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commitlint/core - npm Package Compare versions

Comparing version
3.0.2
to
3.0.3
+27
-0
CHANGELOG.md

@@ -6,2 +6,7 @@ # Change Log

<a name="3.0.3"></a>
## 3.0.3 (2017-07-16)
<a name="3.0.2"></a>

@@ -29,2 +34,24 @@ ## 3.0.2 (2017-07-11)

<a name="3.0.2"></a>
## 3.0.2 (2017-07-11)
### Bug Fixes
* enable recursive relative extends ([4decd4d](https://github.com/marionebl/commitlint/commit/4decd4d))
* ensure node4 compat ([bfeb653](https://github.com/marionebl/commitlint/commit/bfeb653))
* **core:** ignore version commits with leading whitespace ([9551bd6](https://github.com/marionebl/commitlint/commit/9551bd6))
* **core:** resolve extends relative to config file ([0dd18bc](https://github.com/marionebl/commitlint/commit/0dd18bc))
* use conventional-changelog-angular again ([633d835](https://github.com/marionebl/commitlint/commit/633d835))
### Features
* **core:** do not prefix relative extends ([8fbbaed](https://github.com/marionebl/commitlint/commit/8fbbaed))
* **core:** readd support for .conventional-changelog-lintrc ([02e4f43](https://github.com/marionebl/commitlint/commit/02e4f43))
* **core:** support conventional-changelog-lint-config-* ([c80766b](https://github.com/marionebl/commitlint/commit/c80766b))
<a name="3.0.1"></a>

@@ -31,0 +58,0 @@ ## 3.0.1 (2017-07-11)

+2
-1
module.exports = {
rules: {
'type-enum': [2,
'type-enum': [
2,
'always',

@@ -5,0 +6,0 @@ [

@@ -26,3 +26,5 @@ 'use strict';

var _ensureTense = (0, _ensureTense3.default)(parsed.footer, tenses, { ignored }),
var _ensureTense = (0, _ensureTense3.default)(parsed.footer, tenses, {
ignored
}),
matches = _ensureTense.matches,

@@ -29,0 +31,0 @@ offending = _ensureTense.offending;

@@ -26,3 +26,5 @@ 'use strict';

var _ensureTense = (0, _ensureTense3.default)(parsed.subject, tenses, { ignored }),
var _ensureTense = (0, _ensureTense3.default)(parsed.subject, tenses, {
ignored
}),
matches = _ensureTense.matches,

@@ -29,0 +31,0 @@ offending = _ensureTense.offending;

{
"name": "@commitlint/core",
"version": "3.0.2",
"version": "3.0.3",
"description": "Lint your commit messages",

@@ -104,3 +104,3 @@ "main": "lib/index.js",

"devDependencies": {
"@commitlint/utils": "^3.0.2",
"@commitlint/utils": "^3.0.3",
"ansi-styles": "3.1.0",

@@ -107,0 +107,0 @@ "ava": "0.18.2",

@@ -7,13 +7,18 @@ import chalk from 'chalk';

export default function format(report = {}, options = {}) {
const {signs = DEFAULT_SIGNS, colors = DEFAULT_COLORS, color: enabled = true} = options;
const {
signs = DEFAULT_SIGNS,
colors = DEFAULT_COLORS,
color: enabled = true
} = options;
const {errors = [], warnings = []} = report;
const problems = [...errors, ...warnings]
.map(problem => {
const sign = signs[problem.level] || '';
const color = colors[problem.level] || 'white';
const decoration = enabled ? chalk[color](sign) : sign;
const name = enabled ? chalk.grey(`[${problem.name}]`) : `[${problem.name}]`;
return `${decoration} ${problem.message} ${name}`;
});
const problems = [...errors, ...warnings].map(problem => {
const sign = signs[problem.level] || '';
const color = colors[problem.level] || 'white';
const decoration = enabled ? chalk[color](sign) : sign;
const name = enabled
? chalk.grey(`[${problem.name}]`)
: `[${problem.name}]`;
return `${decoration} ${problem.message} ${name}`;
});

@@ -20,0 +25,0 @@ const sign = selectSign({errors, warnings});

@@ -87,20 +87,23 @@ import test from 'ava';

test('uses signs as configured', t => {
const [err, warn] = format({
errors: [
{
level: 2,
name: 'error-name',
message: 'There was an error'
}
],
warnings: [
{
level: 1,
name: 'warning-name',
message: 'There was a problem'
}
]
}, {
signs: ['HNT', 'WRN', 'ERR']
});
const [err, warn] = format(
{
errors: [
{
level: 2,
name: 'error-name',
message: 'There was an error'
}
],
warnings: [
{
level: 1,
name: 'warning-name',
message: 'There was a problem'
}
]
},
{
signs: ['HNT', 'WRN', 'ERR']
}
);

@@ -135,20 +138,23 @@ t.true(err.includes('ERR'));

test('uses colors as configured', t => {
const [err, warn] = format({
errors: [
{
level: 2,
name: 'error-name',
message: 'There was an error'
}
],
warnings: [
{
level: 1,
name: 'warning-name',
message: 'There was a problem'
}
]
}, {
colors: ['white', 'magenta', 'blue']
});
const [err, warn] = format(
{
errors: [
{
level: 2,
name: 'error-name',
message: 'There was an error'
}
],
warnings: [
{
level: 1,
name: 'warning-name',
message: 'There was a problem'
}
]
},
{
colors: ['white', 'magenta', 'blue']
}
);

@@ -155,0 +161,0 @@ t.true(err.includes(blue.open));

import franc from 'franc';
export default (input, allowed) => {
const detected = franc.all(input)
const detected = franc
.all(input)
.filter(lang => lang[1] >= 0.45)

@@ -11,4 +12,3 @@ .map(lang => lang[0])

// guess any languages, let it through in this case
const matches = detected[0] === 'und' ||
detected.indexOf(allowed) > -1;
const matches = detected[0] === 'und' || detected.indexOf(allowed) > -1;

@@ -15,0 +15,0 @@ return {

@@ -35,6 +35,3 @@ import {Lexer, Tagger} from 'pos';

const tags = allowed.reduce((registry, name) => {
return [
...registry,
...(tenses[name] || [])
];
return [...registry, ...(tenses[name] || [])];
}, []);

@@ -49,3 +46,4 @@

const [word] = verb;
return !(options.ignored || []).some(ignored => ignored.indexOf(word) > -1);
return !(options.ignored || [])
.some(ignored => ignored.indexOf(word) > -1);
})

@@ -52,0 +50,0 @@ .filter(Boolean)

@@ -6,5 +6,5 @@ export default async entry => {

const [name, config] = entry;
return typeof config === 'function' ?
[name, await config()] :
[name, await config];
return typeof config === 'function'
? [name, await config()]
: [name, await config];
};
import semver from 'semver';
const WILDCARDS = [
c => c.match(/^(Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?))$)/),
c =>
c.match(
/^(Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?))$)/
),
c => c.match(/^(R|r)evert (.*)/),

@@ -6,0 +9,0 @@ c => c.match(/^(fixup|squash)!/),

@@ -17,3 +17,3 @@ import test from 'ava';

test('should return false for branch merges', t => {
t.true(isIgnored('Merge branch \'iss53\''));
t.true(isIgnored("Merge branch 'iss53'"));
});

@@ -26,4 +26,12 @@

test('should return true for revert commits', t => {
t.true(isIgnored(`Revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`));
t.true(isIgnored(`revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`));
t.true(
isIgnored(
`Revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`
)
);
t.true(
isIgnored(
`revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`
)
);
});

@@ -30,0 +38,0 @@

@@ -8,8 +8,12 @@ import path from 'path';

const {extends: e} = config;
const extended = loadExtends(config, context)
.reduceRight((r, c) => merge(r, omit(c, 'extends')), e ? {extends: e} : {});
const extended = loadExtends(config, context).reduceRight(
(r, c) => merge(r, omit(c, 'extends')),
e ? {extends: e} : {}
);
// Remove deprecation warning in version 3
if (typeof config === 'object' && 'wildcards' in config) {
console.warn(`'wildcards' found in top-level configuration ignored. Remove them from your config to silence this warning.`);
console.warn(
`'wildcards' found in top-level configuration ignored. Remove them from your config to silence this warning.`
);
}

@@ -29,3 +33,5 @@

if (typeof c === 'object' && 'wildcards' in c) {
console.warn(`'wildcards' found in '${raw}' ignored. To silence this warning raise an issue at 'npm repo ${raw}' to remove the wildcards.`);
console.warn(
`'wildcards' found in '${raw}' ignored. To silence this warning raise an issue at 'npm repo ${raw}' to remove the wildcards.`
);
}

@@ -45,3 +51,3 @@

const relative = first === '.';
return (scoped || relative) ? raw : [prefix, raw].filter(String).join('-');
return scoped || relative ? raw : [prefix, raw].filter(String).join('-');
}

@@ -58,3 +64,5 @@

const resolved = resolve(legacy, context);
console.warn(`Resolving ${raw} to legacy config ${legacy}. To silence this warning raise an issue at 'npm repo ${legacy}' to rename to ${id}.`);
console.warn(
`Resolving ${raw} to legacy config ${legacy}. To silence this warning raise an issue at 'npm repo ${legacy}' to rename to ${id}.`
);
return resolved;

@@ -61,0 +69,0 @@ }

@@ -116,3 +116,6 @@ import test from 'ava';

t.deepEqual(actual, ['prefix-extender-name', 'prefix-recursive-extender-name']);
t.deepEqual(actual, [
'prefix-extender-name',
'prefix-recursive-extender-name'
]);
});

@@ -154,3 +157,8 @@

if (id === 'recursive-extender-name') {
return {extends: ['second-recursive-extender-name'], zero: id, one: id, two: id};
return {
extends: ['second-recursive-extender-name'],
zero: id,
one: id,
two: id
};
}

@@ -157,0 +165,0 @@ if (id === 'second-recursive-extender-name') {

@@ -46,7 +46,5 @@ import {entries} from 'lodash';

const errors = results.filter(result =>
result.level > 1 && !result.valid);
const errors = results.filter(result => result.level > 1 && !result.valid);
const warnings = results.filter(result =>
result.level < 2 && !result.valid);
const warnings = results.filter(result => result.level < 2 && !result.valid);

@@ -53,0 +51,0 @@ const valid = errors.length === 0;

@@ -10,3 +10,3 @@ import path from 'path';

const w = (a, b) => Array.isArray(b) ? b : undefined;
const w = (a, b) => (Array.isArray(b) ? b : undefined);
const valid = input => pick(input, 'extends', 'rules');

@@ -31,20 +31,24 @@

// Execute rule config functions if needed
const executed = await Promise.all(['rules']
.map(key => {
return [key, preset[key]];
})
.map(async item => {
const [key, value] = item;
const executedValue = await Promise.all(
entries(value || {})
.map(entry => executeRule(entry))
);
return [key, executedValue.reduce((registry, item) => {
const executed = await Promise.all(
['rules']
.map(key => {
return [key, preset[key]];
})
.map(async item => {
const [key, value] = item;
return {
...registry,
[key]: value
};
}, {})];
}));
const executedValue = await Promise.all(
entries(value || {}).map(entry => executeRule(entry))
);
return [
key,
executedValue.reduce((registry, item) => {
const [key, value] = item;
return {
...registry,
[key]: value
};
}, {})
];
})
);

@@ -69,7 +73,17 @@ // Merge executed config keys into preset

if (legacyFound && !found) {
console.warn(`Using legacy ${path.relative(process.cwd(), legacy.config)}. Rename to commitlint.config.js to silence this warning.`);
console.warn(
`Using legacy ${path.relative(
process.cwd(),
legacy.config
)}. Rename to commitlint.config.js to silence this warning.`
);
}
if (legacyFound && found) {
console.warn(`Ignored legacy ${path.relative(process.cwd(), legacy.config)} as commitlint.config.js superseeds it. Remove .conventional-changelog-lintrc to silence this warning.`);
console.warn(
`Ignored legacy ${path.relative(
process.cwd(),
legacy.config
)} as commitlint.config.js superseeds it. Remove .conventional-changelog-lintrc to silence this warning.`
);
}

@@ -76,0 +90,0 @@

@@ -37,7 +37,7 @@ import {join} from 'path';

gitRawCommits(options)
.on('data', chunk => data.push(chunk.toString('utf-8')))
.on('error', reject)
.on('end', () => {
resolve(data);
});
.on('data', chunk => data.push(chunk.toString('utf-8')))
.on('error', reject)
.on('end', () => {
resolve(data);
});
});

@@ -44,0 +44,0 @@ }

@@ -74,3 +74,5 @@ import {tmpdir} from 'os';

const err = await t.throws(read({from: 'master'}));
t.true(err.message.indexOf('Could not get git history from shallow clone') > -1);
t.true(
err.message.indexOf('Could not get git history from shallow clone') > -1
);
});

@@ -77,0 +79,0 @@

@@ -15,10 +15,6 @@ import ensureCase from '../library/ensure-case';

negated ? !result : result,
[
`body must`,
negated ? `not` : null,
`be ${value}`
]
.filter(Boolean)
.join(' ')
[`body must`, negated ? `not` : null, `be ${value}`]
.filter(Boolean)
.join(' ')
];
};

@@ -9,10 +9,4 @@ import ensureNotEmpty from '../library/ensure-not-empty';

negated ? notEmpty : !notEmpty,
[
'body',
negated ? 'may not' : 'must',
'be empty'
]
.filter(Boolean)
.join(' ')
['body', negated ? 'may not' : 'must', 'be empty'].filter(Boolean).join(' ')
];
};

@@ -18,10 +18,6 @@ export default (parsed, when) => {

negated ? !succeeds : succeeds,
[
'body',
negated ? 'may not' : 'must',
'have leading blank line'
]
.filter(Boolean)
.join(' ')
['body', negated ? 'may not' : 'must', 'have leading blank line']
.filter(Boolean)
.join(' ')
];
};

@@ -21,5 +21,5 @@ import ensureTense from '../library/ensure-tense';

]
.filter(Boolean)
.join(' ')
.filter(Boolean)
.join(' ')
];
};

@@ -30,3 +30,5 @@ import test from 'ava';

test('present succeeds "always present-imperative"', async t => {
const [actual] = footerTense(await parsed.presentImperative, 'always', ['present-imperative']);
const [actual] = footerTense(await parsed.presentImperative, 'always', [
'present-imperative'
]);
const expected = true;

@@ -37,3 +39,5 @@ t.is(actual, expected);

test('present fails "never present-imperative"', async t => {
const [actual] = footerTense(await parsed.presentImperative, 'never', ['present-imperative']);
const [actual] = footerTense(await parsed.presentImperative, 'never', [
'present-imperative'
]);
const expected = false;

@@ -44,3 +48,5 @@ t.is(actual, expected);

test('present succeeds "always present-participle"', async t => {
const [actual] = footerTense(await parsed.presentParticiple, 'always', ['present-participle']);
const [actual] = footerTense(await parsed.presentParticiple, 'always', [
'present-participle'
]);
const expected = true;

@@ -51,3 +57,5 @@ t.is(actual, expected);

test('present fails "never present-participle"', async t => {
const [actual] = footerTense(await parsed.presentParticiple, 'never', ['present-participle']);
const [actual] = footerTense(await parsed.presentParticiple, 'never', [
'present-participle'
]);
const expected = false;

@@ -58,3 +66,5 @@ t.is(actual, expected);

test('present succeeds "always present-third-person"', async t => {
const [actual] = footerTense(await parsed.presentThirdPerson, 'always', ['present-third-person']);
const [actual] = footerTense(await parsed.presentThirdPerson, 'always', [
'present-third-person'
]);
const expected = true;

@@ -65,3 +75,5 @@ t.is(actual, expected);

test('present fails "never present-third-person"', async t => {
const [actual] = footerTense(await parsed.presentThirdPerson, 'never', ['present-third-person']);
const [actual] = footerTense(await parsed.presentThirdPerson, 'never', [
'present-third-person'
]);
const expected = false;

@@ -84,3 +96,5 @@ t.is(actual, expected);

test('mixed fails "always present-third-person"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-third-person']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-third-person'
]);
const expected = false;

@@ -91,3 +105,5 @@ t.is(actual, expected);

test('mixed fails "always present-imperative"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-imperative']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-imperative'
]);
const expected = false;

@@ -98,3 +114,5 @@ t.is(actual, expected);

test('present fails "always present-participle"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-participle']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-participle'
]);
const expected = false;

@@ -111,3 +129,8 @@ t.is(actual, expected);

test('mixed succeeds "always present-third-person, present-imperative, present-participle, past-tense"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-third-person', 'present-imperative', 'present-participle', 'past-tense']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-third-person',
'present-imperative',
'present-participle',
'past-tense'
]);
const expected = true;

@@ -114,0 +137,0 @@ t.is(actual, expected);

@@ -9,10 +9,6 @@ import ensureNotEmpty from '../library/ensure-not-empty';

negated ? notEmpty : !notEmpty,
[
'footer',
negated ? 'may not' : 'must',
'be empty'
]
.filter(Boolean)
.join(' ')
['footer', negated ? 'may not' : 'must', 'be empty']
.filter(Boolean)
.join(' ')
];
};

@@ -12,5 +12,3 @@ export default (parsed, when) => {

// Get complete message split into lines
const lines = (parsed.raw || '')
.split(/\r|\n/)
.slice(count + 1);
const lines = (parsed.raw || '').split(/\r|\n/).slice(count + 1);

@@ -24,10 +22,6 @@ const [leading] = lines;

negated ? !succeeds : succeeds,
[
'footer',
negated ? 'may not' : 'must',
'have leading blank line'
]
.filter(Boolean)
.join(' ')
['footer', negated ? 'may not' : 'must', 'have leading blank line']
.filter(Boolean)
.join(' ')
];
};

@@ -11,3 +11,4 @@ import test from 'ava';

with: 'chore: subject\nbody\n\nBREAKING CHANGE: something important',
withMulitLine: 'chore: subject\nmulti\nline\nbody\n\nBREAKING CHANGE: something important'
withMulitLine:
'chore: subject\nmulti\nline\nbody\n\nBREAKING CHANGE: something important'
};

@@ -14,0 +15,0 @@

@@ -9,3 +9,5 @@ import ensureTense from '../library/ensure-tense';

const ignored = [...ignoreConfig, ...parsed.notes.map(note => note.title)];
const {matches, offending} = ensureTense(parsed.footer, tenses, {ignored});
const {matches, offending} = ensureTense(parsed.footer, tenses, {
ignored
});
const offenders = offending

@@ -22,5 +24,5 @@ .map(item => [item.lemma, item.tense].join(' - '))

]
.filter(Boolean)
.join(' ')
.filter(Boolean)
.join(' ')
];
};

@@ -30,3 +30,5 @@ import test from 'ava';

test('with present footer should succeed for "always present-imperative"', async t => {
const [actual] = footerTense(await parsed.presentImperative, 'always', ['present-imperative']);
const [actual] = footerTense(await parsed.presentImperative, 'always', [
'present-imperative'
]);
const expected = true;

@@ -37,3 +39,5 @@ t.is(actual, expected);

test('with present footer should fail for "never present-imperative"', async t => {
const [actual] = footerTense(await parsed.presentImperative, 'never', ['present-imperative']);
const [actual] = footerTense(await parsed.presentImperative, 'never', [
'present-imperative'
]);
const expected = false;

@@ -44,3 +48,5 @@ t.is(actual, expected);

test('with present footer should succeed for "always present-participle"', async t => {
const [actual] = footerTense(await parsed.presentParticiple, 'always', ['present-participle']);
const [actual] = footerTense(await parsed.presentParticiple, 'always', [
'present-participle'
]);
const expected = true;

@@ -51,3 +57,5 @@ t.is(actual, expected);

test('with present footer should fail for "never present-participle"', async t => {
const [actual] = footerTense(await parsed.presentParticiple, 'never', ['present-participle']);
const [actual] = footerTense(await parsed.presentParticiple, 'never', [
'present-participle'
]);
const expected = false;

@@ -58,3 +66,5 @@ t.is(actual, expected);

test('with present footer should succeed for "always present-third-person"', async t => {
const [actual] = footerTense(await parsed.presentThirdPerson, 'always', ['present-third-person']);
const [actual] = footerTense(await parsed.presentThirdPerson, 'always', [
'present-third-person'
]);
const expected = true;

@@ -65,3 +75,5 @@ t.is(actual, expected);

test('with present footer should fail for "never present-third-person"', async t => {
const [actual] = footerTense(await parsed.presentThirdPerson, 'never', ['present-third-person']);
const [actual] = footerTense(await parsed.presentThirdPerson, 'never', [
'present-third-person'
]);
const expected = false;

@@ -84,3 +96,5 @@ t.is(actual, expected);

test('with mixed footer should fail for "always present-third-person"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-third-person']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-third-person'
]);
const expected = false;

@@ -91,3 +105,5 @@ t.is(actual, expected);

test('with mixed footer should fail for "always present-imperative"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-imperative']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-imperative'
]);
const expected = false;

@@ -98,3 +114,5 @@ t.is(actual, expected);

test('with present footer should fail for "always present-participle"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-participle']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-participle'
]);
const expected = false;

@@ -111,3 +129,8 @@ t.is(actual, expected);

test('with mixed footer should succeed for "always present-third-person, present-imperative, present-participle, past-tense"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-third-person', 'present-imperative', 'present-participle', 'past-tense']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-third-person',
'present-imperative',
'present-participle',
'past-tense'
]);
const expected = true;

@@ -114,0 +137,0 @@ t.is(actual, expected);

@@ -23,5 +23,3 @@ import path from 'path';

});
return files
.map(relative)
.map(toExport);
return files.map(relative).map(toExport);
}

@@ -28,0 +26,0 @@

@@ -15,5 +15,5 @@ // TODO: this should be named subject-lang

]
.filter(Boolean)
.join(' ')
.filter(Boolean)
.join(' ')
];
};

@@ -15,10 +15,6 @@ import ensureCase from '../library/ensure-case';

negated ? !result : result,
[
`scope must`,
negated ? `not` : null,
`be ${value}`
]
.filter(Boolean)
.join(' ')
[`scope must`, negated ? `not` : null, `be ${value}`]
.filter(Boolean)
.join(' ')
];
};

@@ -8,10 +8,6 @@ import ensureNotEmpty from '../library/ensure-not-empty';

negated ? !notEmpty : notEmpty,
[
'scope',
negated ? 'must' : 'may not',
'be empty'
]
.filter(Boolean)
.join(' ')
['scope', negated ? 'must' : 'may not', 'be empty']
.filter(Boolean)
.join(' ')
];
};

@@ -13,10 +13,6 @@ import ensureEnum from '../library/ensure-enum';

negated ? !result : result,
[
`scope must`,
negated ? `not` : null,
`be one of [${value.join(', ')}]`
]
.filter(Boolean)
.join(' ')
[`scope must`, negated ? `not` : null, `be one of [${value.join(', ')}]`]
.filter(Boolean)
.join(' ')
];
};

@@ -15,10 +15,6 @@ import ensureCase from '../library/ensure-case';

negated ? !result : result,
[
`subject must`,
negated ? `not` : null,
`be ${value}`
]
.filter(Boolean)
.join(' ')
[`subject must`, negated ? `not` : null, `be ${value}`]
.filter(Boolean)
.join(' ')
];
};

@@ -9,10 +9,6 @@ import ensureNotEmpty from '../library/ensure-not-empty';

negated ? notEmpty : !notEmpty,
[
'message',
negated ? 'may not' : 'must',
'be empty'
]
.filter(Boolean)
.join(' ')
['message', negated ? 'may not' : 'must', 'be empty']
.filter(Boolean)
.join(' ')
];
};

@@ -13,10 +13,6 @@ export default (parsed, when, value) => {

negated ? !hasStop : hasStop,
[
'message',
negated ? 'may not' : 'must',
'end with full stop'
]
.filter(Boolean)
.join(' ')
['message', negated ? 'may not' : 'must', 'end with full stop']
.filter(Boolean)
.join(' ')
];
};

@@ -17,10 +17,6 @@ // TODO

negated ? !result : result,
[
`message must`,
negated ? `not` : null,
`be ${value}`
]
.filter(Boolean)
.join(' ')
[`message must`, negated ? `not` : null, `be ${value}`]
.filter(Boolean)
.join(' ')
];
};

@@ -9,3 +9,5 @@ import ensureTense from '../library/ensure-tense';

const ignored = [...ignoreConfig, ...parsed.notes.map(note => note.title)];
const {matches, offending} = ensureTense(parsed.subject, tenses, {ignored});
const {matches, offending} = ensureTense(parsed.subject, tenses, {
ignored
});
const offenders = offending

@@ -22,5 +24,5 @@ .map(item => [item.lemma, item.tense].join(' - '))

]
.filter(Boolean)
.join(' ')
.filter(Boolean)
.join(' ')
];
};

@@ -30,3 +30,5 @@ import test from 'ava';

test('present succeeds "always present-imperative"', async t => {
const [actual] = footerTense(await parsed.presentImperative, 'always', ['present-imperative']);
const [actual] = footerTense(await parsed.presentImperative, 'always', [
'present-imperative'
]);
const expected = true;

@@ -37,3 +39,5 @@ t.is(actual, expected);

test('present fails "never present-imperative"', async t => {
const [actual] = footerTense(await parsed.presentImperative, 'never', ['present-imperative']);
const [actual] = footerTense(await parsed.presentImperative, 'never', [
'present-imperative'
]);
const expected = false;

@@ -44,3 +48,5 @@ t.is(actual, expected);

test('present succeeds "always present-participle"', async t => {
const [actual] = footerTense(await parsed.presentParticiple, 'always', ['present-participle']);
const [actual] = footerTense(await parsed.presentParticiple, 'always', [
'present-participle'
]);
const expected = true;

@@ -51,3 +57,5 @@ t.is(actual, expected);

test('present fails "never present-participle"', async t => {
const [actual] = footerTense(await parsed.presentParticiple, 'never', ['present-participle']);
const [actual] = footerTense(await parsed.presentParticiple, 'never', [
'present-participle'
]);
const expected = false;

@@ -58,3 +66,5 @@ t.is(actual, expected);

test('present succeeds "always present-third-person"', async t => {
const [actual] = footerTense(await parsed.presentThirdPerson, 'always', ['present-third-person']);
const [actual] = footerTense(await parsed.presentThirdPerson, 'always', [
'present-third-person'
]);
const expected = true;

@@ -65,3 +75,5 @@ t.is(actual, expected);

test('present fails "never present-third-person"', async t => {
const [actual] = footerTense(await parsed.presentThirdPerson, 'never', ['present-third-person']);
const [actual] = footerTense(await parsed.presentThirdPerson, 'never', [
'present-third-person'
]);
const expected = false;

@@ -84,3 +96,5 @@ t.is(actual, expected);

test('mixed fails "always present-third-person"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-third-person']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-third-person'
]);
const expected = false;

@@ -91,3 +105,5 @@ t.is(actual, expected);

test('mixed fails "always present-imperative"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-imperative']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-imperative'
]);
const expected = false;

@@ -98,3 +114,5 @@ t.is(actual, expected);

test('present fails "always present-participle"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-participle']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-participle'
]);
const expected = false;

@@ -111,3 +129,8 @@ t.is(actual, expected);

test('mixed succeeds "always present-third-person, present-imperative, present-participle, past-tense"', async t => {
const [actual] = footerTense(await parsed.mixed, 'always', ['present-third-person', 'present-imperative', 'present-participle', 'past-tense']);
const [actual] = footerTense(await parsed.mixed, 'always', [
'present-third-person',
'present-imperative',
'present-participle',
'past-tense'
]);
const expected = true;

@@ -114,0 +137,0 @@ t.is(actual, expected);

@@ -15,10 +15,6 @@ import ensureCase from '../library/ensure-case';

negated ? !result : result,
[
`subject must`,
negated ? `not` : null,
`be ${value}`
]
.filter(Boolean)
.join(' ')
[`subject must`, negated ? `not` : null, `be ${value}`]
.filter(Boolean)
.join(' ')
];
};

@@ -8,10 +8,4 @@ import ensureNotEmpty from '../library/ensure-not-empty';

negated ? notEmpty : !notEmpty,
[
'type',
negated ? 'may not' : 'must',
'be empty'
]
.filter(Boolean)
.join(' ')
['type', negated ? 'may not' : 'must', 'be empty'].filter(Boolean).join(' ')
];
};

@@ -15,10 +15,6 @@ import ensureEnum from '../library/ensure-enum';

negated ? !result : result,
[
`scope must`,
negated ? `not` : null,
`be one of [${value.join(', ')}]`
]
.filter(Boolean)
.join(' ')
[`scope must`, negated ? `not` : null, `be one of [${value.join(', ')}]`]
.filter(Boolean)
.join(' ')
];
};