/* cSpell:disable */ // This file is auto-generated by `pnpm run gen:rule-types` // (`scripts/cmd/gen-rule-types.mts`). Do not edit it manually. import type { TSESLint } from '@typescript-eslint/utils'; import type { Linter } from 'eslint'; import { expectType } from 'ts-data-forge'; import type { tsFortressRules } from './rules/index.mjs'; /** * Extracts the options tuple type of a rule from its TypeScript implementation, * so that option types stay in sync with the rule source without converting * `meta.schema` (JSON Schema) back into TypeScript types. */ type RuleOptionsOf = (typeof tsFortressRules)[Name] extends TSESLint.RuleModule< infer _MessageIds extends string, infer Options extends readonly unknown[] > ? Options : never; /** * @description Report a ts-fortress codec `X` paired with `type Y = t.TypeOf` whose value nothing reads, so that `Y` is declared as a plain type instead. * * ```md * | key | value | * | :--------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | false | * ``` * * @internal Reached by indexing the rules record by the rule's name. */ namespace NoTypeOnlyCodec { /** * ### schema * * ```json * [ * { * "type": "object", * "properties": { * "entryPoints": { * "type": "array", * "items": { * "type": "string" * }, * "uniqueItems": true, * "description": "Files whose exports are public API. A codec they export, directly or through re-exports, is never reported. Replaces the entry points read from the nearest package.json, for a layout they cannot be traced back to source from. Relative paths are resolved against the working directory ESLint runs in; pass absolute paths to make the config independent of it." * } * }, * "additionalProperties": false * } * ] * ``` */ export type Options = NonNullable[0]>; export type RuleEntry = 'off' | Linter.Severity | readonly [Linter.StringSeverity, Options]; } /** * @description Normalize a length-constrained ts-fortress array combinator whose bounds are degenerate (e.g. `minLengthArray(1, x)`, `boundedLengthTuple(n, n, x)`) to the combinator that names that constraint directly. * * ```md * | key | value | * | :--------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * ``` * * @internal Reached by indexing the rules record by the rule's name. */ namespace PreferCanonicalLengthConstrainedType { export type RuleEntry = Linter.StringSeverity; } /** * @description Require `ts-fortress` to be imported as a namespace (`import * as t from 'ts-fortress';` or `import type * as t from 'ts-fortress';`) rather than through named, default or bare side-effect imports. * * ```md * | key | value | * | :--------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * ``` * * @internal Reached by indexing the rules record by the rule's name. */ namespace PreferNamespaceImport { /** * ### schema * * ```json * [ * { * "type": "object", * "properties": { * "namespaceName": { * "type": "string", * "pattern": "^[$A-Z_a-z][$\\w]*$", * "description": "Local name the autofix gives the namespace import when the file has none to merge into. Defaults to 't'. A namespace import already in the file is reused under its own name, whatever this is set to." * } * }, * "additionalProperties": false * } * ] * ``` */ export type Options = NonNullable< RuleOptionsOf<'prefer-namespace-import'>[0] >; export type RuleEntry = 'off' | Linter.Severity | readonly [Linter.StringSeverity, Options]; } /** * @description Report a chain of hand-written type guards narrowing one value, once it is long enough to be a schema, and point at `ts-fortress` * * ```md * | key | value | * | :--------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | false | * ``` * * @internal Reached by indexing the rules record by the rule's name. */ namespace PreferSchemaOverGuardChain { /** * ### schema * * ```json * [ * { * "type": "object", * "properties": { * "threshold": { * "type": "integer", * "minimum": 2, * "description": "How many guards on one value a single chain may contain before it is reported. Defaults to 5." * }, * "guards": { * "type": "array", * "items": { * "type": "string" * }, * "description": "Names of the guard functions to count, replacing the default list. A member call is matched on its property name, so `Arr.isArray` is named `isArray`." * } * }, * "additionalProperties": false * } * ] * ``` */ export type Options = NonNullable< RuleOptionsOf<'prefer-schema-over-guard-chain'>[0] >; export type RuleEntry = 'off' | Linter.Severity | readonly [Linter.StringSeverity, Options]; } export type EslintTsFortressRules = Readonly<{ 'ts-fortress/no-type-only-codec': NoTypeOnlyCodec.RuleEntry; 'ts-fortress/prefer-canonical-length-constrained-type': PreferCanonicalLengthConstrainedType.RuleEntry; 'ts-fortress/prefer-namespace-import': PreferNamespaceImport.RuleEntry; 'ts-fortress/prefer-schema-over-guard-chain': PreferSchemaOverGuardChain.RuleEntry; }>; export type EslintTsFortressRulesOption = Readonly<{ 'ts-fortress/no-type-only-codec': NoTypeOnlyCodec.Options; 'ts-fortress/prefer-namespace-import': PreferNamespaceImport.Options; 'ts-fortress/prefer-schema-over-guard-chain': PreferSchemaOverGuardChain.Options; }>; // If this assertion fails to type-check, this generated file has drifted from // the actual plugin rules — re-run `pnpm run gen:rule-types`. expectType< keyof EslintTsFortressRules, `ts-fortress/${keyof typeof tsFortressRules}` >('=');