From fa8baf177c5691312128077deb9299a44a7e2f42 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 1 Nov 2024 17:17:56 +0100 Subject: [PATCH] refactor: silence linter warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- scripts/bundle.js | 2 +- src/charging-station/ChargingStation.ts | 6 ++++-- src/charging-station/ocpp/OCPPServiceUtils.ts | 6 ++++-- tests/charging-station/Helpers.test.ts | 2 +- tests/utils/ConfigurationUtils.test.ts | 2 +- tests/utils/ErrorUtils.test.ts | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/bundle.js b/scripts/bundle.js index 35caeb57..66fbb003 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -1,9 +1,9 @@ +import { env } from 'node:process' /* eslint-disable n/no-unpublished-import */ import chalk from 'chalk' import { build } from 'esbuild' import { clean } from 'esbuild-plugin-clean' import { copy } from 'esbuild-plugin-copy' -import { env } from 'node:process' const isDevelopmentBuild = env.BUILD === 'development' const sourcemap = !!isDevelopmentBuild diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 5e0640b6..5757e47d 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1059,8 +1059,10 @@ export class ChargingStation extends EventEmitter { this, this.stationInfo.amperageLimitationOcppKey, // prettier-ignore - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - (this.stationInfo.maximumAmperage! * getAmperageLimitationUnitDivider(this.stationInfo)).toString() + ( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.stationInfo.maximumAmperage! * getAmperageLimitationUnitDivider(this.stationInfo) + ).toString() ) } if (getConfigurationKey(this, StandardParametersKey.SupportedFeatureProfiles) == null) { diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index 6f54853f..226bffb2 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -1154,8 +1154,10 @@ const getLimitFromSampledValueTemplateCustomValue = ( minLimit ) } - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return (!isNaN(parsedValue) ? parsedValue : options.fallbackValue!) * options.unitMultiplier! + return ( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + (!Number.isNaN(parsedValue) ? parsedValue : options.fallbackValue!) * options.unitMultiplier! + ) } const getSampledValueTemplate = ( diff --git a/tests/charging-station/Helpers.test.ts b/tests/charging-station/Helpers.test.ts index 9d1df21b..32c9e333 100644 --- a/tests/charging-station/Helpers.test.ts +++ b/tests/charging-station/Helpers.test.ts @@ -1,6 +1,6 @@ +import { describe, it } from 'node:test' /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { expect } from 'expect' -import { describe, it } from 'node:test' import type { ChargingStation } from '../../src/charging-station/index.js' diff --git a/tests/utils/ConfigurationUtils.test.ts b/tests/utils/ConfigurationUtils.test.ts index 23f6c5ac..a8c6d177 100644 --- a/tests/utils/ConfigurationUtils.test.ts +++ b/tests/utils/ConfigurationUtils.test.ts @@ -1,6 +1,6 @@ +import { describe, it } from 'node:test' /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { expect } from 'expect' -import { describe, it } from 'node:test' import { FileType } from '../../src/types/index.js' import { handleFileException, logPrefix } from '../../src/utils/ConfigurationUtils.js' diff --git a/tests/utils/ErrorUtils.test.ts b/tests/utils/ErrorUtils.test.ts index b05eec74..ff7cd5a7 100644 --- a/tests/utils/ErrorUtils.test.ts +++ b/tests/utils/ErrorUtils.test.ts @@ -1,6 +1,6 @@ +import { describe, it } from 'node:test' /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { expect } from 'expect' -import { describe, it } from 'node:test' import type { ChargingStation } from '../../src/charging-station/index.js' -- 2.34.1