Skip to content

ConfiguredFilePolicy

Defined in: policy.ts:366

A policy instance with configuration and exclusion settings applied.

C = void

Type of configuration object used by the policy

optional config?: C

Defined in: policy.ts:377

The configuration applied to this policy instance.


optional defaultConfig?: C

Defined in: policy.ts:307

A default configuration that will be used if none is provided.

PolicyShape.defaultConfig


description: string

Defined in: policy.ts:285

A detailed description of the policy and its purpose.

PolicyShape.description


optional exclude?: (string | RegExp)[]

Defined in: policy.ts:384

File paths matching these patterns will be excluded from this policy. Strings are case-insensitive regular expressions; RegExp values retain their flags. Paths are relative to the repository root.


optional excludeFiles?: (string | RegExp)[]

Defined in: policy.ts:390

File paths matching these patterns will be excluded from this policy. Legacy alias for exclude.


handler: PolicyHandler<C>

Defined in: policy.ts:295

The handler function that checks if a file complies with the policy.

PolicyShape.handler


optional instanceId?: string

Defined in: policy.ts:372

An optional stable identifier for this configured policy instance.

This is required when the same policy definition is configured more than once.


match: RegExp

Defined in: policy.ts:290

A regular expression that matches files this policy applies to.

PolicyShape.match


name: string

Defined in: policy.ts:280

The name of the policy; displayed in UI and used in settings.

PolicyShape.name


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

Defined in: policy.ts:302

An optional resolver function that can automatically fix violations. Return a PolicyError with fixed: true after a successful fix. Legacy PolicyFixResult resolvers remain supported.

PolicyShape.resolver


optional scope?: "file"

Defined in: policy.ts:276

File scope is the default for existing policies.

PolicyShape.scope