Skip to content

PolicyShape

Defined in: policy.ts:274

Interface describing the shape of a policy definition.

C = void

Type of configuration object used by the policy

optional defaultConfig?: C

Defined in: policy.ts:307

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


description: string

Defined in: policy.ts:285

A detailed description of the policy and its purpose.


handler: PolicyHandler<C>

Defined in: policy.ts:295

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


match: RegExp

Defined in: policy.ts:290

A regular expression that matches files this policy applies to.


name: string

Defined in: policy.ts:280

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


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.


optional scope?: "file"

Defined in: policy.ts:276

File scope is the default for existing policies.