]> git.proxmox.com Git - pve-eslint.git/blob - eslint/tools/internal-rules/multiline-comment-style.js
b0a0c9d854f934be21c1085b5d129fb852d8b82f
[pve-eslint.git] / eslint / tools / internal-rules / multiline-comment-style.js
1 /**
2 * @fileoverview A modified version of the `multiline-comment-style` rule that ignores banner comments.
3 * @author Teddy Katz
4 */
5
6 "use strict";
7
8 const ruleComposer = require("eslint-rule-composer");
9 const multilineCommentStyle = require("../../lib/rules/multiline-comment-style");
10
11 //------------------------------------------------------------------------------
12 // Rule Definition
13 //------------------------------------------------------------------------------
14
15 // The `no-invalid-meta` internal rule has a false positive here.
16 // eslint-disable-next-line internal-rules/no-invalid-meta
17 module.exports = ruleComposer.filterReports(
18 multilineCommentStyle,
19 (problem, metadata) => {
20 const problemIndex = metadata.sourceCode.getIndexFromLoc(problem.loc.start);
21 const reportedToken = metadata.sourceCode.getTokenByRangeStart(problemIndex, { includeComments: true });
22
23 return !(reportedToken && reportedToken.type === "Line" && /^-{2,}$/u.test(reportedToken.value));
24 }
25 );