@commitlint/format
Advanced tools
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { FormattableReport, FormatOptions, FormattableResult } from '@commitlint/types'; | ||
| import { FormattableReport, FormatOptions, FormattableResult } from "@commitlint/types"; | ||
| export declare function format(report?: FormattableReport, options?: FormatOptions): string; | ||
@@ -3,0 +3,0 @@ export declare function formatResult(result?: FormattableResult, options?: FormatOptions): string[]; |
+17
-17
@@ -1,4 +0,4 @@ | ||
| import chalk from 'chalk'; | ||
| const DEFAULT_SIGNS = [' ', '⚠', '✖']; | ||
| const DEFAULT_COLORS = ['white', 'yellow', 'red']; | ||
| import chalk from "chalk"; | ||
| const DEFAULT_SIGNS = [" ", "⚠", "✖"]; | ||
| const DEFAULT_COLORS = ["white", "yellow", "red"]; | ||
| export function format(report = {}, options = {}) { | ||
@@ -12,11 +12,11 @@ const { results = [] } = report; | ||
| .reduce((acc, item) => (Array.isArray(item) ? [...acc, ...item] : [...acc, item]), []) | ||
| .join('\n'); | ||
| .join("\n"); | ||
| } | ||
| function formatInput(result, options = {}) { | ||
| const { color: enabled = true } = options; | ||
| const { errors = [], warnings = [], input = '' } = result; | ||
| const { errors = [], warnings = [], input = "" } = result; | ||
| if (!input) { | ||
| return ['']; | ||
| return [""]; | ||
| } | ||
| const sign = '⧗'; | ||
| const sign = "⧗"; | ||
| const decoration = enabled ? chalk.gray(sign) : sign; | ||
@@ -33,4 +33,4 @@ const decoratedInput = enabled ? chalk.bold(input) : input; | ||
| const problems = [...errors, ...warnings].map((problem) => { | ||
| const sign = signs[problem.level] || ''; | ||
| const color = colors[problem.level] || 'white'; | ||
| const sign = signs[problem.level] || ""; | ||
| const color = colors[problem.level] || "white"; | ||
| const decoration = enabled ? chalk[color](sign) : sign; | ||
@@ -51,3 +51,3 @@ const name = enabled | ||
| : undefined; | ||
| const fmtSummary = enabled && typeof summary === 'string' ? chalk.bold(summary) : summary; | ||
| const fmtSummary = enabled && typeof summary === "string" ? chalk.bold(summary) : summary; | ||
| const help = hasProblems && options.helpUrl | ||
@@ -58,7 +58,7 @@ ? `ⓘ Get help: ${options.helpUrl}` | ||
| ...problems, | ||
| hasProblems ? '' : undefined, | ||
| hasProblems ? "" : undefined, | ||
| fmtSummary, | ||
| help, | ||
| hasProblems ? '' : undefined, | ||
| ].filter((line) => typeof line === 'string'); | ||
| hasProblems ? "" : undefined, | ||
| ].filter((line) => typeof line === "string"); | ||
| } | ||
@@ -68,12 +68,12 @@ export default format; | ||
| if ((result.errors || []).length > 0) { | ||
| return '✖'; | ||
| return "✖"; | ||
| } | ||
| return (result.warnings || []).length ? '⚠' : '✔'; | ||
| return (result.warnings || []).length ? "⚠" : "✔"; | ||
| } | ||
| function selectColor(result) { | ||
| if ((result.errors || []).length > 0) { | ||
| return 'red'; | ||
| return "red"; | ||
| } | ||
| return (result.warnings || []).length ? 'yellow' : 'green'; | ||
| return (result.warnings || []).length ? "yellow" : "green"; | ||
| } | ||
| //# sourceMappingURL=format.js.map |
+2
-2
@@ -1,3 +0,3 @@ | ||
| export { default } from './format.js'; | ||
| export * from './format.js'; | ||
| export { default } from "./format.js"; | ||
| export * from "./format.js"; | ||
| //# sourceMappingURL=index.d.ts.map |
+2
-2
@@ -1,3 +0,3 @@ | ||
| export { default } from './format.js'; | ||
| export * from './format.js'; | ||
| export { default } from "./format.js"; | ||
| export * from "./format.js"; | ||
| //# sourceMappingURL=index.js.map |
+4
-4
| { | ||
| "name": "@commitlint/format", | ||
| "type": "module", | ||
| "version": "19.8.0", | ||
| "version": "19.8.1", | ||
| "description": "Format commitlint reports", | ||
@@ -39,9 +39,9 @@ "main": "lib/index.js", | ||
| "devDependencies": { | ||
| "@commitlint/utils": "^19.8.0" | ||
| "@commitlint/utils": "^19.8.1" | ||
| }, | ||
| "dependencies": { | ||
| "@commitlint/types": "^19.8.0", | ||
| "@commitlint/types": "^19.8.1", | ||
| "chalk": "^5.3.0" | ||
| }, | ||
| "gitHead": "e82f05a737626bb69979d14564f5ff601997f679" | ||
| "gitHead": "3c302008cabeb0b08cd246b2417a51a9d745a918" | ||
| } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Updated