Skip to content

Policy

Defined in: policy.ts:319

Abstract base class for creating policies with object-based construction.

This class accepts a PolicyShape object in its constructor, making it easier to add new optional properties in the future without breaking changes.

C = void

new Policy<C>(definition): Policy<C>

Defined in: policy.ts:341

Creates a policy from its definition.

PolicyShape<C>

File matching, handler, and optional defaults and resolver.

Policy<C>

readonly optional defaultConfig?: C

Defined in: policy.ts:329

Configuration used when no instance configuration is supplied.

PolicyShape.defaultConfig


readonly description: string

Defined in: policy.ts:323

Description of the policy’s purpose.

PolicyShape.description


readonly handler: PolicyHandler<C>

Defined in: policy.ts:327

Checks each matching file and optionally applies fixes.

PolicyShape.handler


readonly match: RegExp

Defined in: policy.ts:325

Regular expression matched against repo-relative file paths.

PolicyShape.match


readonly name: string

Defined in: policy.ts:321

Policy name used for display and configuration.

PolicyShape.name


readonly optional resolver?: PolicyResolver<C> | PolicyStandaloneResolver<C>

Defined in: policy.ts:331

Optional standalone fixer called for violations not handled by the handler.

PolicyShape.resolver