MCPcopy Create free account
hub / github.com/code-pushup/cli / findConfigFromEnv

Function findConfigFromEnv

tools/eslint-formatter-multi/src/lib/utils.ts:29–47  ·  view source on GitHub ↗
(
  env: NodeJS.ProcessEnv,
)

Source from the content-addressed store, hash-verified

27}
28
29export 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
49function formatJson(results: ESLint.LintResult[]): string {
50 return JSON.stringify(results, null, 2);

Callers

nothing calls this directly

Calls 2

errorMethod · 0.80
stringifyErrorFunction · 0.70

Tested by

no test coverage detected