UNPKG

eslint-plugin-comment-length

Version:

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

1 lines 2.07 kB
{"version":3,"file":"rule.cjs","sources":["../../../../src/rules/limit-single-line-comments/rule.ts"],"sourcesContent":["import { type TSESTree, ESLintUtils } from \"@typescript-eslint/utils\";\n\nimport { MessageIds, reportMessages } from \"../../const.message-ids.js\";\nimport {\n type RuleOptions,\n defaultOptions,\n optionsSchema,\n} from \"../../typings.options.js\";\nimport { resolveDocsRoute } from \"../../utils/resolve-docs-route.js\";\n\nimport { limitSingleLineComments } from \"./root.js\";\n\nconst createRule = ESLintUtils.RuleCreator(resolveDocsRoute);\n\nexport const limitSingleLineCommentsRule = createRule<RuleOptions, MessageIds>({\n name: \"limit-single-line-comments\",\n defaultOptions,\n meta: {\n type: \"layout\",\n fixable: \"whitespace\",\n messages: reportMessages,\n docs: {\n description:\n \"Reflows single-line comments to ensure that blocks never exceed the configured length\",\n },\n schema: optionsSchema,\n },\n create: (ruleContext, [options]) => {\n const sourceCode = ruleContext.sourceCode;\n const comments = sourceCode\n .getAllComments()\n .filter((it): it is TSESTree.LineComment => it.type === \"Line\");\n\n limitSingleLineComments(ruleContext, options, comments);\n\n return {};\n },\n});\n"],"names":["ESLintUtils","resolveDocsRoute","defaultOptions","reportMessages","optionsSchema","limitSingleLineComments"],"mappings":";;;;;;;;AAYA,MAAM,UAAA,GAAaA,iBAAY,CAAA,WAAA,CAAYC,iCAAgB,CAAA,CAAA;AAEpD,MAAM,8BAA8B,UAAoC,CAAA;AAAA,EAC7E,IAAM,EAAA,4BAAA;AAAA,kBACNC,8BAAA;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,QAAA;AAAA,IACN,OAAS,EAAA,YAAA;AAAA,IACT,QAAU,EAAAC,+BAAA;AAAA,IACV,IAAM,EAAA;AAAA,MACJ,WACE,EAAA,uFAAA;AAAA,KACJ;AAAA,IACA,MAAQ,EAAAC,6BAAA;AAAA,GACV;AAAA,EACA,MAAQ,EAAA,CAAC,WAAa,EAAA,CAAC,OAAO,CAAM,KAAA;AAClC,IAAA,MAAM,aAAa,WAAY,CAAA,UAAA,CAAA;AAC/B,IAAM,MAAA,QAAA,GAAW,WACd,cAAe,EAAA,CACf,OAAO,CAAC,EAAA,KAAmC,EAAG,CAAA,IAAA,KAAS,MAAM,CAAA,CAAA;AAEhE,IAAwBC,4BAAA,CAAA,WAAA,EAAa,SAAS,QAAQ,CAAA,CAAA;AAEtD,IAAA,OAAO,EAAC,CAAA;AAAA,GACV;AACF,CAAC;;;;"}