harper.js 0.34.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/harper.d.ts CHANGED
@@ -131,11 +131,15 @@ export declare interface Linter {
131
131
  toTitleCase(text: string): Promise<string>;
132
132
  /** Ignore future instances of a lint from a previous linting run in future invocations. */
133
133
  ignoreLint(source: string, lint: Lint): Promise<void>;
134
+ /** Ignore future instances of a lint from a previous linting run in future invocations using its hash. */
135
+ ignoreLintHash(hash: bigint): Promise<void>;
134
136
  /** Export the ignored lints to a JSON list of privacy-respecting hashes. */
135
137
  exportIgnoredLints(): Promise<string>;
136
138
  /** Import ignored lints from a JSON list to the linter.
137
139
  * This function appends to the existing lints, if any. */
138
140
  importIgnoredLints(json: string): Promise<void>;
141
+ /** Produce a context-sensitive hash that represents a lint. */
142
+ contextHash(source: string, lint: Lint): Promise<bigint>;
139
143
  /** Clear records of all previously ignored lints. */
140
144
  clearIgnoredLints(): Promise<void>;
141
145
  /** Import words into the dictionary. This is a significant operation, so try to batch words. */
@@ -197,6 +201,14 @@ declare class Linter_2 {
197
201
  get_lint_config_as_object(): any;
198
202
  set_lint_config_from_object(object: any): void;
199
203
  ignore_lint(source_text: string, lint: Lint): void;
204
+ /**
205
+ * Add a specific context hash to the ignored lints list.
206
+ */
207
+ ignore_hash(hash: bigint): void;
208
+ /**
209
+ * Compute the context hash of a given lint.
210
+ */
211
+ context_hash(source_text: string, lint: Lint): bigint;
200
212
  /**
201
213
  * Perform the configured linting on the provided text.
202
214
  */
@@ -268,8 +280,10 @@ export declare class LocalLinter implements Linter {
268
280
  getLintDescriptionsHTML(): Promise<Record<string, string>>;
269
281
  getLintDescriptionsHTMLAsJSON(): Promise<string>;
270
282
  ignoreLint(source: string, lint: Lint): Promise<void>;
283
+ ignoreLintHash(hash: bigint): Promise<void>;
271
284
  exportIgnoredLints(): Promise<string>;
272
285
  importIgnoredLints(json: string): Promise<void>;
286
+ contextHash(source: string, lint: Lint): Promise<bigint>;
273
287
  clearIgnoredLints(): Promise<void>;
274
288
  importWords(words: string[]): Promise<void>;
275
289
  exportWords(): Promise<string[]>;
@@ -286,7 +300,7 @@ export declare interface RequestArg {
286
300
  type: SerializableTypes;
287
301
  }
288
302
 
289
- export declare type SerializableTypes = 'string' | 'number' | 'boolean' | 'object' | 'Suggestion' | 'Lint' | 'Span' | 'Array' | 'undefined';
303
+ export declare type SerializableTypes = 'string' | 'number' | 'boolean' | 'object' | 'Suggestion' | 'Lint' | 'Span' | 'Array' | 'undefined' | 'bigint';
290
304
 
291
305
  /** An object that is sent to the web worker to request work to be done. */
292
306
  export declare interface SerializedRequest {
@@ -395,8 +409,10 @@ export declare class WorkerLinter implements Linter {
395
409
  getDefaultLintConfigAsJSON(): Promise<string>;
396
410
  getDefaultLintConfig(): Promise<LintConfig>;
397
411
  ignoreLint(source: string, lint: Lint): Promise<void>;
412
+ ignoreLintHash(hash: bigint): Promise<void>;
398
413
  exportIgnoredLints(): Promise<string>;
399
414
  importIgnoredLints(json: string): Promise<void>;
415
+ contextHash(source: string, lint: Lint): Promise<bigint>;
400
416
  clearIgnoredLints(): Promise<void>;
401
417
  importWords(words: string[]): Promise<void>;
402
418
  exportWords(): Promise<string[]>;