This commit is contained in:
Alex
2024-08-03 23:20:11 -04:00
parent 92e6e5081b
commit f3fbf99c0c
22 changed files with 704 additions and 232 deletions

22
dist/index.d.ts vendored
View File

@ -5,6 +5,17 @@ import { ESLintUtils } from '@typescript-eslint/utils';
import { Rule } from 'eslint';
import { Merge, SetRequired } from 'type-fest';
export type OptionalObjectKey<T> = Exclude<{
[Key in keyof T]: undefined | any[] extends T[Key] ? Key : undefined | Record<any, any> extends T[Key] ? Key : never;
}[keyof T], undefined>;
export type MiddlewareConfig = Merge<SetRequired<ESLintConfig, OptionalObjectKey<ESLintConfig>>, {
extends: KnownExtends[];
}>;
export interface MiddlewareFunctions {
addRules(rules: Partial<RuleOptions>): void;
addSettings(settings: Partial<Settings>): void;
}
export type Middleware = (config: MiddlewareConfig, helpers: MiddlewareFunctions) => void;
export declare const error = "error";
export declare const warn = "warn";
export declare const off = "off";
@ -39,7 +50,6 @@ export interface CustomRule {
}>;
options?: RuleLevel;
}
export type Middleware = (config: MiddlewareConfig, helpers: MiddlewareFunctions) => void;
/**
* ESLint Configuration.
* @see [ESLint Configuration](https://eslint.org/docs/latest/user-guide/configuring/)
@ -62,16 +72,6 @@ export type InputConfig = Omit<ESLintConfig, "rules"> & {
*/
auto?: boolean;
};
export type OptionalObjectKey<T> = Exclude<{
[Key in keyof T]: undefined | any[] extends T[Key] ? Key : undefined | Record<any, any> extends T[Key] ? Key : never;
}[keyof T], undefined>;
export type MiddlewareConfig = Merge<SetRequired<ESLintConfig, OptionalObjectKey<ESLintConfig>>, {
extends: KnownExtends[];
}>;
export interface MiddlewareFunctions {
addRules(rules: Partial<RuleOptions>): void;
addSettings(settings: Partial<Settings>): void;
}
/**
* Returns a ESLint config object.
*