"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const eslint_plugin_1 = __importDefault(require("@stylistic/eslint-plugin"));
const getStylisticLegacyConfig = (language) => {
    var _a;
    const legacyConfig = eslint_plugin_1.default.configs['disable-legacy'];
    const REACT = 'react/';
    const TYPESCRIPT = '@typescript-eslint/';
    const rules = Object.entries((_a = legacyConfig.rules) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
        if (language === 'javascript') {
            const condition = !key.startsWith(REACT) && !key.startsWith(TYPESCRIPT);
            return Object.assign(Object.assign({}, acc), (condition ? { [key]: value } : null));
        }
        if (language === 'typescript') {
            const condition = key.startsWith(TYPESCRIPT);
            return Object.assign(Object.assign({}, acc), (condition ? { [key]: value } : null));
        }
        if (language === 'react') {
            const condition = key.startsWith(REACT);
            return Object.assign(Object.assign({}, acc), (condition ? { [key]: value } : null));
        }
        return null;
    }, {});
    return rules ? Object.assign(Object.assign({}, legacyConfig), { rules }) : legacyConfig;
};
exports.default = getStylisticLegacyConfig;
