UNPKG

auto-config-loader

Version:

Find and load configuration from a package.json property, rc file, or CommonJS module.

8 lines (6 loc) 273 B
import type { AST } from 'jsonc-eslint-parser'; import { parseJSON, getStaticJSONValue } from 'jsonc-eslint-parser'; export function jsonLoader<T>(_: string, content: string): T { const ast: AST.JSONProgram = parseJSON(content); return getStaticJSONValue(ast) as T; }