UNPKG

@fenge/eslint-config

Version:

A super strict eslint config for linting js/ts/package.json.

40 lines 1.69 kB
import type { Linter } from "eslint"; import { type BaseOptions } from "./config/base.ts"; import { javascript } from "./config/javascript.ts"; import { packagejson } from "./config/packagejson.ts"; import { typescript } from "./config/typescript.ts"; type NoDuplicate<A extends unknown[]> = { [I in keyof A]: true extends { [J in keyof A]: J extends I ? false : A[J] extends A[I] ? true : false; }[number] ? never : A[I]; }; type JsRuleKey = keyof ReturnType<typeof javascript>[0]["rules"]; type TsRuleKey = keyof ReturnType<typeof typescript>[0]["rules"]; type PkgRuleKey = keyof ReturnType<typeof packagejson>[0]["rules"]; type RuleValue = "error" | "warn" | "off" | ["error" | "warn", ...unknown[]]; interface Options<T extends string[]> { pick?: NoDuplicate<T>; omit?: NoDuplicate<T>; } interface ConfigItem { name?: string; files: string[]; plugins?: Record<string, object>; rules: Partial<Record<PkgRuleKey | JsRuleKey | TsRuleKey, RuleValue>> | Record<string, RuleValue>; } export type BuilderOptions = BaseOptions; export declare class Builder { private readonly configs; private readonly options; private readonly enabled; constructor(options?: BuilderOptions); toConfig(): Linter.Config<Linter.RulesRecord>[]; private setup; enableTypeScript<T extends TsRuleKey[]>(options?: Options<T>): this; enableJavaScript<T extends JsRuleKey[]>(options?: Options<T>): this; enablePackageJson<T extends PkgRuleKey[]>(options?: Options<T>): this; append(config: ConfigItem): this; } declare const _default: Linter.Config<Linter.RulesRecord>[]; export default _default; //# sourceMappingURL=eslint.config.d.ts.map