github-pages-deploy-action/node_modules/eslint-plugin-jsdoc/dist/rules/checkValues.js.map
2020-03-31 08:40:00 -04:00

1 line
6.9 KiB
Plaintext

{"version":3,"sources":["../../src/rules/checkValues.js"],"names":["utils","report","context","options","allowedLicenses","allowedAuthors","licensePattern","forEachPreferredTag","jsdocParameter","targetTagName","version","description","trim","semver","valid","licenseRegex","RegExp","match","license","includes","join","error","author","iterateAllJsdocs","meta","schema","additionalProperties","properties","items","type","anyOf"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;eAEe,2BAAa,CAAC;AAC3BA,EAAAA,KAD2B;AAE3BC,EAAAA,MAF2B;AAG3BC,EAAAA;AAH2B,CAAD,KAItB;AACJ,QAAMC,OAAO,GAAGD,OAAO,CAACC,OAAR,CAAgB,CAAhB,KAAsB,EAAtC;AADI,gCAMAA,OANA,CAGFC,eAHE;AAAA,QAGFA,eAHE,sCAGgB,IAHhB;AAAA,gCAMAD,OANA,CAIFE,cAJE;AAAA,QAIFA,cAJE,sCAIe,IAJf;AAAA,gCAMAF,OANA,CAKFG,cALE;AAAA,QAKFA,cALE,sCAKe,UALf;AAQJN,EAAAA,KAAK,CAACO,mBAAN,CAA0B,SAA1B,EAAqC,CAACC,cAAD,EAAiBC,aAAjB,KAAmC;AACtE,UAAMC,OAAO,GAAGF,cAAc,CAACG,WAAf,CAA2BC,IAA3B,EAAhB;;AACA,QAAI,CAACF,OAAL,EAAc;AACZT,MAAAA,MAAM,CACH,kBAAiBQ,aAAc,GAD5B,EAEJ,IAFI,EAGJD,cAHI,CAAN;AAKD,KAND,MAMO,IAAI,CAACK,gBAAOC,KAAP,CAAaJ,OAAb,CAAL,EAA4B;AACjCT,MAAAA,MAAM,CACH,kBAAiBQ,aAAc,MAAKD,cAAc,CAACG,WAAY,IAD5D,EAEJ,IAFI,EAGJH,cAHI,CAAN;AAKD;AACF,GAfD;AAgBAR,EAAAA,KAAK,CAACO,mBAAN,CAA0B,OAA1B,EAAmC,CAACC,cAAD,EAAiBC,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AE;AADQ;AApBN,OAFd;AA0BEA,MAAAA,IAAI,EAAE;AA1BR,KADM,CADJ;AA+BJA,IAAAA,IAAI,EAAE;AA/BF;AAFL,CA7FY,C","sourcesContent":["import semver from 'semver';\nimport spdxExpressionParse from 'spdx-expression-parse';\nimport iterateJsdoc from '../iterateJsdoc';\n\nexport default iterateJsdoc(({\n utils,\n report,\n context,\n}) => {\n const options = context.options[0] || {};\n const {\n allowedLicenses = null,\n allowedAuthors = null,\n licensePattern = '([^\\n]*)',\n } = options;\n\n utils.forEachPreferredTag('version', (jsdocParameter, targetTagName) => {\n const version = jsdocParameter.description.trim();\n if (!version) {\n report(\n `Missing JSDoc @${targetTagName}.`,\n null,\n jsdocParameter,\n );\n } else if (!semver.valid(version)) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${jsdocParameter.description}\".`,\n null,\n jsdocParameter,\n );\n }\n });\n utils.forEachPreferredTag('since', (jsdocParameter, targetTagName) => {\n const version = jsdocParameter.description.trim();\n if (!version) {\n report(\n `Missing JSDoc @${targetTagName}.`,\n null,\n jsdocParameter,\n );\n } else if (!semver.valid(version)) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${jsdocParameter.description}\".`,\n null,\n jsdocParameter,\n );\n }\n });\n utils.forEachPreferredTag('license', (jsdocParameter, targetTagName) => {\n const licenseRegex = new RegExp(licensePattern, 'g');\n const match = jsdocParameter.description.match(licenseRegex);\n const license = match && match[1] || match[0];\n if (!license.trim()) {\n report(\n `Missing JSDoc @${targetTagName}.`,\n null,\n jsdocParameter,\n );\n } else if (allowedLicenses) {\n if (allowedLicenses !== true && !allowedLicenses.includes(license)) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${license}\"; expected one of ${allowedLicenses.join(', ')}.`,\n null,\n jsdocParameter,\n );\n }\n } else {\n try {\n spdxExpressionParse(license);\n } catch (error) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${license}\"; expected SPDX expression: https://spdx.org/licenses/.`,\n null,\n jsdocParameter,\n );\n }\n }\n });\n\n utils.forEachPreferredTag('author', (jsdocParameter, targetTagName) => {\n const author = jsdocParameter.description;\n if (!author.trim()) {\n report(\n `Missing JSDoc @${targetTagName}.`,\n null,\n jsdocParameter,\n );\n } else if (allowedAuthors) {\n if (!allowedAuthors.includes(author)) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${jsdocParameter.description}\"; expected one of ${allowedAuthors.join(', ')}.`,\n null,\n jsdocParameter,\n );\n }\n }\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowedAuthors: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n allowedLicenses: {\n anyOf: [\n {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n {\n type: 'boolean',\n },\n ],\n },\n licensePattern: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"checkValues.js"}