From 6f63db9c391772ed49025380d2778810270fea8c Mon Sep 17 00:00:00 2001 From: jsetton Date: Fri, 1 Dec 2023 18:44:44 -0500 Subject: [PATCH] Fix new prettier formatting errors Signed-off-by: jsetton --- lambda/alexa/smarthome/device/attributes/fanSpeed.js | 12 ++++++------ lambda/alexa/smarthome/handlers/channelController.js | 4 ++-- .../smarthome/handlers/colorTemperatureController.js | 4 ++-- lambda/alexa/smarthome/metadata.js | 4 ++-- lambda/alexa/smarthome/properties/generic.js | 4 ++-- lambda/alexa/smarthome/properties/mode.js | 8 ++++---- lambda/alexa/smarthome/properties/rangeValue.js | 8 ++++---- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lambda/alexa/smarthome/device/attributes/fanSpeed.js b/lambda/alexa/smarthome/device/attributes/fanSpeed.js index f0b8c303..5b49daa5 100644 --- a/lambda/alexa/smarthome/device/attributes/fanSpeed.js +++ b/lambda/alexa/smarthome/device/attributes/fanSpeed.js @@ -118,12 +118,12 @@ export default class FanSpeed extends DeviceAttribute { ...(level === 0 ? { 0: [AlexaAssetCatalog.VALUE_OFF] } : level === 1 - ? { 1: [AlexaAssetCatalog.VALUE_LOW, AlexaAssetCatalog.VALUE_MINIMUM] } - : level === Math.ceil(speedLevels / 2) - ? { [level]: [AlexaAssetCatalog.VALUE_MEDIUM] } - : level === speedLevels - ? { [level]: [AlexaAssetCatalog.VALUE_HIGH, AlexaAssetCatalog.VALUE_MAXIMUM] } - : {}) + ? { 1: [AlexaAssetCatalog.VALUE_LOW, AlexaAssetCatalog.VALUE_MINIMUM] } + : level === Math.ceil(speedLevels / 2) + ? { [level]: [AlexaAssetCatalog.VALUE_MEDIUM] } + : level === speedLevels + ? { [level]: [AlexaAssetCatalog.VALUE_HIGH, AlexaAssetCatalog.VALUE_MAXIMUM] } + : {}) }), {} ) diff --git a/lambda/alexa/smarthome/handlers/channelController.js b/lambda/alexa/smarthome/handlers/channelController.js index eea4abb4..f35c53e6 100644 --- a/lambda/alexa/smarthome/handlers/channelController.js +++ b/lambda/alexa/smarthome/handlers/channelController.js @@ -88,8 +88,8 @@ export default class ChannelController extends AlexaHandler { return new RegExp(`^${name}`, 'i').test(mapping); }) : supportsChannelNumber - ? channelNumber - : undefined; + ? channelNumber + : undefined; // Throw invalid value error if command not defined if (typeof command === 'undefined') { diff --git a/lambda/alexa/smarthome/handlers/colorTemperatureController.js b/lambda/alexa/smarthome/handlers/colorTemperatureController.js index e290e2ed..ac953b83 100644 --- a/lambda/alexa/smarthome/handlers/colorTemperatureController.js +++ b/lambda/alexa/smarthome/handlers/colorTemperatureController.js @@ -133,8 +133,8 @@ export default class ColorTemperatureController extends AlexaHandler { command = !isNaN(increment) ? clamp(parseInt(temperatureState) + (isIncreaseRequest ? -1 : 1) * increment, 0, 100) : isIncreaseRequest - ? ItemValue.DECREASE - : ItemValue.INCREASE; + ? ItemValue.DECREASE + : ItemValue.INCREASE; } else { // Increment current state by defined value as Number doesn't support IncreaseDecreaseType commands command = clamp( diff --git a/lambda/alexa/smarthome/metadata.js b/lambda/alexa/smarthome/metadata.js index 2c596766..a95ecd54 100644 --- a/lambda/alexa/smarthome/metadata.js +++ b/lambda/alexa/smarthome/metadata.js @@ -42,8 +42,8 @@ export default class AlexaMetadata { values: item.metadata?.alexa ? AlexaMetadata.convertValue(item.metadata.alexa.value, ParameterType.LIST) : item.tags && settings.runtime.version === '2' - ? item.tags - : [], + ? item.tags + : [], // Use item alexa metadata config if defined config: item.metadata?.alexa?.config || {}, // Add group config if defined diff --git a/lambda/alexa/smarthome/properties/generic.js b/lambda/alexa/smarthome/properties/generic.js index 0c1b99cc..f45aeeb2 100644 --- a/lambda/alexa/smarthome/properties/generic.js +++ b/lambda/alexa/smarthome/properties/generic.js @@ -146,8 +146,8 @@ export default class Generic extends DecoupleState { const capabilityNames = parameters[Parameter.CAPABILITY_NAMES] ? parameters[Parameter.CAPABILITY_NAMES] : metadata.isPartOfGroupEndpoint - ? [].concat(item.label, item.metadata?.synonyms?.value.split(',')) - : this.defaultCapabilityNames; + ? [].concat(item.label, item.metadata?.synonyms?.value.split(',')) + : this.defaultCapabilityNames; // Update capability names parameter removing duplicate and invalid labels parameters[Parameter.CAPABILITY_NAMES] = capabilityNames .filter((label) => typeof label === 'string') diff --git a/lambda/alexa/smarthome/properties/mode.js b/lambda/alexa/smarthome/properties/mode.js index 93619136..9ed11d1f 100644 --- a/lambda/alexa/smarthome/properties/mode.js +++ b/lambda/alexa/smarthome/properties/mode.js @@ -183,10 +183,10 @@ export default class Mode extends Generic { .map(([command, labels]) => [command, labels || this.defautCommandLabels[command]]) .reduce((modes, [command, labels]) => ({ ...modes, [command]: labels }), {}) : parameters[Parameter.SUPPORTED_MODES] - ? parameters[Parameter.SUPPORTED_MODES] - : item.stateDescription?.options - ? Object.fromEntries(item.stateDescription.options.map((option) => [option.value, option.label])) - : {}; + ? parameters[Parameter.SUPPORTED_MODES] + : item.stateDescription?.options + ? Object.fromEntries(item.stateDescription.options.map((option) => [option.value, option.label])) + : {}; // Update supported modes parameter, removing duplicate labels and entries with no valid labels, // and updating labels shortened format (e.g. Normal=:Cottons,Whites => Normal=Normal:Cottons,Whites=Whites) diff --git a/lambda/alexa/smarthome/properties/rangeValue.js b/lambda/alexa/smarthome/properties/rangeValue.js index 44f4b334..418047cd 100644 --- a/lambda/alexa/smarthome/properties/rangeValue.js +++ b/lambda/alexa/smarthome/properties/rangeValue.js @@ -175,8 +175,8 @@ export default class RangeValue extends Generic { const range = parameters[Parameter.SUPPORTED_RANGE] ? parameters[Parameter.SUPPORTED_RANGE] : item.stateDescription - ? [item.stateDescription.minimum, item.stateDescription.maximum, item.stateDescription.step] - : []; + ? [item.stateDescription.minimum, item.stateDescription.maximum, item.stateDescription.step] + : []; // Update supported range values if valid (min < max; max - min > prec), otherwise set to undefined parameters[Parameter.SUPPORTED_RANGE] = range[0] < range[1] && range[1] - range[0] > Math.abs(range[2]) ? range : undefined; @@ -188,8 +188,8 @@ export default class RangeValue extends Generic { const presets = parameters[Parameter.PRESETS] ? parameters[Parameter.PRESETS] : item.stateDescription?.options - ? Object.fromEntries(item.stateDescription.options.map((option) => [option.value, option.label])) - : {}; + ? Object.fromEntries(item.stateDescription.options.map((option) => [option.value, option.label])) + : {}; // Update presets parameter, removing duplicate labels and entries // with out of range values, not multiple of range precision, or with no valid labels parameters[Parameter.PRESETS] = Object.entries(presets)