diff --git a/web/ui/module/codemirror-promql/src/client/prometheus.ts b/web/ui/module/codemirror-promql/src/client/prometheus.ts index cd8626719..ad9be14a5 100644 --- a/web/ui/module/codemirror-promql/src/client/prometheus.ts +++ b/web/ui/module/codemirror-promql/src/client/prometheus.ts @@ -55,6 +55,7 @@ export interface CacheConfig { export interface PrometheusConfig { url: string; lookbackInterval?: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any httpErrorHandler?: (error: any) => void; fetchFn?: FetchFn; // cache will allow user to change the configuration of the cached Prometheus client (which is used by default) @@ -79,6 +80,7 @@ const serviceUnavailable = 503; export class HTTPPrometheusClient implements PrometheusClient { private readonly lookbackInterval = 60 * 60 * 1000 * 12; //12 hours private readonly url: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any private readonly errorHandler?: (error: any) => void; private readonly httpMethod: 'POST' | 'GET' = 'POST'; // For some reason, just assigning via "= fetch" here does not end up executing fetch correctly diff --git a/web/ui/module/codemirror-promql/src/lint/index.ts b/web/ui/module/codemirror-promql/src/lint/index.ts index b39ee4b43..29d93de8c 100644 --- a/web/ui/module/codemirror-promql/src/lint/index.ts +++ b/web/ui/module/codemirror-promql/src/lint/index.ts @@ -14,6 +14,7 @@ import { EditorView } from '@codemirror/view'; import { Diagnostic, linter } from '@codemirror/lint'; import { HybridLint } from './hybrid'; +import { Extension } from '@codemirror/state'; type lintFunc = (view: EditorView) => readonly Diagnostic[] | Promise; @@ -27,6 +28,6 @@ export function newLintStrategy(): LintStrategy { return new HybridLint(); } -export function promQLLinter(callbackFunc: (this: LintStrategy) => lintFunc, thisArg: LintStrategy) { +export function promQLLinter(callbackFunc: (this: LintStrategy) => lintFunc, thisArg: LintStrategy): Extension { return linter(callbackFunc.call(thisArg)); } diff --git a/web/ui/module/codemirror-promql/src/parser/parser.ts b/web/ui/module/codemirror-promql/src/parser/parser.ts index f9a83f349..d90dd27cd 100644 --- a/web/ui/module/codemirror-promql/src/parser/parser.ts +++ b/web/ui/module/codemirror-promql/src/parser/parser.ts @@ -73,7 +73,7 @@ export class Parser { }); } - analyze() { + analyze(): void { // when you are at the root of the tree, the first node is not `Expr` but a node with no name. // So to be able to iterate other the node relative to the promql node, we have to get the first child at the beginning this.checkAST(this.tree.topNode.firstChild); diff --git a/web/ui/module/codemirror-promql/src/parser/vector.ts b/web/ui/module/codemirror-promql/src/parser/vector.ts index 723dfb5c1..c219c3d10 100644 --- a/web/ui/module/codemirror-promql/src/parser/vector.ts +++ b/web/ui/module/codemirror-promql/src/parser/vector.ts @@ -30,7 +30,7 @@ import { import { VectorMatchCardinality, VectorMatching } from '../types'; import { containsAtLeastOneChild, retrieveAllRecursiveNodes } from './path-finder'; -export function buildVectorMatching(state: EditorState, binaryNode: SyntaxNode) { +export function buildVectorMatching(state: EditorState, binaryNode: SyntaxNode): VectorMatching | null { if (!binaryNode || binaryNode.type.id !== BinaryExpr) { return null; } diff --git a/web/ui/module/codemirror-promql/src/promql.ts b/web/ui/module/codemirror-promql/src/promql.ts index 01323edf9..0144c09c9 100644 --- a/web/ui/module/codemirror-promql/src/promql.ts +++ b/web/ui/module/codemirror-promql/src/promql.ts @@ -24,7 +24,7 @@ export enum LanguageType { MetricName = 'MetricName', } -export function promQLLanguage(top: LanguageType) { +export function promQLLanguage(top: LanguageType): LezerLanguage { return LezerLanguage.define({ parser: parser.configure({ top: top, diff --git a/web/ui/module/codemirror-promql/src/test/utils.test.ts b/web/ui/module/codemirror-promql/src/test/utils.test.ts index defd23bfa..c1e538342 100644 --- a/web/ui/module/codemirror-promql/src/test/utils.test.ts +++ b/web/ui/module/codemirror-promql/src/test/utils.test.ts @@ -28,7 +28,7 @@ export function createEditorState(expr: string): EditorState { }); } -export function mockPrometheusServer() { +export function mockPrometheusServer(): void { nock('http://localhost:8080') .get('/api/v1/label/__name__/values') .query(true)