1 |
- {"version":3,"sources":["../../src/rules/noDefaults.js"],"names":["context","utils","noOptionalParamNames","options","paramTags","getPresentTags","forEach","tag","optional","reportJSDoc","changeTag","name","replace","default","defaultTags","description","trim","postTag","contextDefaults","meta","docs","url","fixable","schema","additionalProperties","properties","contexts","items","anyOf","type","comment"],"mappings":";;;;;;;AAAA;;;;eAEe,2BAAa,CAAC;AAC3BA,EAAAA,OAD2B;AAE3BC,EAAAA;AAF2B,CAAD,KAGtB;AACJ,QAAM;AAACC,IAAAA;AAAD,MAAyBF,OAAO,CAACG,OAAR,CAAgB,CAAhB,KAAsB,EAArD;AACA,QAAMC,SAAS,GAAGH,KAAK,CAACI,cAAN,CAAqB,CAAC,OAAD,EAAU,KAAV,EAAiB,UAAjB,CAArB,CAAlB;AACAD,EAAAA,SAAS,CAACE,OAAV,CAAmBC,GAAD,IAAS;AACzB,QAAIL,oBAAoB,IAAIK,GAAG,CAACC,QAAhC,EAA0C;AACxCP,MAAAA,KAAK,CAACQ,WAAN,CAAmB,8CAA6CF,GAAG,CAACA,GAAI,GAAxE,EAA4EA,GAA5E,EAAiF,MAAM;AACrFN,QAAAA,KAAK,CAACS,SAAN,CAAgBH,GAAhB,EAAqB;AACnBI,UAAAA,IAAI,EAAEJ,GAAG,CAACI,IAAJ,CAASC,OAAT,CAAiB,eAAjB,EAAkC,IAAlC;AADa,SAArB;AAGD,OAJD;AAKD,KAND,MAMO,IAAIL,GAAG,CAACM,OAAR,EAAiB;AACtBZ,MAAAA,KAAK,CAACQ,WAAN,CAAmB,kCAAiCF,GAAG,CAACA,GAAI,GAA5D,EAAgEA,GAAhE,EAAqE,MAAM;AACzEN,QAAAA,KAAK,CAACS,SAAN,CAAgBH,GAAhB,EAAqB;AACnBI,UAAAA,IAAI,EAAEJ,GAAG,CAACI,IAAJ,CAASC,OAAT,CAAiB,eAAjB,EAAkC,MAAlC;AADa,SAArB;AAGD,OAJD;AAKD;AACF,GAdD;AAeA,QAAME,WAAW,GAAGb,KAAK,C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AAI,EAAE;AA7BR,KADM,CANJ;AAuCJA,IAAAA,IAAI,EAAE;AAvCF;AAFL,CAhCY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nexport default iterateJsdoc(({\n context,\n utils,\n}) => {\n const {noOptionalParamNames} = context.options[0] || {};\n const paramTags = utils.getPresentTags(['param', 'arg', 'argument']);\n paramTags.forEach((tag) => {\n if (noOptionalParamNames && tag.optional) {\n utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/, '$1'),\n });\n });\n } else if (tag.default) {\n utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/, '[$1]'),\n });\n });\n }\n });\n const defaultTags = utils.getPresentTags(['default', 'defaultvalue']);\n defaultTags.forEach((tag) => {\n if (tag.description.trim()) {\n utils.reportJSDoc(`Default values are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n description: '',\n postTag: '',\n });\n });\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'This rule reports defaults being used on the relevant portion of `@param` or `@default`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-defaults',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n noOptionalParamNames: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"noDefaults.js"}
|