( env: NodeJS.ProcessEnv, )
| 27 | } |
| 28 | |
| 29 | export function findConfigFromEnv( |
| 30 | env: NodeJS.ProcessEnv, |
| 31 | ): FormatterConfig | null { |
| 32 | const configString = env['ESLINT_FORMATTER_CONFIG']; |
| 33 | |
| 34 | if (!configString || configString.trim() === '') { |
| 35 | return null; |
| 36 | } |
| 37 | |
| 38 | try { |
| 39 | return JSON.parse(configString ?? '{}') as FormatterConfig; |
| 40 | } catch (error) { |
| 41 | console.error( |
| 42 | 'Error parsing ESLINT_FORMATTER_CONFIG environment variable:', |
| 43 | stringifyError(error), |
| 44 | ); |
| 45 | return null; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | function formatJson(results: ESLint.LintResult[]): string { |
| 50 | return JSON.stringify(results, null, 2); |
nothing calls this directly
no test coverage detected