harper.js 0.18.0 → 0.19.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 +22 -1
- package/dist/harper.js +234 -154
- package/docs.sh +1 -1
- package/examples/commonjs-simple/index.js +1 -2
- package/package.json +1 -1
- package/src/Linter.test.ts +38 -0
- package/src/Linter.ts +13 -0
- package/src/LocalLinter.ts +24 -0
- package/src/WorkerLinter/index.ts +16 -0
package/dist/harper.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export declare class Lint {
|
|
|
16
16
|
* Get a string representing the general category of the lint.
|
|
17
17
|
*/
|
|
18
18
|
lint_kind(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get a string representing the general category of the lint.
|
|
21
|
+
*/
|
|
22
|
+
lint_kind_pretty(): string;
|
|
19
23
|
/**
|
|
20
24
|
* Equivalent to calling `.length` on the result of `suggestions()`.
|
|
21
25
|
*/
|
|
@@ -23,7 +27,7 @@ export declare class Lint {
|
|
|
23
27
|
/**
|
|
24
28
|
* Get an array of any suggestions that may resolve the issue.
|
|
25
29
|
*/
|
|
26
|
-
suggestions():
|
|
30
|
+
suggestions(): Suggestion[];
|
|
27
31
|
/**
|
|
28
32
|
* Get the location of the problematic text.
|
|
29
33
|
*/
|
|
@@ -74,6 +78,15 @@ export declare interface Linter {
|
|
|
74
78
|
getLintDescriptions(): Promise<Record<string, string>>;
|
|
75
79
|
/** Convert a string to Chicago-style title case. */
|
|
76
80
|
toTitleCase(text: string): Promise<string>;
|
|
81
|
+
/** Ignore future instances of a lint from a previous linting run in future invocations. */
|
|
82
|
+
ignoreLint(lint: Lint): Promise<void>;
|
|
83
|
+
/** Export the ignored lints to a JSON list of privacy-respecting hashes. */
|
|
84
|
+
exportIgnoredLints(): Promise<string>;
|
|
85
|
+
/** Import ignored lints from a JSON list to the linter.
|
|
86
|
+
* This function appends to the existing lints, if any. */
|
|
87
|
+
importIgnoredLints(json: string): Promise<void>;
|
|
88
|
+
/** Clear records of all previously ignored lints. */
|
|
89
|
+
clearIgnoredLints(): Promise<void>;
|
|
77
90
|
}
|
|
78
91
|
|
|
79
92
|
/** The option used to configure the parser for an individual linting operation. */
|
|
@@ -101,6 +114,10 @@ export declare class LocalLinter implements Linter {
|
|
|
101
114
|
toTitleCase(text: string): Promise<string>;
|
|
102
115
|
getLintDescriptions(): Promise<Record<string, string>>;
|
|
103
116
|
getLintDescriptionsAsJSON(): Promise<string>;
|
|
117
|
+
ignoreLint(lint: Lint): Promise<void>;
|
|
118
|
+
exportIgnoredLints(): Promise<string>;
|
|
119
|
+
importIgnoredLints(json: string): Promise<void>;
|
|
120
|
+
clearIgnoredLints(): Promise<void>;
|
|
104
121
|
}
|
|
105
122
|
|
|
106
123
|
/**
|
|
@@ -177,6 +194,10 @@ export declare class WorkerLinter implements Linter {
|
|
|
177
194
|
getLintDescriptions(): Promise<Record<string, string>>;
|
|
178
195
|
getDefaultLintConfigAsJSON(): Promise<string>;
|
|
179
196
|
getDefaultLintConfig(): Promise<LintConfig>;
|
|
197
|
+
ignoreLint(lint: Lint): Promise<void>;
|
|
198
|
+
exportIgnoredLints(): Promise<string>;
|
|
199
|
+
importIgnoredLints(json: string): Promise<void>;
|
|
200
|
+
clearIgnoredLints(): Promise<void>;
|
|
180
201
|
/** Run a procedure on the remote worker. */
|
|
181
202
|
private rpc;
|
|
182
203
|
private submitRemainingRequests;
|