(error: unknown)
| 5 | import type { FormatterConfig } from './types.js'; |
| 6 | |
| 7 | export function stringifyError(error: unknown): string { |
| 8 | if (error instanceof Error) { |
| 9 | if (error.name === 'Error' || error.message.startsWith(error.name)) { |
| 10 | return error.message; |
| 11 | } |
| 12 | return `${error.name}: ${error.message}`; |
| 13 | } |
| 14 | if (typeof error === 'string') { |
| 15 | return error; |
| 16 | } |
| 17 | return JSON.stringify(error); |
| 18 | } |
| 19 | |
| 20 | export function getExtensionForFormat(format: EslintFormat): string { |
| 21 | const extensionMap: Record<string, string> = { |
no outgoing calls
no test coverage detected