Skip to content

Commit e7bc53c

Browse files
authored
fix(build): Fix linting issue and add linting to the pre-push hook (#440)
1 parent b1997af commit e7bc53c

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

Diff for: .husky/pre-push

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4+
npm run lerna-lint
45
npm run test

Diff for: packages/metrics/src/Metrics.ts

+21-21
Original file line numberDiff line numberDiff line change
@@ -281,27 +281,6 @@ class Metrics implements MetricsInterface {
281281
this.storedMetrics = {};
282282
}
283283

284-
/**
285-
* Throw an Error if the metrics buffer is empty.
286-
*
287-
* @example
288-
*
289-
* ```typescript
290-
* import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
291-
* import { Context } from 'aws-lambda';
292-
*
293-
* const metrics = new Metrics({namespace:"serverlessAirline", serviceName:"orders"});
294-
*
295-
* export const handler = async (event: any, context: Context) => {
296-
* metrics.throwOnEmptyMetrics();
297-
* metrics.publishStoredMetrics(); // will throw since no metrics added.
298-
* }
299-
* ```
300-
*/
301-
public throwOnEmptyMetrics(): void {
302-
this.shouldThrowOnEmptyMetrics = true;
303-
}
304-
305284
/**
306285
* Function to create the right object compliant with Cloudwatch EMF (Event Metric Format).
307286
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Specification.html for more details
@@ -386,6 +365,27 @@ class Metrics implements MetricsInterface {
386365
});
387366
}
388367

368+
/**
369+
* Throw an Error if the metrics buffer is empty.
370+
*
371+
* @example
372+
*
373+
* ```typescript
374+
* import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
375+
* import { Context } from 'aws-lambda';
376+
*
377+
* const metrics = new Metrics({namespace:"serverlessAirline", serviceName:"orders"});
378+
*
379+
* export const handler = async (event: any, context: Context) => {
380+
* metrics.throwOnEmptyMetrics();
381+
* metrics.publishStoredMetrics(); // will throw since no metrics added.
382+
* }
383+
* ```
384+
*/
385+
public throwOnEmptyMetrics(): void {
386+
this.shouldThrowOnEmptyMetrics = true;
387+
}
388+
389389
private getCurrentDimensionsCount(): number {
390390
return Object.keys(this.dimensions).length + Object.keys(this.defaultDimensions).length;
391391
}

0 commit comments

Comments
 (0)