export default config; /** * Build a ready-to-use ESLint flat config array. Consumers call this function and export default the result. * * Every option is optional and defaults to an empty array, mirrored by the destructuring defaults in the signature below. The JSDoc marks them optional with the * bracket form so the emitted declaration types each property as optional, matching how consumers actually call this - passing only the subset they need. * * @param {object} [options] - Configuration options. * @param {string[]} [options.ts] - Glob patterns for TypeScript files (strict + stylistic type-checked rules). * @param {string[]} [options.js] - Glob patterns for JavaScript files (disable-type-checked rules). * @param {string[]} [options.ui] - Glob patterns for browser UI files (adds browser globals). * @param {string[]} [options.allowDefaultProject] - Globs passed to parserOptions.projectService.allowDefaultProject. * @param {string[]} [options.ignores] - Global ignore patterns (in addition to the hardcoded "dist" ignore on the common block). * @param {object[]} [options.extraConfigs] - Additional flat config objects appended to the output. * @returns {object[]} A flat config array suitable for `export default` in eslint.config.mjs. Block ordering is significant - do not reorder. */ export function config({ allowDefaultProject, extraConfigs, ignores, js, ts: tsFiles, ui }?: { ts?: string[] | undefined; js?: string[] | undefined; ui?: string[] | undefined; allowDefaultProject?: string[] | undefined; ignores?: string[] | undefined; extraConfigs?: any[] | undefined; }): object[]; /** * Rule preset applied to every linted file regardless of language. Disables the base ESLint rules that are redundant once TypeScript's own compiler * and syntax already catch the same errors, mirroring the `typescript-eslint` compatibility overlay it spreads in; the enabled ESLint-recommended * baseline itself comes from the separate `eslintJs.configs.recommended` block pushed in {@link config}. Layers on top of that the full `@hjdhjd/*` * rule set, the `@stylistic/*` whitespace and formatting rules, and the project's opinionated `sort-imports` / `sort-keys` / `quotes` / `eqeqeq` / * `curly` constraints. * * Spread into the `rules:` slot of the all-files block of a flat config. */ export const commonRules: { "@hjdhjd/blank-line-after-open-brace": string; "@hjdhjd/comment-style": string; "@hjdhjd/enforce-node-protocol": string; "@hjdhjd/paren-comparisons-in-logical": string; "@hjdhjd/split-type-imports": string; "@stylistic/array-bracket-spacing": (string | { arraysInArrays: boolean; objectsInArrays: boolean; singleValue: boolean; })[]; "@stylistic/block-spacing": string; "@stylistic/brace-style": (string | { allowSingleLine: boolean; })[]; "@stylistic/comma-dangle": string; "@stylistic/eol-last": string[]; "@stylistic/generator-star-spacing": string; "@stylistic/implicit-arrow-linebreak": string; "@stylistic/indent": (string | number | { SwitchCase: number; })[]; "@stylistic/keyword-spacing": (string | { overrides: { for: { after: boolean; }; if: { after: boolean; }; switch: { after: boolean; }; while: { after: boolean; }; }; })[]; "@stylistic/linebreak-style": string[]; "@stylistic/lines-between-class-members": (string | { exceptAfterSingleLine: boolean; })[]; "@stylistic/max-len": (string | number)[]; "@stylistic/no-tabs": string; "@stylistic/no-trailing-spaces": string; "@stylistic/operator-linebreak": (string | { overrides: { ":": string; "?": string; }; })[]; "@stylistic/padding-line-between-statements": (string | { blankLine: string; next: string[]; prev: string; } | { blankLine: string; next: string; prev: string[]; } | { blankLine: string; next: string[]; prev: string[]; } | { blankLine: string; next: string; prev: string; })[]; "@stylistic/semi": string[]; "@stylistic/space-before-function-paren": (string | { anonymous: string; asyncArrow: string; catch: string; named: string; })[]; "@stylistic/space-in-parens": string; "@stylistic/space-infix-ops": string; "@stylistic/space-unary-ops": string; "@typescript-eslint/dot-notation": (string | { allowIndexSignaturePropertyAccess: boolean; })[]; "@typescript-eslint/no-this-alias": string; camelcase: string; curly: string[]; "dot-notation": string; eqeqeq: string; "logical-assignment-operators": (string | { enforceForIfStatements: boolean; })[]; "no-await-in-loop": string; "no-console": string; "no-restricted-syntax": string[]; "prefer-arrow-callback": string; "prefer-const": string; quotes: (string | { allowTemplateLiterals: boolean; avoidEscape: boolean; })[]; "sort-imports": string; "sort-keys": string; "sort-vars": string; }; /** * Browser-environment globals typically present in Homebridge webUI files - `window`, `document`, `fetch`, the Homebridge configuration API entry * point, and a few timer functions. Each is declared as `"readonly"` so `no-undef` accepts references without permitting reassignment. * * Pass into the `languageOptions.globals` slot of a flat config block scoped to UI files. */ export const globalsUi: { [k: string]: string; }; /** * Rule preset for JavaScript source files. Starts from `typescript-eslint`'s `disableTypeChecked` set (so type-aware rules don't fire on plain JS), then * re-enables `no-unused-vars` with the underscore-prefix ignore pattern. The `require-await` rule is left disabled here for the same reason the TypeScript * preset omits its pair - see the omission paragraph in the {@link tsRules} JSDoc. * * Spread into the `rules:` slot of a flat config block scoped to `.js` / `.mjs` files. */ export const jsRules: { "@typescript-eslint/no-floating-promises": string; "no-unused-vars": (string | { argsIgnorePattern: string; caughtErrors: string; caughtErrorsIgnorePattern: string; varsIgnorePattern: string; })[]; }; /** * The ESLint plugin namespace map used by the composed configuration: `@hjdhjd` (this package's rules), `@stylistic` (the official stylistic-rules * plugin), and `@typescript-eslint`. Drop this object into the `plugins` slot of a flat config block to register every plugin namespace this preset * composes at once. * * The type annotation is deliberately loose since consumers that read the named `plugins` export do their own narrowing before touching rule entries. * It's annotated explicitly so the emitted type stays portable - the raw inference picks up typescript-eslint's exported `CompatiblePlugin` shape, * and the `tsconfig.eslint-plugin.json` declaration-only build (TS2742) refuses to serialize it into the `.d.ts` without citing a deep module path. * * @type {Record }>} */ export const plugins: Record; }>; /** * Rule preset for TypeScript source files. Builds on `typescript-eslint`'s strict and stylistic type-checked configs, then layers project-specific * overrides: type-aware lint rules (`await-thenable`, `no-floating-promises`, `prefer-nullish-coalescing`, etc.) at warn level, explicit return-type and * module-boundary requirements, and `@stylistic/member-delimiter-style`. Disables the JavaScript-recommended versions of rules that have TypeScript-aware * equivalents to avoid double-flagging. * * Deliberately omits `@typescript-eslint/promise-function-async` and forces `@typescript-eslint/require-await` (and the base `require-await`) off. The pair * encodes a tight coupling between Promise return types and the `async` keyword that predates the Disposable protocol: `[Symbol.asyncDispose]()` must be declared * `async ...(): Promise` to satisfy `await using` even when the body is synchronous, and identity-preserving Promise pass-throughs (e.g., `markHandled` in * `src/util.ts`) cannot be marked `async` without wrapping the return in a fresh chain and breaking reference equality. Encoding the stance at the preset level * rather than scattering per-site `eslint-disable` directives is the SSOT. * * Spread into the `rules:` slot of a flat config block scoped to `.ts` files. */ export const tsRules: any;