mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
1 line
5.1 KiB
Plaintext
1 line
5.1 KiB
Plaintext
{"version":3,"sources":["../../src/rules/requireHyphenBeforeParamDescription.js"],"names":["sourceCode","utils","report","context","jsdocNode","options","circumstance","checkProperties","always","checkHyphens","jsdocTag","targetTagName","description","startsWith","fixer","lineIndex","line","sourceLines","getText","split","descriptionIndex","lastIndexOf","replacementLine","slice","splice","replacement","join","replaceText","exec","unwantedPart","replace","length","forEachPreferredTag","iterateAllJsdocs","meta","fixable","schema","enum","type","additionalProperties","properties","default"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;eAEe,2BAAa,CAAC;AAC3BA,EAAAA,UAD2B;AAE3BC,EAAAA,KAF2B;AAG3BC,EAAAA,MAH2B;AAI3BC,EAAAA,OAJ2B;AAK3BC,EAAAA;AAL2B,CAAD,KAMtB;AAAA,0CAC2CD,OAAO,CAACE,OADnD;AAAA,QACGC,YADH;AAAA;AAAA,4DACqC,EADrC;AAAA,QACkBC,eADlB,sBACkBA,eADlB;;AAEJ,QAAMC,MAAM,GAAG,CAACF,YAAD,IAAiBA,YAAY,KAAK,QAAjD;;AAEA,QAAMG,YAAY,GAAG,CAACC,QAAD,EAAWC,aAAX,KAA6B;AAChD,QAAI,CAACD,QAAQ,CAACE,WAAd,EAA2B;AACzB;AACD;;AAED,QAAIJ,MAAJ,EAAY;AACV,UAAI,CAACE,QAAQ,CAACE,WAAT,CAAqBC,UAArB,CAAgC,GAAhC,CAAL,EAA2C;AACzCX,QAAAA,MAAM,CAAE,kCAAiCS,aAAc,eAAjD,EAAkEG,KAAD,IAAW;AAChF,gBAAMC,SAAS,GAAGL,QAAQ,CAACM,IAA3B;AACA,gBAAMC,WAAW,GAAGjB,UAAU,CAACkB,OAAX,CAAmBd,SAAnB,EAA8Be,KAA9B,CAAoC,IAApC,CAApB,CAFgF,CAIhF;;AACA,gBAAMP,WAAW,GAAGF,QAAQ,CAACE,WA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ACD;AACF,CAlDc,EAkDZ;AACDwB,EAAAA,gBAAgB,EAAE,IADjB;AAEDC,EAAAA,IAAI,EAAE;AACJC,IAAAA,OAAO,EAAE,MADL;AAEJC,IAAAA,MAAM,EAAE,CACN;AACEC,MAAAA,IAAI,EAAE,CAAC,QAAD,EAAW,OAAX,CADR;AAEEC,MAAAA,IAAI,EAAE;AAFR,KADM,EAKN;AACEC,MAAAA,oBAAoB,EAAE,KADxB;AAEEC,MAAAA,UAAU,EAAE;AACVjC,QAAAA,eAAe,EAAE;AACfkC,UAAAA,OAAO,EAAE,KADM;AAEfH,UAAAA,IAAI,EAAE;AAFS;AADP,OAFd;AAQEA,MAAAA,IAAI,EAAE;AARR,KALM,CAFJ;AAkBJA,IAAAA,IAAI,EAAE;AAlBF;AAFL,CAlDY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nexport default iterateJsdoc(({\n sourceCode,\n utils,\n report,\n context,\n jsdocNode,\n}) => {\n const [circumstance, {checkProperties} = {}] = context.options;\n const always = !circumstance || circumstance === 'always';\n\n const checkHyphens = (jsdocTag, targetTagName) => {\n if (!jsdocTag.description) {\n return;\n }\n\n if (always) {\n if (!jsdocTag.description.startsWith('-')) {\n report(`There must be a hyphen before @${targetTagName} description.`, (fixer) => {\n const lineIndex = jsdocTag.line;\n const sourceLines = sourceCode.getText(jsdocNode).split('\\n');\n\n // Get start index of description, accounting for multi-line descriptions\n const description = jsdocTag.description.split('\\n')[0];\n const descriptionIndex = sourceLines[lineIndex].lastIndexOf(description);\n\n const replacementLine = sourceLines[lineIndex]\n .slice(0, descriptionIndex) + '- ' + description;\n sourceLines.splice(lineIndex, 1, replacementLine);\n const replacement = sourceLines.join('\\n');\n\n return fixer.replaceText(jsdocNode, replacement);\n }, jsdocTag);\n }\n } else if (jsdocTag.description.startsWith('-')) {\n report(`There must be no hyphen before @${targetTagName} description.`, (fixer) => {\n const [unwantedPart] = /-\\s*/u.exec(jsdocTag.description);\n\n const replacement = sourceCode\n .getText(jsdocNode)\n .replace(jsdocTag.description, jsdocTag.description.slice(unwantedPart.length));\n\n return fixer.replaceText(jsdocNode, replacement);\n }, jsdocTag);\n }\n };\n\n utils.forEachPreferredTag('param', checkHyphens);\n if (checkProperties) {\n utils.forEachPreferredTag('property', checkHyphens);\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n fixable: 'code',\n schema: [\n {\n enum: ['always', 'never'],\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n checkProperties: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"file":"requireHyphenBeforeParamDescription.js"} |