npm-package-json-lint
Version:
Configurable linter for package.json files.
2 lines • 1.1 kB
JavaScript
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./lint-issue.js`),t=require(`./type.js`),n=`description-format`,r=`description`,i=(i,a,o)=>{if(!i.hasOwnProperty(r))return null;let{description:s}=i;if(!t.i(i,r))return new e.t(n,a,r,`Type should be a string`);if(o.hasOwnProperty(`requireCapitalFirstLetter`)&&o.requireCapitalFirstLetter&&s.length>0&&s[0]!==s[0].toUpperCase())return new e.t(n,a,r,`The description should start with a capital letter. It currently starts with ${s[0]}.`);if(o.hasOwnProperty(`requireEndingPeriod`)&&o.hasOwnProperty(`forbidEndingPeriod`))throw Error("description-format does not support `requireEndingPeriod` and `forbidEndingPeriod` being `true`.");return o.hasOwnProperty(`requireEndingPeriod`)&&o.requireEndingPeriod&&!s.endsWith(`.`)?new e.t(n,a,r,`The description should end with a period.`):o.hasOwnProperty(`forbidEndingPeriod`)&&o.forbidEndingPeriod&&s.endsWith(`.`)?new e.t(n,a,r,`The description should not end with a period.`):null};exports.lint=i,exports.ruleType=`object`;
//# sourceMappingURL=description-format.js.map