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 ESLint rule to enforce consistency in device config files and prevent some common errors #6345

Merged
merged 29 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
651248d
chore: forbid surrounding whitespace in config strings
AlCalzone Sep 29, 2023
c0bc439
fix(config): auto-remove surrounding whitespace
AlCalzone Sep 29, 2023
29b4c1f
chore: enforce title case for device descriptions
AlCalzone Sep 29, 2023
40cca3c
fix(config): apply fixes to device descriptions
AlCalzone Sep 29, 2023
4f31ac7
fix: some more exceptions
AlCalzone Sep 29, 2023
720b865
fix: convert to suggestion
AlCalzone Sep 29, 2023
172650b
chore: enforce param descriptions to be in Sentence case
AlCalzone Sep 29, 2023
e41916f
feat: sentence case (WIP)
AlCalzone Oct 4, 2023
31418fa
chore: lots of improvements
AlCalzone Oct 9, 2023
a50c320
fix: some low-hanging fruits
AlCalzone Oct 9, 2023
30a7902
fix: more low-hanging fruits
AlCalzone Oct 9, 2023
8557fa8
fix: more low-hanging fruits
AlCalzone Oct 10, 2023
f9c02b1
fix: more low-hanging fruits
AlCalzone Oct 10, 2023
03ad1c6
fix: more low-hanging fruits
AlCalzone Oct 10, 2023
4fbddb0
chore: enforce param labels to be Title Case and fix some occurences
AlCalzone Oct 10, 2023
8d64b19
chore: fix remaining occurences
AlCalzone Oct 10, 2023
ff84d47
chore: forbid The at label start, suffix at label end
AlCalzone Oct 10, 2023
7392250
chore: disallow "empty" param descriptions
AlCalzone Oct 10, 2023
e4b4c4c
fix: convert fixers to suggestions
AlCalzone Oct 10, 2023
c043472
chore: check that "seconds" is correct in units
AlCalzone Oct 10, 2023
a83bbd4
chore: check more units
AlCalzone Oct 10, 2023
758ded6
fix: support units with multipliers
AlCalzone Oct 10, 2023
82e15f4
chore: disallow punctuation before the first word
AlCalzone Oct 10, 2023
4b8889c
chore: forbid using "(default)" in labels and descriptions
AlCalzone Oct 10, 2023
d990e0f
chore: disallow option labels that start with their values
AlCalzone Oct 10, 2023
4d14a67
chore: split rules into multiple
AlCalzone Oct 11, 2023
a4302d1
chore: disallow punctuation at the end of option labels
AlCalzone Oct 11, 2023
986963a
Merge branch 'master' into eslint-check-labels
AlCalzone Oct 11, 2023
c6c0563
fix: broken config files
AlCalzone Oct 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 1 addition & 5 deletions packages/config/config/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,5 @@ module.exports = {
plugins: [
"@zwave-js",
],
rules: {
"@zwave-js/consistent-device-config-property-order": "error",
"@zwave-js/no-unnecessary-min-max-value": "error",
"@zwave-js/auto-unsigned": "error",
}
extends: "plugin:@zwave-js/config-files"
};
2 changes: 1 addition & 1 deletion packages/config/config/devices/0x0000/ps9ep.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manufacturer": "Sigma Designs (Former Zensys)",
"manufacturerId": "0x0000",
"label": "PS9EP",
"description": "Z-wave 9 channel_module",
"description": "Z-Wave 9 Channel_module",
"devices": [
{
"productType": "0x0003",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/config/devices/0x0000/sm-pz701u.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manufacturer": "Sigma Designs (Former Zensys)",
"manufacturerId": "0x0000",
"label": "SM-PZ701U",
"description": "Z-Wave power plug",
"description": "Z-Wave Power Plug",
"devices": [
{
"productType": "0x0003",
Expand Down
12 changes: 6 additions & 6 deletions packages/config/config/devices/0x0000/yrl220.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
{
"#": "2",
"label": "Auto Re-lock",
"label": "Auto Re-Lock",
"description": "When enabled, the unit will automatically re-lock",
"valueSize": 1,
"defaultValue": 0,
Expand All @@ -65,10 +65,10 @@
},
{
"#": "3",
"label": "Re-lock Time",
"label": "Re-Lock Time",
"description": "Time after unlocking that the device will lock",
"valueSize": 1,
"unit": "Seconds",
"unit": "seconds",
"minValue": 5,
"maxValue": 255,
"defaultValue": 30,
Expand Down Expand Up @@ -110,7 +110,7 @@
"label": "Shutdown Time",
"description": "Number of times the device is locked out after the invalid retries are exceeded",
"valueSize": 1,
"unit": "Seconds",
"unit": "seconds",
"minValue": 1,
"maxValue": 255,
"defaultValue": 30,
Expand All @@ -129,11 +129,11 @@
"value": 0
},
{
"label": "Vacation Mode",
"label": "Vacation mode",
"value": 1
},
{
"label": "Privacy Mode",
"label": "Privacy mode",
"value": 2
}
]
Expand Down
2 changes: 1 addition & 1 deletion packages/config/config/devices/0x0001/zrm230.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manufacturer": "HomePro",
"manufacturerId": "0x0001",
"label": "ZRM230",
"description": "Wall Switch/Transmitter (2-gang)",
"description": "Wall Switch/Transmitter (2-Gang)",
"devices": [
{
"productType": "0x524d",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/config/devices/0x0002/014g0210.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
{
"#": "3",
"label": "PWM period",
"label": "PWM Period",
"description": "Pulse-width modulation period",
"valueSize": 1,
"defaultValue": 2,
Expand Down
65 changes: 19 additions & 46 deletions packages/config/config/devices/0x0002/dthermz5.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manufacturer": "Danfoss",
"manufacturerId": "0x0002",
"label": "DTHERMZ5",
"description": "Z-Wave room sensor",
"description": "Z-Wave Room Sensor",
"devices": [
{
"productType": "0x0248",
Expand All @@ -17,16 +17,16 @@
"paramInformation": [
{
"#": "1",
"label": "Temperature Report threshold",
"label": "Temperature Report Threshold",
"valueSize": 2,
"minValue": 1,
"maxValue": 100,
"defaultValue": 5
},
{
"#": "2",
"label": "Set-point display resolution",
"description": "range from 0.1 to 10°C 1=0.1°C 100=10°C",
"label": "Set-Point Display Resolution",
"description": "range from 0.1 to 10 °C 1=0.1 °C 100=10 °C",
"valueSize": 2,
"unit": "°C",
"minValue": 1,
Expand All @@ -35,8 +35,8 @@
},
{
"#": "3",
"label": "Min Set-point and override limit",
"description": "from min 0°C to max setpoint override limit 0=0°C 40=40°C",
"label": "Min Set-Point and Override Limit",
"description": "from min 0 °C to max setpoint override limit 0=0 °C 40=40 °C",
"valueSize": 2,
"unit": "°C",
"minValue": 0,
Expand All @@ -45,8 +45,8 @@
},
{
"#": "4",
"label": "Max Set-point and override limit",
"description": "from min setpoint override limit to max 40°C 0=0°C 40=40°C",
"label": "Max Set-Point and Override Limit",
"description": "from min setpoint override limit to max 40 °C 0=0 °C 40=40 °C",
"valueSize": 2,
"unit": "°C",
"minValue": 0,
Expand All @@ -55,7 +55,7 @@
},
{
"#": "5",
"label": "LED Flash period",
"label": "LED Flash Period",
"description": "0 to 65535 seconds",
"valueSize": 4,
"unit": "seconds",
Expand All @@ -65,46 +65,19 @@
},
{
"#": "6",
"label": "Set-point control function",
"description": "0=Disabled 1=Enabled",
"valueSize": 1,
"unit": "int",
"defaultValue": 1,
"allowManualEntry": false,
"options": [
{
"label": "disabled",
"value": 0
},
{
"label": "enabled",
"value": 1
}
]
"$import": "~/templates/master_template.json#base_enable_disable",
"label": "Set-Point Control Function",
"defaultValue": 1
},
{
"#": "7",
"label": "Temporarily override scheduler",
"description": "0=Disabled 1=Enabled",
"valueSize": 1,
"unit": "int",
"defaultValue": 1,
"allowManualEntry": false,
"options": [
{
"label": "disabled",
"value": 0
},
{
"label": "enabled",
"value": 1
}
]
"$import": "~/templates/master_template.json#base_enable_disable",
"label": "Temporarily Override Scheduler",
"defaultValue": 1
},
{
"#": "8",
"label": "Set-point type in Thermostat_Setpoint_Reports",
"description": "1=Heating 2=Cooling 10=Auto Changeover",
"label": "Set-Point Type in Thermostat_Setpoint_Reports",
"valueSize": 1,
"defaultValue": 1,
"allowManualEntry": false,
Expand All @@ -125,7 +98,7 @@
},
{
"#": "9",
"label": "LED on time",
"label": "LED On Time",
"description": "1=100ms 5=500ms",
"valueSize": 2,
"minValue": 1,
Expand All @@ -134,7 +107,7 @@
},
{
"#": "10",
"label": "Number of LED flashes (duration)",
"label": "Number of LED Flashes (Duration)",
"description": "0 to 255",
"valueSize": 1,
"minValue": 0,
Expand All @@ -144,7 +117,7 @@
},
{
"#": "11",
"label": "LED color",
"label": "LED Color",
"description": "1=Green 2=Red",
"valueSize": 1,
"defaultValue": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manufacturer": "Danfoss",
"manufacturerId": "0x0002",
"label": "Keemple smart radiator",
"description": "Electronic radiator thermostat, intended for use with water based room radiators.",
"description": "Electronic Radiator Thermostat, Intended for Use with Water Based Room Radiators.",
"devices": [
{
"productType": "0x5fff",
Expand Down
61 changes: 18 additions & 43 deletions packages/config/config/devices/0x0002/mt_2649.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
"paramInformation": [
{
"#": "1",
"label": "Temperature Report threshold",
"label": "Temperature Report Threshold",
"valueSize": 2,
"minValue": 1,
"maxValue": 100,
"defaultValue": 5
},
{
"#": "2",
"label": "Set-point display resolution",
"description": "range from 0.1 to 10°C 1=0.1°C 100=10°C",
"label": "Set-Point Display Resolution",
"description": "range from 0.1 to 10 °C 1=0.1 °C 100=10 °C",
"valueSize": 2,
"unit": "°C",
"minValue": 1,
Expand All @@ -42,8 +42,8 @@
},
{
"#": "3",
"label": "Min Set-point and override limit",
"description": "from min 0°C to max setpoint override limit 0=0°C 40=40°C",
"label": "Min Set-Point and Override Limit",
"description": "from min 0 °C to max setpoint override limit 0=0 °C 40=40 °C",
"valueSize": 2,
"unit": "°C",
"minValue": 0,
Expand All @@ -52,8 +52,8 @@
},
{
"#": "4",
"label": "Max Set-point and override limit",
"description": "from min setpoint override limit to max 40°C 0=0°C 40=40°C",
"label": "Max Set-Point and Override Limit",
"description": "from min setpoint override limit to max 40 °C 0=0 °C 40=40 °C",
"valueSize": 2,
"unit": "°C",
"minValue": 0,
Expand All @@ -62,7 +62,7 @@
},
{
"#": "5",
"label": "LED Flash period",
"label": "LED Flash Period",
"description": "0 to 65535 seconds",
"valueSize": 4,
"unit": "seconds",
Expand All @@ -72,44 +72,19 @@
},
{
"#": "6",
"label": "Set-point control function",
"description": "0=Disabled 1=Enabled",
"valueSize": 1,
"defaultValue": 1,
"allowManualEntry": false,
"options": [
{
"label": "disabled",
"value": 0
},
{
"label": "enabled",
"value": 1
}
]
"$import": "~/templates/master_template.json#base_enable_disable",
"label": "Set-Point Control Function",
"defaultValue": 1
},
{
"#": "7",
"label": "Temporarily override scheduler",
"description": "0=Disabled 1=Enabled",
"valueSize": 1,
"defaultValue": 1,
"allowManualEntry": false,
"options": [
{
"label": "disabled",
"value": 0
},
{
"label": "enabled",
"value": 1
}
]
"$import": "~/templates/master_template.json#base_enable_disable",
"label": "Temporarily Override Scheduler",
"defaultValue": 1
},
{
"#": "8",
"label": "Set-point type in Thermostat_Setpoint_Reports",
"description": "1=Heating 2=Cooling 10=Auto Changeover",
"label": "Set-Point Type in Thermostat_Setpoint_Reports",
"valueSize": 1,
"defaultValue": 1,
"allowManualEntry": false,
Expand All @@ -130,7 +105,7 @@
},
{
"#": "9",
"label": "LED on time",
"label": "LED On Time",
"description": "1=100ms 5=500ms",
"valueSize": 2,
"minValue": 1,
Expand All @@ -139,7 +114,7 @@
},
{
"#": "10",
"label": "Number of LED flashes (duration)",
"label": "Number of LED Flashes (Duration)",
"description": "0 to 255",
"valueSize": 1,
"minValue": 0,
Expand All @@ -149,7 +124,7 @@
},
{
"#": "11",
"label": "LED color",
"label": "LED Color",
"description": "1=Green 2=Red",
"valueSize": 1,
"defaultValue": 1,
Expand Down
2 changes: 1 addition & 1 deletion packages/config/config/devices/0x0002/rxz.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manufacturer": "Danfoss",
"manufacturerId": "0x0002",
"label": "RXZ",
"description": "RF Relay switching unit",
"description": "RF Relay Switching Unit",
"devices": [
{
"productType": "0x8004",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/config/devices/0x0005/ha05.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manufacturer": "Intermatic",
"manufacturerId": "0x0005",
"label": "HA05",
"description": "Screw in lamp module",
"description": "Screw in Lamp Module",
"devices": [
{
"productType": "0x0005",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/config/devices/0x0005/ha18.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manufacturer": "Intermatic",
"manufacturerId": "0x0005",
"label": "HA18",
"description": "15-amp Wall Switch",
"description": "15-Amp Wall Switch",
"devices": [
{
"productType": "0x4841",
Expand Down
Loading