import * as eslint from 'eslint';
import { PlainObject } from '@morev/utils';

/**
 * Options of the factory that creates a `disableAutofix` wrapper.
 */
type CreateDisableAutofixOptions = {
    /**
     * Prefix used to disable autofix for rules.
     *
     * @default 'no-autofix'
     */
    prefix: string;
};

/**
 * Creates a wrapper function that will disable autofix
 * for config rules that have the specified prefix.
 *
 * @example
 * // eslint.config.js
 * const disableAutofix = createDisableAutofix({ prefix: 'disable-autofix' });
 *
 * export default disableAutofix([
 *   {
 *     plugins: {
 *       'some-plugin': someEslintPlugin,
 *     },
 *     rules: {
 *       'disable-autofix/no-var': 'error',
 *       'disable-autofix/some-plugin/some-rule': 'error',
 *     },
 *   },
 * ]);
 *
 * @param   options   Options of the factory.
 *
 * @returns           Wrapper function that will disable autofix for config rules.
 */
declare const createDisableAutofix: (options?: Partial<CreateDisableAutofixOptions>) => (configurations: PlainObject[]) => eslint.Linter.Config<eslint.Linter.RulesRecord>[];
/**
 * Wrapper function that will disable autofix
 * for config rules that have `no-autofix/` prefix.
 *
 * @example
 * // eslint.config.js
 * export default disableAutofix([
 *   {
 *     plugins: {
 *       'some-plugin': someEslintPlugin,
 *     },
 *     rules: {
 *       'no-autofix/no-var': 'error',
 *       'no-autofix/some-plugin/some-rule': 'error',
 *     },
 *   },
 * ]);
 *
 * @returns
 *    Configurations as passed, in which rules with the `no-autofix/` prefix
 *    are replaced with the same rules without the prefix,
 *    and the original rules are patched so that `autofix` is not performed.
 */
declare const disableAutofix: (configurations: PlainObject[]) => eslint.Linter.Config<eslint.Linter.RulesRecord>[];

export { createDisableAutofix, disableAutofix };
