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: implement ESLint rule to ensure consistent property ordering in config parameter definitions #6321

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,12 @@ module.exports = {
"@zwave-js/no-forbidden-imports": "error",
},
},
{
files: ["packages/config/config/devices/**/*.json"],
parser: "jsonc-eslint-parser",
rules: {
"@zwave-js/consistent-device-configs": "error",
},
},
],
};
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
"typescriptreact",
"jsonc"
],
"files.exclude": {
"node_modules/": true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"fs-extra": "^11.1.1",
"husky": "^8.0.3",
"json5": "^2.2.3",
"jsonc-eslint-parser": "^2.3.0",
"lint-staged": "^14.0.1",
"p-queue": "^7.4.1",
"reflect-metadata": "^0.1.13",
Expand Down
14 changes: 14 additions & 0 deletions packages/config/config/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Custom ESLint rules for device config files
*/

module.exports = {
root: true,
parser: "jsonc-eslint-parser",
plugins: [
"@zwave-js",
],
rules: {
"@zwave-js/consistent-device-config-property-order": "error",
}
};
4 changes: 2 additions & 2 deletions packages/config/config/devices/0x0000/yrl220.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
"#": "3",
"label": "Re-lock Time",
"description": "Time after unlocking that the device will lock",
"unit": "Seconds",
"valueSize": 1,
"unit": "Seconds",
"minValue": 5,
"maxValue": 255,
"defaultValue": 30,
Expand Down Expand Up @@ -109,8 +109,8 @@
"#": "7",
"label": "Shutdown Time",
"description": "Number of times the device is locked out after the invalid retries are exceeded",
"unit": "Seconds",
"valueSize": 1,
"unit": "Seconds",
"minValue": 1,
"maxValue": 255,
"defaultValue": 30,
Expand Down
4 changes: 2 additions & 2 deletions packages/config/config/devices/0x0005/pe653.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
"#": "2[0xff00]",
"label": "Heater Cooldown Period",
"valueSize": 2,
"unit": "minutes",
"minValue": -1,
"maxValue": 15,
"defaultValue": -1,
"unit": "minutes",
"options": [
{
"label": "No heater installed",
Expand All @@ -100,9 +100,9 @@
"#": "3[0xff000000]",
"label": "Water Temperature Offset",
"valueSize": 4,
"unit": "°F",
"minValue": -5,
"maxValue": 5,
"unit": "°F",
"defaultValue": 0
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/config/config/devices/0x000c/hs-fls100.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"label": "Light Level Threshold",
"description": "Activate floodlight and send Basic Set Command when PIR is triggered while light level is below this threshold.",
"valueSize": 2,
"unit": "lux",
"minValue": 0,
"maxValue": 255,
"defaultValue": 50,
"unsigned": true,
"unit": "lux",
"options": [
{
"label": "Never turn on floodlight",
Expand Down
6 changes: 3 additions & 3 deletions packages/config/config/devices/0x000c/hs-hsm200.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
{
"#": "1",
"label": "Off Delay After Motion",
"unit": "minutes",
"valueSize": 1,
"unit": "minutes",
"minValue": 0,
"maxValue": 127,
"defaultValue": 10,
Expand All @@ -53,8 +53,8 @@
{
"#": "3",
"label": "Light Level Report Interval",
"unit": "minutes",
"valueSize": 1,
"unit": "minutes",
"minValue": 0,
"maxValue": 255,
"defaultValue": 60,
Expand All @@ -69,8 +69,8 @@
{
"#": "4",
"label": "Temperature Report Interval",
"unit": "minutes",
"valueSize": 1,
"unit": "minutes",
"minValue": 0,
"maxValue": 255,
"defaultValue": 60,
Expand Down
6 changes: 3 additions & 3 deletions packages/config/config/devices/0x001a/rf9617.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
{
"#": "1",
"label": "Delayed Off Time",
"unit": "sec",
"valueSize": 1,
"unit": "sec",
"minValue": 0,
"maxValue": 127,
"defaultValue": 0
},
{
"#": "2",
"label": "Panic On Time",
"unit": "sec",
"valueSize": 1,
"unit": "sec",
"minValue": 0,
"maxValue": 127,
"defaultValue": 0
},
{
"#": "3",
"label": "Panic Off Time",
"unit": "sec",
"valueSize": 1,
"unit": "sec",
"minValue": 0,
"maxValue": 127,
"defaultValue": 0
Expand Down
6 changes: 3 additions & 3 deletions packages/config/config/devices/0x001a/rf9642.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
{
"#": "2",
"label": "Panic On Time",
"unit": "sec",
"valueSize": 1,
"unit": "sec",
"minValue": 0,
"maxValue": 255,
"defaultValue": 0,
Expand All @@ -36,8 +36,8 @@
{
"#": "3",
"label": "Panic Off",
"unit": "sec",
"valueSize": 1,
"unit": "sec",
"minValue": 0,
"maxValue": 255,
"defaultValue": 0,
Expand Down Expand Up @@ -84,8 +84,8 @@
{
"#": "7",
"label": "Dimmer Ramp Time",
"unit": "sec",
"valueSize": 1,
"unit": "sec",
"minValue": 0,
"maxValue": 255,
"defaultValue": 3,
Expand Down
6 changes: 3 additions & 3 deletions packages/config/config/devices/0x001e/ezmultipli.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
{
"#": "1",
"label": "OnTime",
"unit": "Minutes",
"valueSize": 1,
"unit": "Minutes",
"minValue": 0,
"maxValue": 127,
"defaultValue": 10
Expand All @@ -49,8 +49,8 @@
{
"#": "3",
"label": "LiteMin",
"unit": "Minutes",
"valueSize": 1,
"unit": "Minutes",
"minValue": 0,
"maxValue": 127,
"defaultValue": 60
Expand All @@ -59,8 +59,8 @@
"#": "4",
"label": "TempMin",
"description": "A Temperature report is sent to the controller every TempMin minutes.",
"unit": "Minutes",
"valueSize": 1,
"unit": "Minutes",
"minValue": 0,
"maxValue": 127,
"defaultValue": 60
Expand Down
24 changes: 12 additions & 12 deletions packages/config/config/devices/0x003b/be468zp.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,35 @@
"valueSize": 4,
"minValue": 0,
"maxValue": 0,
"readOnly": true,
"unsigned": true
"unsigned": true,
"readOnly": true
},
{
"#": "12",
"label": "Get Electronic Transition Count",
"valueSize": 4,
"minValue": 0,
"maxValue": 0,
"readOnly": true,
"unsigned": true
"unsigned": true,
"readOnly": true
},
{
"#": "13",
"label": "Get Mechanical Transition Count",
"valueSize": 4,
"minValue": 0,
"maxValue": 0,
"readOnly": true,
"unsigned": true
"unsigned": true,
"readOnly": true
},
{
"#": "14",
"label": "Get Electronic Failed Count",
"valueSize": 4,
"minValue": 0,
"maxValue": 0,
"readOnly": true,
"unsigned": true
"unsigned": true,
"readOnly": true
},
{
"#": "15",
Expand Down Expand Up @@ -142,17 +142,17 @@
"valueSize": 4,
"minValue": 0,
"maxValue": 0,
"readOnly": true,
"unsigned": true
"unsigned": true,
"readOnly": true
},
{
"#": "18",
"label": "Get Bootloader Version",
"valueSize": 1,
"minValue": 0,
"maxValue": 0,
"readOnly": true,
"unsigned": true
"unsigned": true,
"readOnly": true
}
],
"metadata": {
Expand Down
4 changes: 2 additions & 2 deletions packages/config/config/devices/0x003b/s-6500f.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"minValue": 0,
"maxValue": 255,
"defaultValue": 1,
"readOnly": true,
"unsigned": true
"unsigned": true,
"readOnly": true
}
],
"metadata": {
Expand Down
4 changes: 2 additions & 2 deletions packages/config/config/devices/0x0059/ses_302.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
{
"#": "1",
"label": "Temperature Reporting Threshold",
"unit": "0.1 °C",
"valueSize": 1,
"unit": "0.1 °C",
"minValue": 0,
"maxValue": 255,
"defaultValue": 0,
Expand All @@ -36,8 +36,8 @@
{
"#": "2",
"label": "Temperature Reporting Interval",
"unit": "minutes",
"valueSize": 1,
"unit": "minutes",
"minValue": 0,
"maxValue": 255,
"defaultValue": 5,
Expand Down
8 changes: 4 additions & 4 deletions packages/config/config/devices/0x0059/ses_303.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
{
"#": "1",
"label": "Temperature Reporting Threshold",
"unit": "0.1 °C",
"valueSize": 1,
"unit": "0.1 °C",
"minValue": 0,
"maxValue": 255,
"defaultValue": 0,
Expand All @@ -27,8 +27,8 @@
{
"#": "2",
"label": "Temperature Reporting Interval",
"unit": "minutes",
"valueSize": 1,
"unit": "minutes",
"minValue": 0,
"maxValue": 255,
"defaultValue": 5,
Expand All @@ -37,8 +37,8 @@
{
"#": "3",
"label": "Humidity Reporting Threshold",
"unit": "0.1 %rH",
"valueSize": 1,
"unit": "0.1 %rH",
"minValue": 0,
"maxValue": 255,
"defaultValue": 5,
Expand All @@ -47,8 +47,8 @@
{
"#": "4",
"label": "Humidity Reporting Interval",
"unit": "minutes",
"valueSize": 1,
"unit": "minutes",
"minValue": 0,
"maxValue": 255,
"defaultValue": 5,
Expand Down
Loading