2024-08-06 14:52:22 +00:00
|
|
|
import type { FeatureFlags } from "ee/entities/FeatureFlag";
|
2023-07-05 13:34:03 +00:00
|
|
|
import type { ILinter } from "./linters";
|
2023-07-16 18:49:41 +00:00
|
|
|
import { WorkerLinter } from "./linters";
|
2023-07-05 13:34:03 +00:00
|
|
|
import type { LintTreeRequestPayload, updateJSLibraryProps } from "./types";
|
|
|
|
|
|
|
|
|
|
export class Linter {
|
|
|
|
|
linter: ILinter;
|
2023-07-16 18:49:41 +00:00
|
|
|
constructor() {
|
|
|
|
|
this.linter = new WorkerLinter();
|
2023-07-05 13:34:03 +00:00
|
|
|
this.lintTree = this.lintTree.bind(this);
|
|
|
|
|
this.updateJSLibraryGlobals = this.updateJSLibraryGlobals.bind(this);
|
|
|
|
|
this.start = this.start.bind(this);
|
|
|
|
|
this.shutdown = this.shutdown.bind(this);
|
2023-10-12 17:32:38 +00:00
|
|
|
this.setup = this.setup.bind(this);
|
2023-07-05 13:34:03 +00:00
|
|
|
}
|
|
|
|
|
*lintTree(data: LintTreeRequestPayload) {
|
|
|
|
|
return yield* this.linter.lintTree(data);
|
|
|
|
|
}
|
|
|
|
|
*updateJSLibraryGlobals(data: updateJSLibraryProps) {
|
|
|
|
|
return yield* this.linter.updateJSLibraryGlobals(data);
|
|
|
|
|
}
|
|
|
|
|
*start() {
|
|
|
|
|
yield this.linter.start();
|
|
|
|
|
}
|
|
|
|
|
*shutdown() {
|
|
|
|
|
yield this.linter.shutdown();
|
|
|
|
|
}
|
2023-10-12 17:32:38 +00:00
|
|
|
*setup(featureFlags: FeatureFlags) {
|
|
|
|
|
yield this.linter.setup(featureFlags);
|
|
|
|
|
}
|
2023-07-05 13:34:03 +00:00
|
|
|
}
|