1 |
- {"version":3,"sources":["../../src/rules/checkIndentation.js"],"names":["maskExcludedContent","str","excludeTags","regContent","RegExp","join","replace","_match","margin","code","Array","match","length","maskCodeBlocks","sourceCode","jsdocNode","report","context","options","reg","textWithoutCodeBlocks","getText","text","test","lineBreaks","slice","lastIndex","line","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","items","pattern","type"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,mBAAmB,GAAG,CAACC,GAAD,EAAMC,WAAN,KAAsB;AAChD,QAAMC,UAAU,GAAG,IAAIC,MAAJ,CAAY,yBAAwBF,WAAW,CAACG,IAAZ,CAAiB,GAAjB,CAAsB,2DAA1D,EAAsH,IAAtH,CAAnB;AAEA,SAAOJ,GAAG,CAACK,OAAJ,CAAYH,UAAZ,EAAwB,CAACI,MAAD,EAASC,MAAT,EAAiBC,IAAjB,KAA0B;AACvD,WAAO,IAAIC,KAAJ,CAAUD,IAAI,CAACE,KAAL,CAAW,MAAX,EAAmBC,MAAnB,GAA4B,CAAtC,EAAyCP,IAAzC,CAA8CG,MAAM,GAAG,IAAvD,CAAP;AACD,GAFM,CAAP;AAGD,CAND;;AAQA,MAAMK,cAAc,GAAIZ,GAAD,IAAS;AAC9B,QAAME,UAAU,GAAG,4EAAnB;AAEA,SAAOF,GAAG,CAACK,OAAJ,CAAYH,UAAZ,EAAwB,CAACI,MAAD,EAASC,MAAT,EAAiBC,IAAjB,KAA0B;AACvD,WAAO,IAAIC,KAAJ,CAAUD,IAAI,CAACE,KAAL,CAAW,MAAX,EAAmBC,MAAnB,GAA4B,CAAtC,EAAyCP,IAAzC,CAA8CG,MAAM,GAAG,IAAvD,CAAP;AACD,GAFM,CAAP;AAGD,CAND;;eAQe,2BAAa,CAAC;AAC3BM,EAAAA,UAD2B;AAE3BC,EAAAA,SAF2B;AAG3BC,EAAAA,MAH2B;AAI3BC,EAAAA;AAJ2B,CAAD,KAKtB;AACJ,QAAMC,OAAO,GAAGD,OAAO,CAACC,O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sdoc';\n\nconst maskExcludedContent = (str, excludeTags) => {\n const regContent = new RegExp(`([ \\\\t]+\\\\*)[ \\\\t]@(?:${excludeTags.join('|')})(?=[ \\\\n])([\\\\w|\\\\W]*?\\\\n)(?=[ \\\\t]*\\\\*(?:[ \\\\t]*@|\\\\/))`, 'gu');\n\n return str.replace(regContent, (_match, margin, code) => {\n return new Array(code.match(/\\n/gu).length + 1).join(margin + '\\n');\n });\n};\n\nconst maskCodeBlocks = (str) => {\n const regContent = /([ \\t]+\\*)[ \\t]```[^\\n]*?([\\w|\\W]*?\\n)(?=[ \\t]*\\*(?:[ \\t]*(?:```|@)|\\/))/gu;\n\n return str.replace(regContent, (_match, margin, code) => {\n return new Array(code.match(/\\n/gu).length + 1).join(margin + '\\n');\n });\n};\n\nexport default iterateJsdoc(({\n sourceCode,\n jsdocNode,\n report,\n context,\n}) => {\n const options = context.options[0] || {};\n const {\n excludeTags = ['example'],\n } = options;\n\n const reg = new RegExp(/^(?:\\/?\\**|[ \\t]*)\\*[ \\t]{2}/gmu);\n const textWithoutCodeBlocks = maskCodeBlocks(sourceCode.getText(jsdocNode));\n const text = excludeTags.length ? maskExcludedContent(textWithoutCodeBlocks, excludeTags) : textWithoutCodeBlocks;\n\n if (reg.test(text)) {\n const lineBreaks = text.slice(0, reg.lastIndex).match(/\\n/gu) || [];\n report('There must be no indentation.', null, {\n line: lineBreaks.length,\n });\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports invalid padding inside JSDoc blocks.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-indentation',\n },\n schema: [{\n additionalProperties: false,\n properties: {\n excludeTags: {\n items: {\n pattern: '^\\\\S+$',\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n }],\n type: 'layout',\n },\n});\n"],"file":"checkIndentation.js"}
|