eslint-plugin-comment-length
Version:
An ESLint plugin that provides rules that limit the line length of your comments
26 lines (23 loc) • 584 B
JavaScript
import { Linter } from '@typescript-eslint/utils/ts-eslint';
function isCodeInComment(value, context) {
if (!value || !context.ignoreCommentsWithCode) {
return false;
}
const linter = new 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;
}
export { isCodeInComment };
//# sourceMappingURL=is-code-in-comment.js.map