peach a19a732be8 commit message | 2 years ago | |
---|---|---|
.. | ||
lib | 2 years ago | |
CHANGELOG.md | 2 years ago | |
README.md | 2 years ago | |
license.md | 2 years ago | |
package.json | 2 years ago |
Lint a string against commitlint rules
npm install --save @commitlint/lint
const lint = require('@commitlint/lint').default;
lint('foo: bar', {'type-enum': [1, 'always', ['foo']]}).then((report) =>
console.log(report)
);
// => { valid: true, errors: [], warnings: [] }
lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}).then((report) =>
console.log(report)
);
/* =>
{ valid: true,
errors: [],
warnings:
[ { level: 1,
valid: false,
name: 'type-enum',
message: 'type must be one of [bar]' } ] }
*/
Consult docs/api for comprehensive documentation.