Skip to content

Commit

Permalink
Fix new prettier formatting errors
Browse files Browse the repository at this point in the history
Signed-off-by: jsetton <[email protected]>
  • Loading branch information
jsetton committed Dec 1, 2023
1 parent 80cbc6a commit 6f63db9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions lambda/alexa/smarthome/device/attributes/fanSpeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] }
: {})
}),
{}
)
Expand Down
4 changes: 2 additions & 2 deletions lambda/alexa/smarthome/handlers/channelController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
4 changes: 2 additions & 2 deletions lambda/alexa/smarthome/handlers/colorTemperatureController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions lambda/alexa/smarthome/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lambda/alexa/smarthome/properties/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions lambda/alexa/smarthome/properties/mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions lambda/alexa/smarthome/properties/rangeValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 6f63db9

Please sign in to comment.