From 350da53b70daff20d849e43796e10419421c8913 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 16 Apr 2024 08:36:44 +0200 Subject: [PATCH] chore: add ts-eslint --- .eslintrc | 16 ++++++++++++++++ index.d.ts | 6 +++--- package.json | 2 ++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.eslintrc b/.eslintrc index 067ab963..7adb806a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -69,6 +69,22 @@ "rules": { "no-console": "off" } + }, + { + "files": ["**/*.ts"], + "extends": ["plugin:@typescript-eslint/recommended"], + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"], + "rules": { + "node/no-unsupported-features/es-syntax": "off" + } + }, + { + "files": ["**/*.d.ts"], + "rules": { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": "off" + } } ] } diff --git a/index.d.ts b/index.d.ts index 99d12677..58985fd8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -70,7 +70,7 @@ export class Registry { * @param labels of name/value pairs: * { defaultLabel: "value", anotherLabel: "value 2" } */ - setDefaultLabels(labels: Object): void; + setDefaultLabels(labels: object): void; /** * Get a string representation of a single metric by name @@ -197,7 +197,7 @@ interface MetricObject { help: string; type: MetricType; aggregator: Aggregator; - collect: CollectFunction; + collect: CollectFunction; } interface MetricObjectWithValues> @@ -770,7 +770,7 @@ export interface DefaultMetricsCollectorConfiguration< prefix?: string; gcDurationBuckets?: number[]; eventLoopMonitoringPrecision?: number; - labels?: Object; + labels?: object; } export const collectDefaultMetrics: { diff --git a/package.json b/package.json index 01be5262..ddbeb4bc 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,8 @@ "homepage": "https://github.com/siimon/prom-client", "devDependencies": { "@clevernature/benchmark-regression": "^1.0.0", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", "eslint": "^8.32.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-node": "^11.0.0",