Home > harper.js

harper.js package

Classes

Class

Description

BinaryModule

A wrapper around the underlying WebAssembly module that contains Harper's core code. Used to construct a Linter, as well as access some miscellaneous other functions.

Lint

An error found in provided text.

May include zero or more suggestions that may fix the problematic text.

LocalLinter

A Linter that runs in the current JavaScript context (meaning it is allowed to block the event loop). See the interface definition for more details.

Span

A struct that represents two character indices in a string: a start and an end.

Suggestion

A suggestion to fix a Lint.

WorkerLinter

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.

Enumerations

Enumeration

Description

Dialect

Specifies an English Dialect, often used for linting.

SuggestionKind

Tags the variant of suggestion.

Interfaces

Interface

Description

Linter

An interface for an object that can perform linting actions.

LinterInit

The properties and information needed to construct a Linter.

LintOptions

Options available to configure Harper's parser for an individual linting operation.

Summary

Represents the summary of linting results and history. Useful to show linting statistics or insights to the user.

Variables

Variable

Description

binary

A version of the Harper WebAssembly binary stored inline as a data URL. Can be tree-shaken if unused.

binaryInlined

A version of the Harper WebAssembly binary stored inline as a data URL. Can be tree-shaken if unused.

Type Aliases

Type Alias

Description

LintConfig

A linting rule configuration dependent on upstream Harper's available rules. This is a record, since you shouldn't hard-code the existence of any particular rules and should generalize based on this struct.