Skip to Content
API Referencecontract-check

@stesura/contract-check

Defined terms: where each is defined, what the definition says and where it is used, and what is wrong with them (the findings). The UI is @stesura/contract-check-react; setup and behaviour are in the Contract check guide.

Plugin

contractCheckPlugin

Parameters:
NameTypeDefault
optionsContractCheckPluginOptions
Returns:
Plugin<ContractCheckPluginState>

ContractCheckPluginOptions

NameTypeDefault
settingsCheckSettings
debounceMsnumber

Quiet time after the last edit before the index is rebuilt. Default 500 ms.

underlinesboolean

Underline defined terms and tint open findings. Default true.

enabledboolean | (() => boolean)

Checks at all. Off, nothing is built or drawn until setContractCheckEnabled turns it on. A function is read once, when the state is created (a stored user preference). Default true.

ContractCheckPluginState

NameTypeDefault
indexTermIndex | null

null until the first build. Positions are those of the document it was built on.

findingsCheckFinding[]

From the same build as index; read them mapped through selectCheckFindings.

mappingMapping

From the index’s document to the current one: empty right after a build.

staleboolean

The index predates the current text.

settingsResolvedCheckSettings
underlinesboolean
visibleCheckRange | null

The range the UI reports as on screen; null decorates the whole document.

focusIdstring | null

The finding the panel points at: its ranges are outlined.

step{ id: string; pos: number; } | null

The range the panel last stepped to, by its start in the current document (mapped through edits, so it stays on the same occurrence). While its finding is focused, only that range is outlined.

enabledboolean
decorationsDecorationSet

getContractCheckState

Parameters:
NameTypeDefault
stateEditorState
Returns:
ContractCheckPluginState | undefined

findDefinedTerm

A defined term by id, its definition range mapped to the current document. A definition deleted since the last build is not found until the next one, even if an undo brought it back: two transactions share no mirror, so its range has collapsed.

Parameters:
NameTypeDefault
stateEditorState
idstring
Returns:
DefinedTerm | undefined

goToDefinition

Selects a term’s definition and reveals it, like goToCheckFinding.

Parameters:
NameTypeDefault
viewEditorView
idstring
Returns:
boolean

goToDefinitionAtSelection

Goes to the definition of the term at the caret; a host binds it to a key.

Parameters:
NameTypeDefault
viewEditorView
Returns:
boolean

termAtSelection

The underlined term the caret sits in: how keyboard users reach the hover card.

Parameters:
NameTypeDefault
stateEditorState
Returns:
{ termId: string; definition: boolean; from: number; } | null

setContractCheckVisibleRange

The UI reports what is on screen; underlines outside it are not drawn.

Parameters:
NameTypeDefault
viewEditorView
rangeCheckRange
Returns:
void

setContractCheckUnderlines

Parameters:
NameTypeDefault
viewEditorView
onboolean
Returns:
void

setContractCheckSettings

Replaces the settings the plugin was created with (a host endpoint’s answer) and rebuilds.

Parameters:
NameTypeDefault
viewEditorView
settingsCheckSettings
Returns:
void

focusCheckFinding

Outlines one finding’s ranges (or clears the outline): the panel’s hover. With range, it steps to that range (an index into the finding’s ranges as selectCheckFindings lists them): only it is outlined while the finding is focused, and the step follows edits.

Parameters:
NameTypeDefault
idstring
rangenumber
Returns:
Command

goToCheckFinding

Selects a finding’s first range and reveals it. React callers that reveal with editor-react’s revealPos use checkFindingRange instead.

Parameters:
NameTypeDefault
viewEditorView
idstring
Returns:
boolean

TERM_CLASS

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

DEFINITION_CLASS

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

TERM_ID_ATTR

On every underlined span: the defined term’s id.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

ISSUE_CLASS

An open error or warning; with -error or -warning. Hints are shown only when focused.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

FOCUS_CLASS

The ranges of the finding the panel points at.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

Findings

selectCheckFindings

The findings read API: what a panel, a status bar or a joined panel renders.

Parameters:
NameTypeDefault
stateEditorState
Returns:
CheckFindingsView

CheckFindingsView

NameTypeDefault
installedboolean

The plugin is in the editor.

enabledboolean

Checking is on; off, there are no findings (setContractCheckEnabled).

staleboolean

Until the first build lands, and from an edit until the rebuild.

indexTermIndex | null
findingsReviewedCheckFinding[]

In document order. A range whose text was deleted since the build is dropped.

ReviewedCheckFinding

A finding as the UI shows it: ranges mapped to the current document, with its review state and, once the panel stepped through it, the index of the range it is on.

NameTypeDefault
idstring

Hash of rule, scope and normalised term (plus the block id for a final check): stable across edits elsewhere and re-imports.

ruleCheckRuleId
categoryCheckCategory
severityCheckSeverity
scopestring

The scope (CheckScope.id) the finding belongs to.

messagestring

English, like format-lint’s; the UI shows it under a translated rule title.

evidenceCheckEvidence[]

At most three quotes, in document order.

rangesCheckRange[]

Document ranges, in document order. Positions of the document the finding was collected on.

blockIdsstring[]

The ids of the blocks the ranges sit in, in document order, each once.

fixableboolean

Has a fix applyCheckFixes applies: CHK-30’s conversion to a live cross-reference.

confidencenumber

Heuristic rules only (CHK-1, CHK-5): how sure, 0 to 1.

bandConfidenceBand

Heuristic rules only: recommend or possible; silent findings are not reported.

statusCheckReviewStatus
stepnumber | null

runContractCheck

The index and the findings from one build: what the plugin, the CLI and the corpus runner use.

Parameters:
NameTypeDefault
docNode
optionsBuildTermIndexOptions
Returns:
CheckResult

collectCheckFindings

What is wrong with the document’s defined terms. Pure: the same document gives the same findings.

Parameters:
NameTypeDefault
docNode
optionsBuildTermIndexOptions
Returns:
CheckFinding[]

CHECK_RULES

NameTypeDefault
lengthnumber
toString() => string
toLocaleString{ (): string; (locales: string | string[], options?: (NumberFormatOptions & DateTimeFormatOptions) | undefined): string; }
concat{ (...items: ConcatArray<CheckRuleId>[]): CheckRuleId[]; (...items: (CheckRuleId | ConcatArray<CheckRuleId>)[]): CheckRuleId[]; }
join(separator?: string | undefined) => string
slice(start?: number | undefined, end?: number | undefined) => CheckRuleId[]
indexOf(searchElement: CheckRuleId, fromIndex?: number | undefined) => number
lastIndexOf(searchElement: CheckRuleId, fromIndex?: number | undefined) => number
every{ <S extends CheckRuleId>(predicate: (value: CheckRuleId, index: number, array: readonly CheckRuleId[]) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: CheckRuleId, index: number, array: readonly CheckRuleId[]) => unknown, thisArg?: any): boolean; }
some(predicate: (value: CheckRuleId, index: number, array: readonly CheckRuleId[]) => unknown, thisArg?: any) => boolean
forEach(callbackfn: (value: CheckRuleId, index: number, array: readonly CheckRuleId[]) => void, thisArg?: any) => void
map<U>(callbackfn: (value: CheckRuleId, index: number, array: readonly CheckRuleId[]) => U, thisArg?: any) => U[]
filter{ <S extends CheckRuleId>(predicate: (value: CheckRuleId, index: number, array: readonly CheckRuleId[]) => value is S, thisArg?: any): S[]; (predicate: (value: CheckRuleId, index: number, array: readonly CheckRuleId[]) => unknown, thisArg?: any): CheckRuleId[]; }
reduce{ (callbackfn: (previousValue: CheckRuleId, currentValue: CheckRuleId, currentIndex: number, array: readonly CheckRuleId[]) => CheckRuleId): CheckRuleId; (callbackfn: (previousValue: CheckRuleId, currentValue: CheckRuleId, currentIndex: number, array: readonly CheckRuleId[]) => CheckRuleId, initialValue: CheckRuleId...
reduceRight{ (callbackfn: (previousValue: CheckRuleId, currentValue: CheckRuleId, currentIndex: number, array: readonly CheckRuleId[]) => CheckRuleId): CheckRuleId; (callbackfn: (previousValue: CheckRuleId, currentValue: CheckRuleId, currentIndex: number, array: readonly CheckRuleId[]) => CheckRuleId, initialValue: CheckRuleId...
find{ <S extends CheckRuleId>(predicate: (value: CheckRuleId, index: number, obj: readonly CheckRuleId[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: CheckRuleId, index: number, obj: readonly CheckRuleId[]) => unknown, thisArg?: any): CheckRuleId | undefined; }
findIndex(predicate: (value: CheckRuleId, index: number, obj: readonly CheckRuleId[]) => unknown, thisArg?: any) => number
entries() => ArrayIterator<[number, CheckRuleId]>
keys() => ArrayIterator<number>
values() => ArrayIterator<CheckRuleId>
includes(searchElement: CheckRuleId, fromIndex?: number | undefined) => boolean
flatMap<U, This = undefined>(callback: (this: This, value: CheckRuleId, index: number, array: CheckRuleId[]) => U | readonly U[], thisArg?: This | undefined) => U[]
flat<A, D extends number = 1>(this: A, depth?: D | undefined) => FlatArray<A, D>[]
at(index: number) => CheckRuleId | undefined
__@iterator@6565() => ArrayIterator<CheckRuleId>
__@unscopables@6567{ readonly [x: number]: boolean | undefined; readonly length?: boolean; toString?: boolean; toLocaleString?: boolean; concat?: boolean; join?: boolean; slice?: boolean; indexOf?: boolean; lastIndexOf?: boolean; ... 17 more ...; readonly [Symbol.unscopables]?: boolean; }

DEFAULT_RULES

CHK-5 reports 70 orphan short forms per 100 pages until its list is grown (Phase 0).

NameTypeDefault
CHK-1boolean
CHK-2boolean
CHK-3boolean
CHK-4boolean
CHK-5boolean
CHK-6boolean
CHK-10boolean
CHK-22boolean
CHK-30boolean
CHK-31boolean
CHK-32boolean
CHK-33boolean
CHK-34boolean
CHK-35boolean
CHK-36boolean
CHK-40boolean
CHK-41boolean
CHK-42boolean
CHK-43boolean

Fixes

CHK-30’s fix turns a typed reference into a live cross-reference. Fixes are collected again on the current document and applied in one transaction, so one undo step; while track changes is on they are refused unless forced.

applyCheckFixes

Applies fixes with the settings the plugin checks with, in one undo step, in chunks (a bulk command: dispatch it through the editor, or runBulkCommand headless). Refuses while track changes is on (see checkFixesBlockedReason); force applies anyway.

Parameters:
NameTypeDefault
selectionstring[] | "all"
optionsApplyCheckFixesOptions
Returns:
Command

applyCheckFixesTr

Applies fixes in one transaction, for composing; applyCheckFixesBulk applies them in chunks. One undo step either way: the findings are collected again on the current document and filtered by id, never replayed from positions held since. "all" takes every fixable finding not ignored.

Parameters:
NameTypeDefault
selectionstring[] | "all"
optionsApplyCheckFixesOptions
Returns:
TransactionFn

checkFixesBlockedReason

Why fixing is refused right now: every conversion would be a tracked deletion and insertion.

Parameters:
NameTypeDefault
stateEditorState
Returns:
string | null

getCheckFixSummary

The summary an applyCheckFixesTr left on its transaction.

Parameters:
NameTypeDefault
trTransaction
Returns:
CheckFixSummary | undefined

ApplyCheckFixesOptions

NameTypeDefault
settingsCheckSettings | ResolvedCheckSettings
blockedReason(state: EditorState) => string | null

A reason not to apply (track changes on, by default); force overrides it.

forceboolean

CheckFixSummary

NameTypeDefault
appliedCheckFinding[]

The findings fixed, as collected on the document before the fix.

gonestring[]

Requested ids with no fix on the current document.

blockedstring | null

Set when nothing was applied because of blockedReason.

forcedboolean

Applied despite a blockedReason.

Review state

setCheckReviewStatus

Marks findings ignored, flagged or open again, for every collaborator. Not an undo step: like a task pane’s state, it is not part of the text’s history.

Parameters:
NameTypeDefault
idsstring | readonly string[]
statusCheckReviewStatus
Returns:
Command

clearCheckReview

Every finding open again.

Parameters:
This function does not accept any parameters.
Returns:
Command

getCheckReview

Review state per finding id; open findings are absent. Shared by collaborators, last write wins.

Parameters:
NameTypeDefault
stateEditorState
Returns:
Readonly<Record<string, StoredStatus>>

getCheckReviewStatus

Parameters:
NameTypeDefault
stateEditorState
idstring
Returns:
CheckReviewStatus

CHECK_REVIEW_ATTR

The doc attr holding review state: finding id → ignored or flagged.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

Reports

renderCheckReport

The findings as a report: Markdown for a reader or an agent, JSON for a program. Sorted in document order, no timestamps: the same document gives the same bytes.

Parameters:
NameTypeDefault
findingsreadonly ReportFinding[]
indexTermIndex
optionsCheckReportOptions
Returns:
string

CheckReportOptions

NameTypeDefault
format"markdown" | "json"
reviewReadonly<Record<string, CheckReviewStatus>>

Review state per finding id; a finding that carries a status keeps its own.

Index

buildTermIndex

The defined terms of a document, where they are defined and where they are used. Pure: the same document gives the same index, in the same order.

Parameters:
NameTypeDefault
docNode
optionsBuildTermIndexOptions
Returns:
TermIndex

BuildTermIndexOptions

NameTypeDefault
settingsCheckSettings | ResolvedCheckSettings

normaliseTerm

Case folded with toLowerCase, never a locale-dependent fold.

Parameters:
NameTypeDefault
sstring
Returns:
string

Settings

resolveCheckSettings

Parameters:
NameTypeDefault
settingsCheckSettings
Returns:
ResolvedCheckSettings

parseCheckSettings

Reads settings from untrusted JSON (a host endpoint): unknown keys and values of the wrong type are dropped, never thrown on.

Parameters:
NameTypeDefault
jsonunknown
Returns:
CheckSettings

DEFAULT_WEIGHTS

Calibrated in Phase 0 on the labelled corpus (docs/partially-executed/contract-check-plan.md, “Phase 0 results”); change them only with the corpus runner’s numbers.

NameTypeDefault
markupnumber
longnumber
quotednumber
quotePreferrednumber
boldnumber
boldOncenumber
verbnumber
leadnumber
hereinafternumber
parennumber
articleParennumber
sepnumber
blockStartnumber
runnumber
capsnumber
numberednumber
cellTermnumber
allCapsnumber
sentencenumber
lowercasenumber
emptyBodynumber
mentionnumber
referencenumber
runInnumber
capBodynumber
wholeBoldnumber

DEFAULT_THRESHOLDS

NameTypeDefault
recommendnumber
possiblenumber

DEFAULT_PROFILES

NameTypeDefault
enLanguageProfile
frLanguageProfile
deLanguageProfile
nlLanguageProfile
itLanguageProfile
esLanguageProfile

CHECK_LANGUAGES

NameTypeDefault
lengthnumber
toString() => string
toLocaleString{ (): string; (locales: string | string[], options?: (NumberFormatOptions & DateTimeFormatOptions) | undefined): string; }
concat{ (...items: ConcatArray<CheckLanguage>[]): CheckLanguage[]; (...items: (CheckLanguage | ConcatArray<CheckLanguage>)[]): CheckLanguage[]; }
join(separator?: string | undefined) => string
slice(start?: number | undefined, end?: number | undefined) => CheckLanguage[]
indexOf(searchElement: CheckLanguage, fromIndex?: number | undefined) => number
lastIndexOf(searchElement: CheckLanguage, fromIndex?: number | undefined) => number
every{ <S extends CheckLanguage>(predicate: (value: CheckLanguage, index: number, array: readonly CheckLanguage[]) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: CheckLanguage, index: number, array: readonly CheckLanguage[]) => unknown, thisArg?: any): boolean; }
some(predicate: (value: CheckLanguage, index: number, array: readonly CheckLanguage[]) => unknown, thisArg?: any) => boolean
forEach(callbackfn: (value: CheckLanguage, index: number, array: readonly CheckLanguage[]) => void, thisArg?: any) => void
map<U>(callbackfn: (value: CheckLanguage, index: number, array: readonly CheckLanguage[]) => U, thisArg?: any) => U[]
filter{ <S extends CheckLanguage>(predicate: (value: CheckLanguage, index: number, array: readonly CheckLanguage[]) => value is S, thisArg?: any): S[]; (predicate: (value: CheckLanguage, index: number, array: readonly CheckLanguage[]) => unknown, thisArg?: any): CheckLanguage[]; }
reduce{ (callbackfn: (previousValue: CheckLanguage, currentValue: CheckLanguage, currentIndex: number, array: readonly CheckLanguage[]) => CheckLanguage): CheckLanguage; (callbackfn: (previousValue: CheckLanguage, currentValue: CheckLanguage, currentIndex: number, array: readonly CheckLanguage[]) => CheckLanguage, initial...
reduceRight{ (callbackfn: (previousValue: CheckLanguage, currentValue: CheckLanguage, currentIndex: number, array: readonly CheckLanguage[]) => CheckLanguage): CheckLanguage; (callbackfn: (previousValue: CheckLanguage, currentValue: CheckLanguage, currentIndex: number, array: readonly CheckLanguage[]) => CheckLanguage, initial...
find{ <S extends CheckLanguage>(predicate: (value: CheckLanguage, index: number, obj: readonly CheckLanguage[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: CheckLanguage, index: number, obj: readonly CheckLanguage[]) => unknown, thisArg?: any): CheckLanguage | undefined; }
findIndex(predicate: (value: CheckLanguage, index: number, obj: readonly CheckLanguage[]) => unknown, thisArg?: any) => number
entries() => ArrayIterator<[number, CheckLanguage]>
keys() => ArrayIterator<number>
values() => ArrayIterator<CheckLanguage>
includes(searchElement: CheckLanguage, fromIndex?: number | undefined) => boolean
flatMap<U, This = undefined>(callback: (this: This, value: CheckLanguage, index: number, array: CheckLanguage[]) => U | readonly U[], thisArg?: This | undefined) => U[]
flat<A, D extends number = 1>(this: A, depth?: D | undefined) => FlatArray<A, D>[]
at(index: number) => CheckLanguage | undefined
__@iterator@6565() => ArrayIterator<CheckLanguage>
__@unscopables@6567{ readonly [x: number]: boolean | undefined; readonly length?: boolean; toString?: boolean; toLocaleString?: boolean; concat?: boolean; join?: boolean; slice?: boolean; indexOf?: boolean; lastIndexOf?: boolean; ... 17 more ...; readonly [Symbol.unscopables]?: boolean; }

Types

CheckFinding

NameTypeDefault
idstring

Hash of rule, scope and normalised term (plus the block id for a final check): stable across edits elsewhere and re-imports.

ruleCheckRuleId
categoryCheckCategory
severityCheckSeverity
scopestring

The scope (CheckScope.id) the finding belongs to.

messagestring

English, like format-lint’s; the UI shows it under a translated rule title.

evidenceCheckEvidence[]

At most three quotes, in document order.

rangesCheckRange[]

Document ranges, in document order. Positions of the document the finding was collected on.

blockIdsstring[]

The ids of the blocks the ranges sit in, in document order, each once.

fixableboolean

Has a fix applyCheckFixes applies: CHK-30’s conversion to a live cross-reference.

confidencenumber

Heuristic rules only (CHK-1, CHK-5): how sure, 0 to 1.

bandConfidenceBand

Heuristic rules only: recommend or possible; silent findings are not reported.

CheckResult

What one check run produces: the index and what is wrong with the document.

NameTypeDefault
indexTermIndex
findingsCheckFinding[]

CheckRuleId

Rule ids, as in docs/partially-executed/contract-check-plan.md.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

CheckCategory

The plan’s rule families: defined terms, definition layout, bilingual, cross-references, final checks.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

CheckSeverity

error: the document says something wrong. warning: probably a drafting slip. hint: a judgement call (lowercase uses are often deliberate).

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

CheckEvidence

A quote from the document that supports a finding, with the block it sits in.

NameTypeDefault
textstring
blockIdstring | null

CheckReviewStatus

A finding’s review state; open is not stored.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

TermIndex

NameTypeDefault
languageCheckLanguage
scopesCheckScope[]
termsDefinedTerm[]
usagesTermUsage[]
candidatesDefinitionCandidate[]

DefinedTerm

NameTypeDefault
idstring

Hash of scope and normalised term: stable across edits elsewhere.

termstring
kindDefinitionKind
scopestring
languageCheckLanguage
scorenumber

The weighted signal sum the definition scored (5 or more: see ResolvedCheckSettings.thresholds).

definitionCheckRange
blockIdstring | null

The id of the block holding the definition: what reports cite.

bodystring

The defining text, read from the document; empty when not found.

usagesnumber

Uses outside headers, footers and the term’s own definition.

TermUsage

NameTypeDefault
termIdstring
rangeCheckRange

DefinitionCandidate

A span the detector proposes as a definition.

NameTypeDefault
keystring

<block index>:<normalised term>: stable across imports of the same file.

blocknumber
termstring
languageCheckLanguage
signalsDefinitionSignal[]
scorenumber
bandConfidenceBand
rangeCheckRange

The term’s range (the quotes excluded).

sourcestring

Where the candidate came from: quote, bold, head, cell, …

DefinitionKind

How a definition is laid out; decides where its body is.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

DefinitionSignal

One scoring signal of a definition candidate.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

ConfidenceBand

recommend: a definition the index trusts; possible: shown as a finding only; silent: ignored.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

CheckScope

A region whose definitions belong together. Phase 1 proposes them from language runs.

NameTypeDefault
idstring
languageCheckLanguage
blocks{ first: number; last: number; }

Block indices, inclusive.

translationOfstring

The document’s other-language version, when it is bilingual.

CheckRange

A text range in the document.

NameTypeDefault
fromnumber
tonumber

CheckLanguage

Languages with a profile.

NameTypeDefault
toString() => string
charAt(pos: number) => string
charCodeAt(index: number) => number
concat(...strings: string[]) => string
indexOf(searchString: string, position?: number | undefined) => number
lastIndexOf(searchString: string, position?: number | undefined) => number
localeCompare{ (that: string): number; (that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): number; (that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): number; }
match{ (regexp: string | RegExp): RegExpMatchArray | null; (matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; }
replace{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: { ...; }, replaceValue: string): string; (searchValue: { ...; }, replacer: (substring: string, ...args: any[]) => string): string; }
slice(start?: number | undefined, end?: number | undefined) => string
split{ (separator: string | RegExp, limit?: number | undefined): string[]; (splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]; }
substring(start: number, end?: number | undefined) => string
toLowerCase() => string
toLocaleLowerCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
toUpperCase() => string
toLocaleUpperCase{ (locales?: string | string[] | undefined): string; (locales?: LocalesArgument): string; }
trim() => string
lengthnumber
substr(from: number, length?: number | undefined) => string
valueOf() => string
codePointAt(pos: number) => number | undefined
includes(searchString: string, position?: number | undefined) => boolean
endsWith(searchString: string, endPosition?: number | undefined) => boolean
normalize{ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; (form?: string | undefined): string; }
repeat(count: number) => string
startsWith(searchString: string, position?: number | undefined) => boolean
anchor(name: string) => string
big() => string
bold() => string
fixed() => string
fontcolor(color: string) => string
fontsize{ (size: number): string; (size: string): string; }
italics() => string
small() => string
strike() => string
sub() => string
sup() => string
padStart(maxLength: number, fillString?: string | undefined) => string
padEnd(maxLength: number, fillString?: string | undefined) => string
trimEnd() => string
trimStart() => string
trimLeft() => string
trimRight() => string
matchAll(regexp: RegExp) => RegExpStringIterator<RegExpExecArray>
replaceAll{ (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
at(index: number) => string | undefined
__@iterator@6565() => StringIterator<string>

CheckSettings

The organisation’s settings: JSON, from a host endpoint. Patterns stay in the profiles; settings only add to their lists and tune the scoring.

NameTypeDefault
commonTermsPartial<Record<CheckLanguage, string[]>>

Extra common terms per language.

shortFormsstring[]

Extra short forms, every language.

weightsPartial<Record<CheckLanguage, Partial<SignalWeights>>>

Weight overrides per language.

thresholds{ recommend?: number; possible?: number; }
rulesPartial<Record<CheckRuleId, boolean>>

Rules switched on or off. Default: every rule on except CHK-5.

ResolvedCheckSettings

Settings merged onto the built-in profiles: what the engine runs on.

NameTypeDefault
profilesRecord<CheckLanguage, LanguageProfile>
weightsRecord<CheckLanguage, SignalWeights>
thresholds{ recommend: number; possible: number; }
rulesRecord<CheckRuleId, boolean>

LanguageProfile

Everything language-specific. A seventh language is a new profile, not a refactor. Patterns are code; the organisation’s additions (common terms, short forms, weights) come through CheckSettings.

NameTypeDefault
languageCheckLanguage
validatedboolean

Measured against labelled documents in Phase 0. The others ship unvalidated.

stopwordsreadonly string[]

Frequent function words: the per-block language guess counts them.

quotesstring

Opening quote characters of the language’s preferred style.

verbsRegExp

A definition verb right after the term: “means”, “désigne”, “bedeutet”.

includesRegExp

The “includes” verbs among verbs : a lower-case term they introduce (“a “person” includes …”) is the construction clause widening an ordinary word, not a defined term.

leadRegExp

A word right before the term that makes it a definition (“onder X wordt verstaan”).

hereinafterRegExp

Inside a parenthesis before the term: “(hereinafter “X”)”.

referredAsRegExp

The strong subset of hereinafter , trusted outside a parenthesis too.

mentionRegExp

Talking about a term, not defining it: “the definition of “X””.

conjunctionsstring

Joins the terms of a grouped entry: “A, B en C: …”.

copulaRegExp

“Vertragsgegenstände sind …”: a definition verb only at a block start.

parenWordsReadonlySet<string>

Words that may sit in a parenthesis around a term with nothing else: “(the “X”)”.

articlesReadonlySet<string>
connectorsstring

Lowercase words allowed inside a capitalised phrase (“Board of Directors”).

commonReadonlySet<string>

Capitalised words that need no definition.

shortFormsReadonlySet<string>

Abbreviations that need no definition.

typedRefsRegExp

Typed references (“Clause 4”, “Anlage 2”): never terms.

genitivestring

Connectors that join two terms into a phrase: “Processing of the Personal Data”.

forwardRegExp

After a use, says its definition comes later: “as defined below” (CHK-6).

definedInreadonly { phrase: RegExp; closing?: RegExp; }[]

Says a term is defined in a clause (CHK-36): “as defined in”, “has the meaning given to it in”, “au sens de l’article”. Global; the reference must start where phrase ends, and closing, when set, must follow it (“wie in Ziffer 3 definiert”).

capitalisedNounsboolean

Every noun is capitalised (German): capitals do not mark a term, so “used not defined” (CHK-1) has no signal and stays off.

placeholdersRegExp | null

This language’s own blanks (“[à compléter]”, “PM”), beside the shared list (CHK-40).

quotePairsreadonly string[]

Each quotation style as its opening and closing mark: ”“””, ”«»” (CHK-41).

numbers{ locale: string; decimal: "." | ","; words: Readonly<Record<string, number>>; }

Reading “ten (10)” (CHK-42).

forms(term: string) => string[]

The surface forms a usage of term may take: plurals, possessives, declensions.

SignalWeights

NameTypeDefault
markupnumber
longnumber
quotednumber
quotePreferrednumber
boldnumber
boldOncenumber
verbnumber
leadnumber
hereinafternumber
parennumber
articleParennumber
sepnumber
blockStartnumber
runnumber
capsnumber
numberednumber
cellTermnumber
allCapsnumber
sentencenumber
lowercasenumber
emptyBodynumber
mentionnumber
referencenumber
runInnumber
capBodynumber
wholeBoldnumber
Last updated on