UNPKG

eslint-plugin-comment-length

Version:

An ESLint plugin that provides rules that limit the line length of your comments

1 lines 1.58 kB
{"version":3,"file":"detect.overflow.cjs","sources":["../../../../src/rules/limit-multi-line-comments/detect.overflow.ts"],"sourcesContent":["import type { RuleContext } from \"@typescript-eslint/utils/ts-eslint\";\n\nimport type { Context } from \"../../typings.context.js\";\nimport { isLineOverflowing } from \"../../utils/is-line-overflowing.js\";\n\nimport type { MultilineBlock } from \"./typings.block.js\";\n\nexport function detectOverflowInMultilineBlocks(\n _ruleContext: RuleContext<string, unknown[]>,\n context: Context,\n blocks: MultilineBlock[],\n) {\n const problematicBlocks = [] as MultilineBlock[];\n\n // ... and then we can go through each block to determine if it violates\n // our rule to mark it as fixable using logic similar to the single-line\n // rule.\n for (const block of blocks) {\n for (let i = 0; i < block.lines.length; i++) {\n const line = block.lines[i];\n\n if (line && isLineOverflowing(line, context)) {\n problematicBlocks.push(block);\n break;\n }\n }\n }\n\n return problematicBlocks;\n}\n"],"names":["isLineOverflowing"],"mappings":";;;;AAOgB,SAAA,+BAAA,CACd,YACA,EAAA,OAAA,EACA,MACA,EAAA;AACA,EAAA,MAAM,oBAAoB,EAAC,CAAA;AAK3B,EAAA,KAAA,MAAW,SAAS,MAAQ,EAAA;AAC1B,IAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,KAAM,CAAA,KAAA,CAAM,QAAQ,CAAK,EAAA,EAAA;AAC3C,MAAM,MAAA,IAAA,GAAO,KAAM,CAAA,KAAA,CAAM,CAAC,CAAA,CAAA;AAE1B,MAAA,IAAI,IAAQ,IAAAA,mCAAA,CAAkB,IAAM,EAAA,OAAO,CAAG,EAAA;AAC5C,QAAA,iBAAA,CAAkB,KAAK,KAAK,CAAA,CAAA;AAC5B,QAAA,MAAA;AAAA,OACF;AAAA,KACF;AAAA,GACF;AAEA,EAAO,OAAA,iBAAA,CAAA;AACT;;;;"}