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.
Parameters
Section titled “Parameters”Policy metadata and header matching and replacement rules.
Returns
Section titled “Returns”PolicyShape<FileHeaderPolicyConfig>
A file policy configured for the supplied file types.
Example
Section titled “Example”const MyHeaderPolicy = defineFileHeaderPolicy({ name: "MyHeaderPolicy", description: "Ensures files have required headers", config: { match: /\.ts$/, lineStart: /// /, lineEnd: /\r?\n/, replacer: ... },});