(
files: Array<{ file: string; findings: HyperframeLintFinding[] }>,
)
| 11 | } |
| 12 | |
| 13 | function project( |
| 14 | files: Array<{ file: string; findings: HyperframeLintFinding[] }>, |
| 15 | ): ProjectLintResult { |
| 16 | const all = files.flatMap((f) => f.findings); |
| 17 | const count = (severity: HyperframeLintFinding["severity"]) => |
| 18 | all.filter((f) => f.severity === severity).length; |
| 19 | return { |
| 20 | results: files.map(({ file, findings }) => ({ |
| 21 | file, |
| 22 | result: { |
| 23 | ok: findings.every((f) => f.severity !== "error"), |
| 24 | errorCount: findings.filter((f) => f.severity === "error").length, |
| 25 | warningCount: findings.filter((f) => f.severity === "warning").length, |
| 26 | infoCount: findings.filter((f) => f.severity === "info").length, |
| 27 | findings, |
| 28 | }, |
| 29 | })), |
| 30 | totalErrors: count("error"), |
| 31 | totalWarnings: count("warning"), |
| 32 | totalInfos: count("info"), |
| 33 | }; |
| 34 | } |
| 35 | |
| 36 | describe("formatLintFindings", () => { |
| 37 | it("returns no lines when no file has findings", () => { |
no test coverage detected