eslint-plugin-comment-length
Version:
An ESLint plugin that provides rules that limit the line length of your comments
1 lines • 1.34 kB
Source Map (JSON)
{"version":3,"file":"util.merge-comments.cjs","sources":["../../../../src/rules/limit-single-line-comments/util.merge-comments.ts"],"sourcesContent":["import type { TSESTree } from \"@typescript-eslint/utils\";\n\nimport { deepCloneValue } from \"../../utils/immutable-deep-merge.js\";\n\nexport function mergeComments(\n a: TSESTree.LineComment,\n b: TSESTree.LineComment,\n separator = \" \",\n): TSESTree.LineComment {\n const newComment = deepCloneValue(a);\n\n newComment.value = `${a.value.trim()}${separator}${b.value.trim()}`;\n\n if (newComment.loc && b.loc) {\n newComment.loc.end = b.loc.end;\n }\n\n if (newComment.range && b.range) {\n newComment.range[1] = b.range[1];\n }\n\n return newComment;\n}\n"],"names":["deepCloneValue"],"mappings":";;;;AAIO,SAAS,aACd,CAAA,CAAA,EACA,CACA,EAAA,SAAA,GAAY,GACU,EAAA;AACtB,EAAM,MAAA,UAAA,GAAaA,kCAAe,CAAC,CAAA,CAAA;AAEnC,EAAA,UAAA,CAAW,KAAQ,GAAA,CAAA,EAAG,CAAE,CAAA,KAAA,CAAM,IAAK,EAAC,CAAG,EAAA,SAAS,CAAG,EAAA,CAAA,CAAE,KAAM,CAAA,IAAA,EAAM,CAAA,CAAA,CAAA;AAEjE,EAAI,IAAA,UAAA,CAAW,GAAO,IAAA,CAAA,CAAE,GAAK,EAAA;AAC3B,IAAW,UAAA,CAAA,GAAA,CAAI,GAAM,GAAA,CAAA,CAAE,GAAI,CAAA,GAAA,CAAA;AAAA,GAC7B;AAEA,EAAI,IAAA,UAAA,CAAW,KAAS,IAAA,CAAA,CAAE,KAAO,EAAA;AAC/B,IAAA,UAAA,CAAW,KAAM,CAAA,CAAC,CAAI,GAAA,CAAA,CAAE,MAAM,CAAC,CAAA,CAAA;AAAA,GACjC;AAEA,EAAO,OAAA,UAAA,CAAA;AACT;;;;"}