Skip to content

defineFileHeaderPolicy

defineFileHeaderPolicy(args): PolicyShape<FileHeaderPolicyConfig>

Defined in: policyDefiners/defineFileHeaderPolicy.ts:111

Creates a file-header policy that detects missing or incorrect headers and can replace them.

The handler skips checks when no FileHeaderPolicyConfig is supplied.

DefineFileHeaderPolicyArgs

Policy metadata and header matching and replacement rules.

PolicyShape<FileHeaderPolicyConfig>

A file policy configured for the supplied file types.

const MyHeaderPolicy = defineFileHeaderPolicy({
name: "MyHeaderPolicy",
description: "Ensures files have required headers",
config: { match: /\.ts$/, lineStart: /// /, lineEnd: /\r?\n/, replacer: ... },
});