projecte_ionic/node_modules/eslint-plugin-jsdoc/dist/rules/requireThrows.js.map
2022-02-09 18:30:03 +01:00

1 line
4 KiB
Plaintext
Executable file

{"version":3,"sources":["../../src/rules/requireThrows.js"],"names":["canSkip","utils","hasATag","avoidDocs","report","tagName","getPreferredTagName","tags","getTags","iteratingFunction","isIteratingFunction","tag","missingThrowsTag","shouldReport","hasThrowValue","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","type","exemptedBy"],"mappings":";;;;;;;AAAA;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,OAAO,GAAIC,KAAD,IAAW;AACzB,SAAOA,KAAK,CAACC,OAAN,CAAc,CACnB;AACA;AACA;AACA;AACA;AACA,YANmB,EAOnB,SAPmB,EASnB;AACA,QAVmB,CAAd,KAYLD,KAAK,CAACE,SAAN,EAZF;AAaD,CAdD;;eAgBe,2BAAa,CAAC;AAC3BC,EAAAA,MAD2B;AAE3BH,EAAAA;AAF2B,CAAD,KAGtB;AACJ;AACA;AACA,MAAID,OAAO,CAACC,KAAD,CAAX,EAAoB;AAClB;AACD;;AAED,QAAMI,OAAO,GAAGJ,KAAK,CAACK,mBAAN,CAA0B;AAACD,IAAAA,OAAO,EAAE;AAAV,GAA1B,CAAhB;;AACA,MAAI,CAACA,OAAL,EAAc;AACZ;AACD;;AAED,QAAME,IAAI,GAAGN,KAAK,CAACO,OAAN,CAAcH,OAAd,CAAb;AACA,QAAMI,iBAAiB,GAAGR,KAAK,CAACS,mBAAN,EAA1B,CAbI,CAeJ;;AACA,QAAM,CAACC,GAAD,IAAQJ,IAAd;AACA,QAAMK,gBAAgB,GAAG,OAAOD,GAAP,KAAe,WAAf,IAA8BA,GAAG,KAAK,IAA/D;;AAEA,QAAME,YAAY,GAAG,MAAM;AACzB,QAAI,CAACD,gBAAL,EAAuB;AACrB,aAAO,KAAP;AACD;;AAED,WAAOH,iBAAiB,IAAIR,KAAK,CAACa,aAAN,EAA5B;AACD,GAND;;AAQA,MAAID,YAAY,EAAhB,EAAoB;AAClBT,IAAAA,MAAM,CAAE,kBAAiBC,OAAQ,eAA3B,CAAN;AACD;AACF,CAjCc,EAiCZ;AACDU,EAAAA,eAAe,EAAE,IADhB;AAEDC,EAAAA,IAAI,EAAE;AACJC,IAAAA,IAAI,EAAE;AACJC,MAAAA,GAAG,EAAE;AADD,KADF;AAIJC,IAAAA,MAAM,EAAE,CACN;AACEC,MAAAA,oBAAoB,EAAE,KADxB;AAEEC,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAE;AACRC,UAAAA,KAAK,EAAE;AACLC,YAAAA,IAAI,EAAE;AADD,WADC;AAIRA,UAAAA,IAAI,EAAE;AAJE,SADA;AAOVC,QAAAA,UAAU,EAAE;AACVF,UAAAA,KAAK,EAAE;AACLC,YAAAA,IAAI,EAAE;AADD,WADG;AAIVA,UAAAA,IAAI,EAAE;AAJI;AAPF,OAFd;AAgBEA,MAAAA,IAAI,EAAE;AAhBR,KADM,CAJJ;AAwBJA,IAAAA,IAAI,EAAE;AAxBF;AAFL,CAjCY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\n/**\n * We can skip checking for a throws value, in case the documentation is inherited\n * or the method is either a constructor or an abstract method.\n *\n * @param {*} utils\n * a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean}\n * true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not necessary to document that they throw an error.\n 'abstract',\n 'virtual',\n\n // The designated type can itself document `@throws`\n 'type',\n ]) ||\n utils.avoidDocs();\n};\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n // A preflight check. We do not need to run a deep check for abstract\n // functions.\n if (canSkip(utils)) {\n return;\n }\n\n const tagName = utils.getPreferredTagName({tagName: 'throws'});\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n const iteratingFunction = utils.isIteratingFunction();\n\n // In case the code returns something, we expect a return value in JSDoc.\n const [tag] = tags;\n const missingThrowsTag = typeof tag === 'undefined' || tag === null;\n\n const shouldReport = () => {\n if (!missingThrowsTag) {\n return false;\n }\n\n return iteratingFunction && utils.hasThrowValue();\n };\n\n if (shouldReport()) {\n report(`Missing JSDoc @${tagName} declaration.`);\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\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":"requireThrows.js"}