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

1 line
4.5 KiB
Plaintext

{"version":3,"sources":["../../src/rules/requireExample.js"],"names":["jsdoc","report","utils","context","avoidDocs","options","avoidExampleOnConstructors","targetTagName","functionExamples","_","filter","tags","tag","hasATag","isConstructor","length","reportJSDoc","line","push","description","name","optional","type","forEach","example","exampleContent","compact","trim","split","contextDefaults","meta","fixable","schema","additionalProperties","properties","default","contexts","items","exemptedBy"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;eAEe,2BAAa,CAAC;AAC3BA,EAAAA,KAD2B;AAE3BC,EAAAA,MAF2B;AAG3BC,EAAAA,KAH2B;AAI3BC,EAAAA;AAJ2B,CAAD,KAKtB;AACJ,oCAAoBA,OAApB,EAA6B,iBAA7B;;AAEA,MAAID,KAAK,CAACE,SAAN,EAAJ,EAAuB;AACrB;AACD;;AALG,eAOyCD,OAAO,CAACE,OAAR,CAAgB,CAAhB,KAAsB,EAP/D;AAAA,qCAOGC,0BAPH;AAAA,QAOGA,0BAPH,sCAOgC,KAPhC;;AASJ,QAAMC,aAAa,GAAG,SAAtB;;AAEA,QAAMC,gBAAgB,GAAGC,gBAAEC,MAAF,CAASV,KAAK,CAACW,IAAf,EAAqB;AAC5CC,IAAAA,GAAG,EAAEL;AADuC,GAArB,CAAzB;;AAIA,MAAID,0BAA0B,KAC5BJ,KAAK,CAACW,OAAN,CAAc,CACZ,OADY,EAEZ,aAFY,CAAd,KAIAX,KAAK,CAACY,aAAN,EAL4B,CAA9B,EAMG;AACD;AACD;;AAED,MAAI,CAACN,gBAAgB,CAACO,MAAtB,EAA8B;AAC5Bb,IAAAA,KAAK,CAACc,WAAN,CAAmB,kBAAiBT,aAAc,eAAlD,EAAkE,IAAlE,EAAwE,MAAM;AAC5E,UAAI,CAACP,KAAK,CAACW,IAAX,EAAiB;AACfX,QAAAA,KAAK,CAACW,IAAN,GAAa,EAAb;AACD;;AACD,Y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UAAU,EAAE;AACVD,UAAAA,KAAK,EAAE;AACLf,YAAAA,IAAI,EAAE;AADD,WADG;AAIVA,UAAAA,IAAI,EAAE;AAJI;AAXF,OAFd;AAoBEA,MAAAA,IAAI,EAAE;AApBR,KADM,CAFJ;AA0BJA,IAAAA,IAAI,EAAE;AA1BF;AAFL,CAxDY,C","sourcesContent":["import _ from 'lodash';\nimport iterateJsdoc from '../iterateJsdoc';\nimport warnRemovedSettings from '../warnRemovedSettings';\n\nexport default iterateJsdoc(({\n jsdoc,\n report,\n utils,\n context,\n}) => {\n warnRemovedSettings(context, 'require-example');\n\n if (utils.avoidDocs()) {\n return;\n }\n\n const {avoidExampleOnConstructors = false} = context.options[0] || {};\n\n const targetTagName = 'example';\n\n const functionExamples = _.filter(jsdoc.tags, {\n tag: targetTagName,\n });\n\n if (avoidExampleOnConstructors && (\n utils.hasATag([\n 'class',\n 'constructor',\n ]) ||\n utils.isConstructor()\n )) {\n return;\n }\n\n if (!functionExamples.length) {\n utils.reportJSDoc(`Missing JSDoc @${targetTagName} declaration.`, null, () => {\n if (!jsdoc.tags) {\n jsdoc.tags = [];\n }\n const line = jsdoc.tags.length ? jsdoc.tags[jsdoc.tags.length - 1].line + 1 : 0;\n jsdoc.tags.push({\n description: '',\n line,\n name: '',\n optional: false,\n tag: targetTagName,\n type: '',\n });\n });\n\n return;\n }\n\n functionExamples.forEach((example) => {\n const exampleContent = _.compact(`${example.name} ${example.description}`.trim().split('\\n'));\n\n if (!exampleContent.length) {\n report(`Missing JSDoc @${targetTagName} description.`);\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n avoidExampleOnConstructors: {\n default: false,\n type: 'boolean',\n },\n contexts: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n exemptedBy: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"requireExample.js"}