Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ts-eslint #627

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
}
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Container for all registered metrics
*/
export class Registry<RegistryContentType = PrometheusContentType> {

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS ubuntu-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS ubuntu-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS ubuntu-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS ubuntu-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS macOS-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS windows-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS macOS-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS windows-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS windows-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS windows-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS macOS-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13

Check warning on line 24 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS macOS-latest

'RegistryContentType' is already declared in the upper scope on line 17 column 13
/**
* Get string representation for all metrics
*/
Expand Down Expand Up @@ -70,7 +70,7 @@
* @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
Expand Down Expand Up @@ -148,8 +148,8 @@
* `registry.getMetricsAsJSON()`.
* @return {Registry} aggregated registry.
*/
static aggregate<T extends RegistryContentType>(

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS ubuntu-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS ubuntu-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS ubuntu-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS ubuntu-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS macOS-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS windows-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS macOS-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS windows-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS windows-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS windows-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS macOS-latest

'T' is already declared in the upper scope on line 133 column 2

Check warning on line 151 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS macOS-latest

'T' is already declared in the upper scope on line 133 column 2
metricsArr: Array<Object>,
metricsArr: Array<object>,
): Registry<T>; // TODO Promise?

/**
Expand Down Expand Up @@ -183,7 +183,7 @@
*/
export type Aggregator = 'omit' | 'sum' | 'first' | 'min' | 'max' | 'average';

export enum MetricType {

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS ubuntu-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS ubuntu-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS ubuntu-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS ubuntu-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS macOS-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS windows-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS macOS-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS windows-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS windows-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS windows-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS macOS-latest

'MetricType' is already declared in the upper scope on line 186 column 13

Check warning on line 186 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS macOS-latest

'MetricType' is already declared in the upper scope on line 186 column 13
Counter,
Gauge,
Histogram,
Expand Down Expand Up @@ -392,7 +392,7 @@
* @return Function to invoke when timer should be stopped. The value it
* returns is the timed duration.
*/
startTimer(labels?: LabelValues<T>): (labels?: LabelValues<T>) => number;

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS macOS-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS windows-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS macOS-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS windows-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS windows-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS windows-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS macOS-latest

'labels' is already declared in the upper scope on line 395 column 13

Check warning on line 395 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS macOS-latest

'labels' is already declared in the upper scope on line 395 column 13

/**
* Return the child for given labels
Expand Down Expand Up @@ -506,7 +506,7 @@
* @return Function to invoke when timer should be stopped. The value it
* returns is the timed duration.
*/
startTimer(labels?: LabelValues<T>): (labels?: LabelValues<T>) => number;

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS macOS-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS windows-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS macOS-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS windows-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS windows-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS windows-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS macOS-latest

'labels' is already declared in the upper scope on line 509 column 13

Check warning on line 509 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS macOS-latest

'labels' is already declared in the upper scope on line 509 column 13

/**
* Start a timer with exemplar. Calling the returned function will observe the duration in
Expand All @@ -519,7 +519,7 @@
startTimer(
labels?: LabelValues<T>,
exemplarLabels?: LabelValues<T>,
): (labels?: LabelValues<T>, exemplarLabels?: LabelValues<T>) => number;

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS ubuntu-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS ubuntu-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS ubuntu-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS ubuntu-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS macOS-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS macOS-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS windows-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS windows-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS macOS-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS macOS-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS windows-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS windows-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS windows-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS windows-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS windows-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS windows-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS macOS-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS macOS-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS macOS-latest

'labels' is already declared in the upper scope on line 520 column 3

Check warning on line 522 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS macOS-latest

'exemplarLabels' is already declared in the upper scope on line 521 column 3

/**
* Reset histogram values
Expand Down Expand Up @@ -626,7 +626,7 @@
* @param labels Object with label keys and values
* @return Function to invoke when timer should be stopped
*/
startTimer(labels?: LabelValues<T>): (labels?: LabelValues<T>) => number;

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS ubuntu-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS macOS-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS windows-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS macOS-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS windows-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x and OS windows-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x and OS windows-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x and OS macOS-latest

'labels' is already declared in the upper scope on line 629 column 13

Check warning on line 629 in index.d.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x and OS macOS-latest

'labels' is already declared in the upper scope on line 629 column 13

/**
* Reset all values in the summary
Expand Down Expand Up @@ -770,7 +770,7 @@
prefix?: string;
gcDurationBuckets?: number[];
eventLoopMonitoringPrecision?: number;
labels?: Object;
labels?: object;
}

export const collectDefaultMetrics: {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading