Skip to content

Commit 93c1609

Browse files
committed
Code enhancements and bug fixes
### UPDATED - Package dependencies. - Re-configured ESLint linting options. - Report URL changed. - Minor changes to Config UI. - During try catch, caught error objects will now be checked before serializing. ### FIXED - Some types ended with `,` instead of `;`. - Some types did not properly separated with `:`. - Imports for React components should not end with `.js` file extension. - The form select for setup verification method is missing the `key` prop. ### ADDED - Security panel support for "DSC Impassa/SCW". - Package version in title when debug information is sent to plugin author.
1 parent 3dfcc8b commit 93c1609

26 files changed

+1275
-783
lines changed

.eslintrc.json

Lines changed: 0 additions & 143 deletions
This file was deleted.

eslint.config.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import javascriptPlugin from '@eslint/js';
2+
import stylisticPlugin from '@stylistic/eslint-plugin';
3+
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
4+
import typescriptParser from '@typescript-eslint/parser';
5+
import importPlugin from 'eslint-plugin-import';
6+
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
7+
import reactPlugin from 'eslint-plugin-react';
8+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
9+
import globals from 'globals';
10+
11+
/**
12+
* ESLint config.
13+
*
14+
* @type {import('eslint').Linter.Config[]}
15+
*
16+
* @since 1.0.0
17+
*/
18+
const eslintConfig = [
19+
{
20+
name: 'preferred-rules',
21+
files: [
22+
'**/*.js',
23+
'**/*.mjs',
24+
'**/*.cjs',
25+
'**/*.jsx',
26+
'**/*.ts',
27+
'**/*.mts',
28+
'**/*.cts',
29+
'**/*.tsx',
30+
],
31+
languageOptions: {
32+
globals: {
33+
...globals.browser,
34+
...globals.node,
35+
NodeJS: 'readonly',
36+
},
37+
parser: typescriptParser,
38+
parserOptions: {
39+
ecmaFeatures: {
40+
jsx: true,
41+
},
42+
ecmaVersion: 'latest',
43+
project: './tsconfig.json',
44+
sourceType: 'module',
45+
},
46+
},
47+
plugins: {
48+
'@stylistic': stylisticPlugin,
49+
'@typescript-eslint': typescriptPlugin,
50+
'import': importPlugin,
51+
'jsx-a11y': jsxA11yPlugin,
52+
react: reactPlugin,
53+
'react-hooks': reactHooksPlugin,
54+
},
55+
settings: {
56+
'import/resolver': {
57+
typescript: {
58+
project: './tsconfig.json',
59+
},
60+
},
61+
react: {
62+
version: 'detect',
63+
},
64+
},
65+
rules: {
66+
...importPlugin.configs.recommended.rules,
67+
...javascriptPlugin.configs.recommended.rules,
68+
...jsxA11yPlugin.configs.recommended.rules,
69+
...reactPlugin.configs.recommended.rules,
70+
...reactHooksPlugin.configs.recommended.rules,
71+
...stylisticPlugin.configs['recommended-flat'].rules,
72+
...typescriptPlugin.configs.recommended.rules,
73+
'@stylistic/arrow-parens': ['error', 'always'],
74+
'@stylistic/brace-style': ['error', '1tbs'],
75+
'@stylistic/comma-dangle': ['error', 'always-multiline'],
76+
'@stylistic/member-delimiter-style': ['error', { singleline: { requireLast: true } }],
77+
'@stylistic/multiline-ternary': ['off'],
78+
'@stylistic/quote-props': ['error', 'as-needed'],
79+
'@stylistic/quotes': ['error', 'single'],
80+
'@stylistic/semi': ['error', 'always'],
81+
'@typescript-eslint/no-explicit-any': ['off'],
82+
'@typescript-eslint/no-unused-vars': ['error'],
83+
'import/order': ['error', { alphabetize: { order: 'asc' } }],
84+
'no-console': ['warn', { allow: ['error', 'info', 'warn'] }],
85+
'no-irregular-whitespace': ['error', { skipComments: true }],
86+
'no-unused-vars': ['off'],
87+
},
88+
},
89+
];
90+
91+
export default eslintConfig;

package.json

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "homebridge-adt-pulse",
33
"displayName": "Homebridge ADT Pulse",
4-
"version": "3.4.4",
4+
"version": "3.4.5",
55
"description": "Homebridge security system platform for ADT Pulse",
66
"main": "./build/index.js",
77
"exports": "./build/index.js",
@@ -66,49 +66,52 @@
6666
"node": ">=20"
6767
},
6868
"dependencies": {
69-
"@faker-js/faker": "9.2.0",
70-
"@homebridge/plugin-ui-utils": "1.0.3",
71-
"@hookform/resolvers": "3.9.1",
72-
"axios": "1.7.7",
73-
"axios-cookiejar-support": "5.0.3",
74-
"chalk": "5.3.0",
69+
"@faker-js/faker": "9.3.0",
70+
"@homebridge/plugin-ui-utils": "2.0.0",
71+
"@hookform/resolvers": "3.10.0",
72+
"axios": "1.7.9",
73+
"axios-cookiejar-support": "5.0.5",
74+
"chalk": "5.4.1",
7575
"jsdom": "25.0.1",
7676
"latest-version": "9.0.0",
7777
"lodash": "4.17.21",
7878
"luxon": "3.5.0",
79-
"react": "18.3.1",
80-
"react-dom": "18.3.1",
81-
"react-hook-form": "7.53.1",
79+
"react": "19.0.0",
80+
"react-dom": "19.0.0",
81+
"react-hook-form": "7.54.2",
8282
"semver": "7.6.3",
83-
"serialize-error": "11.0.3",
83+
"serialize-error": "12.0.0",
8484
"tough-cookie": "5.0.0",
85-
"ua-parser-js": "2.0.0-beta.3",
86-
"zod": "3.23.8"
85+
"ua-parser-js": "2.0.0",
86+
"zod": "3.24.1"
8787
},
8888
"devDependencies": {
89+
"@eslint/js": "9.17.0",
90+
"@stylistic/eslint-plugin": "2.12.1",
8991
"@types/jsdom": "21.1.7",
90-
"@types/lodash": "4.17.13",
92+
"@types/lodash": "4.17.14",
9193
"@types/luxon": "3.4.2",
92-
"@types/node": "22.9.0",
93-
"@types/react": "18.3.12",
94-
"@types/react-dom": "18.3.1",
94+
"@types/node": "22.10.5",
95+
"@types/react": "19.0.3",
96+
"@types/react-dom": "19.0.2",
9597
"@types/semver": "7.5.8",
9698
"@types/tough-cookie": "4.0.5",
97-
"@typescript-eslint/eslint-plugin": "7.17.0",
98-
"@typescript-eslint/parser": "7.17.0",
99-
"@vitejs/plugin-react": "4.3.3",
100-
"eslint": "8.56.0",
101-
"eslint-config-airbnb": "19.0.4",
102-
"eslint-config-airbnb-typescript": "18.0.0",
99+
"@typescript-eslint/eslint-plugin": "8.19.1",
100+
"@typescript-eslint/parser": "8.19.1",
101+
"@vitejs/plugin-react": "4.3.4",
102+
"eslint": "9.17.0",
103+
"eslint-import-resolver-typescript": "3.7.0",
103104
"eslint-plugin-import": "2.31.0",
104105
"eslint-plugin-jsx-a11y": "6.10.2",
105-
"eslint-plugin-react": "7.37.2",
106-
"homebridge": "1.8.4",
106+
"eslint-plugin-react": "7.37.3",
107+
"eslint-plugin-react-hooks": "5.1.0",
108+
"globals": "15.14.0",
109+
"homebridge": "1.8.5",
107110
"npm-run-all": "4.1.5",
108111
"rimraf": "6.0.1",
109112
"tsconfig-replace-paths": "0.0.14",
110-
"typescript": "5.5.4",
111-
"vite": "5.4.10",
112-
"vite-tsconfig-paths": "5.1.0"
113+
"typescript": "5.7.2",
114+
"vite": "6.0.7",
115+
"vite-tsconfig-paths": "5.1.4"
113116
}
114117
}

src/config-ui/server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { HomebridgePluginUiServer, RequestError } from '@homebridge/plugin-ui-utils';
22
import _ from 'lodash';
3-
import { serializeError } from 'serialize-error';
3+
import { isErrorLike, serializeError } from 'serialize-error';
44

55
import { ADTPulseAuth } from '@/lib/auth.js';
66
import { configServerLogin, configServerRequestCode, configServerValidate } from '@/lib/schema.js';
@@ -223,7 +223,7 @@ class ADTPulseConfigServer extends HomebridgePluginUiServer {
223223
info: response.info,
224224
};
225225
} catch (error) {
226-
const serializedError = serializeError(error);
226+
const serializedError = (isErrorLike(error)) ? serializeError(error) : serializeError(new Error('Unknown error'));
227227

228228
debugLog(null, 'server.ts / ADTPulseConfigServer.requestCode()', 'error', 'Method encountered an error during execution');
229229

@@ -307,7 +307,7 @@ class ADTPulseConfigServer extends HomebridgePluginUiServer {
307307
info: null,
308308
};
309309
} catch (error) {
310-
const serializedError = serializeError(error);
310+
const serializedError = (isErrorLike(error)) ? serializeError(error) : serializeError(new Error('Unknown error'));
311311

312312
debugLog(null, 'server.ts / ADTPulseConfigServer.validate()', 'error', 'Method encountered an error during execution');
313313

@@ -386,7 +386,7 @@ class ADTPulseConfigServer extends HomebridgePluginUiServer {
386386
},
387387
};
388388
} catch (error) {
389-
const serializedError = serializeError(error);
389+
const serializedError = (isErrorLike(error)) ? serializeError(error) : serializeError(new Error('Unknown error'));
390390

391391
debugLog(null, 'server.ts / ADTPulseConfigServer.generateConfig()', 'error', 'Method encountered an error during execution');
392392

0 commit comments

Comments
 (0)