Home > harper.js > WorkerLinter

WorkerLinter class

A Linter that spins up a dedicated web worker to do processing on a separate thread. Main benefit: this Linter will not block the event loop for large documents.

NOTE: This class will not work properly in Node. In that case, just use LocalLinter.

Signature:

export declare class WorkerLinter implements Linter 

Implements: Linter

Constructors

Constructor

Modifiers

Description

(constructor)(init)

Constructs a new instance of the WorkerLinter class

Methods

Method

Modifiers

Description

applySuggestion(text, lint, suggestion)

clearIgnoredLints()

clearWords()

contextHash(source, lint)

dispose()

exportIgnoredLints()

exportWords()

generateStatsFile()

getDefaultLintConfig()

getDefaultLintConfigAsJSON()

getDialect()

getLintConfig()

getLintConfigAsJSON()

getLintDescriptions()

getLintDescriptionsAsJSON()

getLintDescriptionsHTML()

getLintDescriptionsHTMLAsJSON()

ignoreLint(source, lint)

ignoreLintHash(hash)

importIgnoredLints(json)

importStatsFile(statsFile)

importWords(words)

isLikelyEnglish(text)

isolateEnglish(text)

lint(text, options)

loadWeirpackFromBlob(blob)

Load a Weirpack from a Blob via the worker thread.

Returns undefined when the tests pass and the pack is imported, otherwise forwards the failure report back to the caller.

loadWeirpackFromBytes(bytes)

Load a Weirpack from bytes via the worker thread.

Returns the failure report if tests fail or undefined when the pack is imported.

organizedLints(text, options)

setDialect(dialect)

setLintConfig(config)

setLintConfigWithJSON(config)

setup()

summarizeStats(start, end)

toTitleCase(text)