npm-package-json-lint
Version:
Configurable linter for package.json files.
2 lines (1 loc) • 1.74 kB
JavaScript
var h=Object.create;var l=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var w=(r,t)=>{for(var n in t)l(r,n,{get:t[n],enumerable:!0})},g=(r,t,n,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!x.call(r,o)&&o!==n&&l(r,o,{get:()=>t[o],enumerable:!(e=b(t,o))||e.enumerable});return r};var u=(r,t,n)=>(n=r!=null?h(O(r)):{},g(t||!r||!r.__esModule?l(n,"default",{value:r,enumerable:!0}):n,r)),v=r=>g(l({},"__esModule",{value:!0}),r);var $={};w($,{arrayType:()=>I,lint:()=>V,minItems:()=>S,ruleType:()=>j});module.exports=v($);var a=u(require("chalk")),m=u(require("log-symbols"));var s=class{constructor(t,n,e,o){this.lintId=t,this.severity=n,this.node=e,this.lintMessage=o}toString(){let t=this.severity==="error"?m.default.error:m.default.warning,n=a.default.cyan.bold(this.lintId),e=a.default.magenta.bold(this.node),o=this.severity==="error"?a.default.red.bold(this.lintMessage):a.default.yellow(this.lintMessage);return`${t} ${n} - node: ${e} - ${o}`}};var c=u(require("is-plain-obj"));var y=(r,t)=>r.hasOwnProperty(t)?(0,c.default)(r[t]):!0,p=(r,t)=>r.hasOwnProperty(t)?typeof r[t]=="string":!0;var d=(r,t,n,e)=>r.hasOwnProperty(t)?e.includes(n):!0;var f="valid-values-author",i="author",j="array",S=1,I="string",V=(r,t,n)=>{let e;if(p(r,i))e=r[i];else if(y(r,i))if(r[i].hasOwnProperty("name"))e=r[i].name;else return new s(f,t,i,"author object missing name property");else return new s(f,t,i,"author node has invalid data type");return d(r,i,e,n)?null:new s(f,t,i,`Invalid value for author. Current value is ${e}. Value values include: ${n.join(", ")}.`)};0&&(module.exports={arrayType,lint,minItems,ruleType});