|
1 |
- {"version":3,"sources":["../../src/rules/noMultiAsterisks.js"],"names":["middleAsterisks","context","jsdoc","utils","preventAtEnd","preventAtMiddleLines","options","source","some","tokens","number","delimiter","tag","name","type","description","end","test","fix","replace","reportJSDoc","line","isSingleLineBlock","delim","endAsterisks","endingAsterisksAndSpaces","match","trim","endFix","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperies","properties"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,eAAe,GAAG,WAAxB;;eAEe,2BAAa,CAAC;AAC3BC,EAAAA,OAD2B;AAE3BC,EAAAA,KAF2B;AAG3BC,EAAAA;AAH2B,CAAD,KAItB;AACJ,QAAM;AACJC,IAAAA,YAAY,GAAG,IADX;AAEJC,IAAAA,oBAAoB,GAAG;AAFnB,MAGFJ,OAAO,CAACK,OAAR,CAAgB,CAAhB,KAAsB,EAH1B;AAKAJ,EAAAA,KAAK,CAACK,MAAN,CAAaC,IAAb,CAAkB,CAAC;AAACC,IAAAA,MAAD;AAASC,IAAAA;AAAT,GAAD,KAAsB;AACtC,UAAM;AACJC,MAAAA,SADI;AACOC,MAAAA,GADP;AACYC,MAAAA,IADZ;AACkBC,MAAAA,IADlB;AACwBC,MAAAA,WADxB;AACqCC,MAAAA;AADrC,QAEFP,MAFJ;;AAGA,QACEJ,oBAAoB,IACpB,CAACW,GADD,IACQ,CAACJ,GADT,IACgB,CAACE,IADjB,IACyB,CAACD,IAD1B,IACkCb,eAAe,CAACiB,IAAhB,CAAqBF,WAArB,CAFpC,EAGE;AACA,YAAMG,GAAG,GAAG,MAAM;AAChBT,QAAAA,MAAM,CAACM,WAAP,GAAqBA,WAAW,CAACI,OAAZ,CAAoBnB,eAApB,EAAqC,EAArC,CAArB;AACD,OAFD;;AAGAG,MAAAA,KAAK,CAACiB,WAAN,CACE,kDADF,EAEE;AACEC,QAAAA,IAAI,EAAEX;AADR,OAFF,EAKEQ,GALF,EAME,IANF;AASA,aAAO,IAAP;AACD;;AAED,QAAI,CAACd,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ADJ;AAIVT,QAAAA,oBAAoB,EAAE;AACpBS,UAAAA,IAAI,EAAE;AADc;AAJZ,OAFd;AAUEA,MAAAA,IAAI,EAAE;AAVR,KADM,CANJ;AAoBJA,IAAAA,IAAI,EAAE;AApBF;AAFL,CAxEY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst middleAsterisks = /^[* \\t]+/u;\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n preventAtEnd = true,\n preventAtMiddleLines = true,\n } = context.options[0] || {};\n\n jsdoc.source.some(({tokens, number}) => {\n const {\n delimiter, tag, name, type, description, end,\n } = tokens;\n if (\n preventAtMiddleLines &&\n !end && !tag && !type && !name && middleAsterisks.test(description)\n ) {\n const fix = () => {\n tokens.description = description.replace(middleAsterisks, '');\n };\n utils.reportJSDoc(\n 'Should be no multiple asterisks on middle lines.',\n {\n line: number,\n },\n fix,\n true,\n );\n\n return true;\n }\n\n if (!preventAtEnd || !end) {\n return false;\n }\n\n const isSingleLineBlock = delimiter === '/**';\n const delim = isSingleLineBlock ? '*' : delimiter;\n const endAsterisks = isSingleLineBlock ?\n /\\*((?:\\*|(?: |\\t))*)\\*$/u :\n /((?:\\*|(?: |\\t))*)\\*$/u;\n\n const endingAsterisksAndSpaces = (description + delim).match(\n endAsterisks,\n );\n\n if (\n !endingAsterisksAndSpaces ||\n !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()\n ) {\n return false;\n }\n\n const endFix = () => {\n if (!isSingleLineBlock) {\n tokens.delimiter = '';\n }\n tokens.description = (description + delim).replace(endAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on end lines.',\n {\n line: number,\n },\n endFix,\n true,\n );\n\n return true;\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: '',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-multi-asterisks',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperies: false,\n properties: {\n preventAtEnd: {\n type: 'boolean',\n },\n preventAtMiddleLines: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"noMultiAsterisks.js"}
|