From 1c7a4c08de62a756bd18031075db76c6414cc6eb Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 16 Apr 2024 08:41:32 +0200 Subject: [PATCH] chore: add ts-eslint (#627) --- .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..7b3307f7 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 @@ -149,7 +149,7 @@ export class AggregatorRegistry< * @return {Registry} aggregated registry. */ static aggregate( - metricsArr: Array, + metricsArr: Array, ): Registry; // TODO Promise? /** @@ -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",