UNPKG

eslint-plugin-comment-length

Version:

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

28 lines (24 loc) 625 B
'use strict'; var tsEslint = require('@typescript-eslint/utils/ts-eslint'); function isCodeInComment(value, context) { if (!value || !context.ignoreCommentsWithCode) { return false; } const linter = new tsEslint.Linter({ configType: "flat" }); const output = linter.verify(value, [ { languageOptions: { ecmaVersion: "latest", sourceType: "module" } } ]); for (const msg of output) { if (msg.message.includes("Parsing error")) { return false; } } return true; } exports.isCodeInComment = isCodeInComment; //# sourceMappingURL=is-code-in-comment.cjs.map