Merge pull request #9344 from prometheus/fix-eslint-warning-cmp
fix eslint warning for codemirror-promql
This commit is contained in:
commit
6c9ded2854
|
@ -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
|
||||
|
|
|
@ -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<readonly Diagnostic[]>;
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue