import type { Config } from 'eslint/config'; import { prettierPluginConfigs } from '../plugins/index.js'; type WithPrettierConfigs> = { [K in keyof T]: Config[]; } & { [K in keyof T as `${K & string}-with-prettier`]: Config[]; }; export const addPrettierConfigs = >( configs: T, ): WithPrettierConfigs => Object.entries(configs).reduce( (acc, [name, config]) => ({ ...acc, [name]: config, [`${name}-with-prettier`]: [...config, ...prettierPluginConfigs], }), {} as WithPrettierConfigs, );