From 80fdae23680c53f7d2911f03249114842ae64687 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Sat, 17 Aug 2024 22:43:31 +0200 Subject: [PATCH 1/4] Migrate to eslint 9 --- .eslintignore | 3 - .eslintrc.js | 44 --- .github/workflows/update_deps.yml | 2 +- .prettierrc | 4 +- eslint.config.mjs | 32 ++ package-lock.json | 624 +++++++++++++----------------- package.json | 13 +- 7 files changed, 316 insertions(+), 406 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index d1db68674b..0000000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -src/lib -dist/ -test/ \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index f8b0e6511c..0000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,44 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - parserOptions: { - project: './tsconfig.json', - }, - plugins: ['@typescript-eslint', 'perfectionist'], - extends: ['plugin:@typescript-eslint/recommended', 'prettier'], - rules: { - '@typescript-eslint/await-thenable': 'error', - '@typescript-eslint/ban-ts-ignore': 'off', - '@typescript-eslint/explicit-function-return-type': 'error', - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-explicit-any': 'error', - '@typescript-eslint/no-unused-vars': 'error', - 'array-bracket-spacing': ['error', 'never'], - 'no-return-await': 'error', - 'object-curly-spacing': ['error', 'never'], - '@typescript-eslint/no-floating-promises': 'error', - 'perfectionist/sort-imports': [ - 'error', - { - groups: [ - 'type', - ['builtin', 'external'], - 'internal-type', - 'internal', - ['parent-type', 'sibling-type', 'index-type'], - ['parent', 'sibling', 'index'], - 'object', - 'unknown', - ], - customGroups: { - value: {}, - type: {}, - }, - newlinesBetween: 'always', - internalPattern: ['~/**'], - type: 'natural', - order: 'asc', - ignoreCase: false, - }, - ], - }, -}; diff --git a/.github/workflows/update_deps.yml b/.github/workflows/update_deps.yml index 6529c25a44..e1a1c9c56f 100644 --- a/.github/workflows/update_deps.yml +++ b/.github/workflows/update_deps.yml @@ -20,7 +20,7 @@ jobs: with: node-version: 20 cache: npm - - run: npx npm-check-updates -u -x eslint + - run: npx npm-check-updates -u - run: rm -f package-lock.json - run: npm install - uses: peter-evans/create-pull-request@v6 diff --git a/.prettierrc b/.prettierrc index 0267e1af9c..7414ca72f4 100644 --- a/.prettierrc +++ b/.prettierrc @@ -5,5 +5,7 @@ "printWidth": 150, "bracketSpacing": false, "endOfLine": "lf", - "tabWidth": 4 + "tabWidth": 4, + "importOrder": ["", "^node:", "", "", "", "^zigbee", "", "^[./]"], + "plugins": ["@ianvs/prettier-plugin-sort-imports"] } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..2d13fbf4dc --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,32 @@ +// @ts-check + +import eslint from '@eslint/js'; +import eslintConfigPrettier from 'eslint-config-prettier'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + { + languageOptions: { + parserOptions: { + project: './tsconfig.json', + }, + }, + rules: { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/ban-ts-comment': 'error', + '@typescript-eslint/explicit-function-return-type': 'error', + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-unused-vars': 'error', + 'array-bracket-spacing': ['error', 'never'], + 'no-return-await': 'error', + 'object-curly-spacing': ['error', 'never'], + '@typescript-eslint/no-floating-promises': 'error', + }, + }, + { + ignores: ['typedoc/', 'test/', 'dist/', '**/*.js', '**/*.mjs'], + }, + eslintConfigPrettier, +); diff --git a/package-lock.json b/package-lock.json index ee468e8bd6..f38d9c067e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,25 +24,26 @@ "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.3", "@babel/preset-typescript": "^7.24.7", + "@eslint/js": "^9.9.0", + "@ianvs/prettier-plugin-sort-imports": "^4.3.1", "@serialport/binding-mock": "^10.2.2", "@types/debounce": "^1.2.4", + "@types/eslint__js": "^8.42.3", "@types/jest": "^29.5.12", "@types/mz": "^2.7.8", "@types/nedb": "^1.8.16", "@types/node": "^22.2.0", - "@typescript-eslint/eslint-plugin": "^8.0.1", - "@typescript-eslint/parser": "^8.0.1", "babel-jest": "^29.7.0", - "eslint": "^8.57.0", + "eslint": "^9.9.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-perfectionist": "^3.1.3", "jest": "^29.7.0", "prettier": "^3.3.3", "regenerator-runtime": "^0.14.1", "typedoc": "^0.26.5", "typedoc-plugin-markdown": "^4.2.3", "typedoc-plugin-no-inherit": "^1.4.0", - "typescript": "^5.5.4" + "typescript": "^5.5.4", + "typescript-eslint": "^8.1.0" } }, "node_modules/@ampproject/remapping": { @@ -1970,17 +1971,52 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/@eslint/config-array": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.1.tgz", + "integrity": "sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==", + "dev": true, + "dependencies": { + "@eslint/object-schema": "^2.1.4", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", + "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", "dev": true, - "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", + "espree": "^10.0.1", + "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -1988,7 +2024,7 @@ "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -1998,31 +2034,25 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" + "dev": true }, "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -2033,7 +2063,6 @@ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, - "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -2046,7 +2075,6 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2054,67 +2082,22 @@ "node": "*" } }, - "node_modules/@eslint/eslintrc/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", - "deprecated": "Use @eslint/config-array instead", + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.9.0.tgz", + "integrity": "sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug==", "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" - }, "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/@eslint/object-schema": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", + "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, "engines": { - "node": "*" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@humanwhocodes/module-importer": { @@ -2131,13 +2114,53 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", - "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", - "deprecated": "Use @eslint/object-schema instead", + "node_modules/@humanwhocodes/retry": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", + "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", "dev": true, - "license": "BSD-3-Clause" + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@ianvs/prettier-plugin-sort-imports": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@ianvs/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.3.1.tgz", + "integrity": "sha512-ZHwbyjkANZOjaBm3ZosADD2OUYGFzQGxfy67HmGZU94mHqe7g1LCMA7YYKB1Cq+UTPCBqlAYapY0KXAjKEw8Sg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.24.0", + "@babel/generator": "^7.23.6", + "@babel/parser": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0", + "semver": "^7.5.2" + }, + "peerDependencies": { + "@vue/compiler-sfc": "2.7.x || 3.x", + "prettier": "2 || 3" + }, + "peerDependenciesMeta": { + "@vue/compiler-sfc": { + "optional": true + } + } + }, + "node_modules/@ianvs/prettier-plugin-sort-imports/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", @@ -3244,6 +3267,31 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/eslint": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.0.tgz", + "integrity": "sha512-gi6WQJ7cHRgZxtkQEoyHMppPjq9Kxo5Tjn2prSKDSmZrCz8TZ3jSRCeTJm+WoM+oB0WG37bRqLzaaU3q7JypGg==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint__js": { + "version": "8.42.3", + "resolved": "https://registry.npmjs.org/@types/eslint__js/-/eslint__js-8.42.3.tgz", + "integrity": "sha512-alfG737uhmPdnvkrLdZLcEKJ/B8s9Y4hrZ+YAdzUeoArBlSUERA2E87ROfOaS4jd/C45fzOoZzidLc1IPwLqOw==", + "dev": true, + "dependencies": { + "@types/eslint": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -3302,6 +3350,12 @@ "pretty-format": "^29.0.0" } }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, "node_modules/@types/mz": { "version": "2.7.8", "resolved": "https://registry.npmjs.org/@types/mz/-/mz-2.7.8.tgz", @@ -3364,17 +3418,16 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.0.1.tgz", - "integrity": "sha512-5g3Y7GDFsJAnY4Yhvk8sZtFfV6YNF2caLzjrRPUBzewjPCaj0yokePB4LJSobyCzGMzjZZYFbwuzbfDHlimXbQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.1.0.tgz", + "integrity": "sha512-LlNBaHFCEBPHyD4pZXb35mzjGkuGKXU5eeCA1SxvHfiRES0E82dOounfVpL4DCqYvJEKab0bZIA0gCRpdLKkCw==", "dev": true, - "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.0.1", - "@typescript-eslint/type-utils": "8.0.1", - "@typescript-eslint/utils": "8.0.1", - "@typescript-eslint/visitor-keys": "8.0.1", + "@typescript-eslint/scope-manager": "8.1.0", + "@typescript-eslint/type-utils": "8.1.0", + "@typescript-eslint/utils": "8.1.0", + "@typescript-eslint/visitor-keys": "8.1.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -3398,16 +3451,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.0.1.tgz", - "integrity": "sha512-5IgYJ9EO/12pOUwiBKFkpU7rS3IU21mtXzB81TNwq2xEybcmAZrE9qwDtsb5uQd9aVO9o0fdabFyAmKveXyujg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.1.0.tgz", + "integrity": "sha512-U7iTAtGgJk6DPX9wIWPPOlt1gO57097G06gIcl0N0EEnNw8RGD62c+2/DiP/zL7KrkqnnqF7gtFGR7YgzPllTA==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "8.0.1", - "@typescript-eslint/types": "8.0.1", - "@typescript-eslint/typescript-estree": "8.0.1", - "@typescript-eslint/visitor-keys": "8.0.1", + "@typescript-eslint/scope-manager": "8.1.0", + "@typescript-eslint/types": "8.1.0", + "@typescript-eslint/typescript-estree": "8.1.0", + "@typescript-eslint/visitor-keys": "8.1.0", "debug": "^4.3.4" }, "engines": { @@ -3427,14 +3479,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.0.1.tgz", - "integrity": "sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.1.0.tgz", + "integrity": "sha512-DsuOZQji687sQUjm4N6c9xABJa7fjvfIdjqpSIIVOgaENf2jFXiM9hIBZOL3hb6DHK9Nvd2d7zZnoMLf9e0OtQ==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.0.1", - "@typescript-eslint/visitor-keys": "8.0.1" + "@typescript-eslint/types": "8.1.0", + "@typescript-eslint/visitor-keys": "8.1.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3445,14 +3496,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.0.1.tgz", - "integrity": "sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.1.0.tgz", + "integrity": "sha512-oLYvTxljVvsMnldfl6jIKxTaU7ok7km0KDrwOt1RHYu6nxlhN3TIx8k5Q52L6wR33nOwDgM7VwW1fT1qMNfFIA==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.0.1", - "@typescript-eslint/utils": "8.0.1", + "@typescript-eslint/typescript-estree": "8.1.0", + "@typescript-eslint/utils": "8.1.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -3470,11 +3520,10 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.0.1.tgz", - "integrity": "sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.1.0.tgz", + "integrity": "sha512-q2/Bxa0gMOu/2/AKALI0tCKbG2zppccnRIRCW6BaaTlRVaPKft4oVYPp7WOPpcnsgbr0qROAVCVKCvIQ0tbWog==", "dev": true, - "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -3484,14 +3533,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.0.1.tgz", - "integrity": "sha512-8V9hriRvZQXPWU3bbiUV4Epo7EvgM6RTs+sUmxp5G//dBGy402S7Fx0W0QkB2fb4obCF8SInoUzvTYtc3bkb5w==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.1.0.tgz", + "integrity": "sha512-NTHhmufocEkMiAord/g++gWKb0Fr34e9AExBRdqgWdVBaKoei2dIyYKD9Q0jBnvfbEA5zaf8plUFMUH6kQ0vGg==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "8.0.1", - "@typescript-eslint/visitor-keys": "8.0.1", + "@typescript-eslint/types": "8.1.0", + "@typescript-eslint/visitor-keys": "8.1.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3517,7 +3565,6 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, - "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -3526,16 +3573,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.0.1.tgz", - "integrity": "sha512-CBFR0G0sCt0+fzfnKaciu9IBsKvEKYwN9UZ+eeogK1fYHg4Qxk1yf/wLQkLXlq8wbU2dFlgAesxt8Gi76E8RTA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.1.0.tgz", + "integrity": "sha512-ypRueFNKTIFwqPeJBfeIpxZ895PQhNyH4YID6js0UoBImWYoSjBsahUn9KMiJXh94uOjVBgHD9AmkyPsPnFwJA==", "dev": true, - "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.0.1", - "@typescript-eslint/types": "8.0.1", - "@typescript-eslint/typescript-estree": "8.0.1" + "@typescript-eslint/scope-manager": "8.1.0", + "@typescript-eslint/types": "8.1.0", + "@typescript-eslint/typescript-estree": "8.1.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3549,13 +3595,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.0.1.tgz", - "integrity": "sha512-W5E+o0UfUcK5EgchLZsyVWqARmsM7v54/qEq6PY3YI5arkgmCzHiuk0zKSJJbm71V0xdRna4BGomkCTXz2/LkQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.1.0.tgz", + "integrity": "sha512-ba0lNI19awqZ5ZNKh6wCModMwoZs457StTebQ0q1NP58zSi2F6MOZRXwfKZy+jB78JNJ/WH8GSh2IQNzXX8Nag==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.0.1", + "@typescript-eslint/types": "8.1.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -3566,19 +3611,11 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", - "dev": true, - "license": "ISC" - }, "node_modules/acorn": { "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, - "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -3591,7 +3628,6 @@ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, - "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } @@ -3601,7 +3637,6 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -3687,7 +3722,6 @@ "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -4423,7 +4457,6 @@ "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, - "license": "MIT", "dependencies": { "path-type": "^4.0.0" }, @@ -4443,19 +4476,6 @@ "node": ">=6" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/electron-to-chromium": { "version": "1.5.6", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.6.tgz", @@ -4527,42 +4547,37 @@ } }, "node_modules/eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.9.0.tgz", + "integrity": "sha512-JfiKJrbx0506OEerjK2Y1QlldtBxkAlLxT5OEcRF8uaQ86noDe2k31Vw9rnSWv+MXZHj7OOUV/dA0AhdLFcyvA==", "dev": true, - "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", + "@eslint-community/regexpp": "^4.11.0", + "@eslint/config-array": "^0.17.1", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "9.9.0", "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.3.0", "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", - "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", + "eslint-scope": "^8.0.2", + "eslint-visitor-keys": "^4.0.0", + "espree": "^10.1.0", + "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", @@ -4576,10 +4591,18 @@ "eslint": "bin/eslint.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, "node_modules/eslint-config-prettier": { @@ -4595,71 +4618,17 @@ "eslint": ">=7.0.0" } }, - "node_modules/eslint-plugin-perfectionist": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-perfectionist/-/eslint-plugin-perfectionist-3.1.3.tgz", - "integrity": "sha512-eFRkBvMnnHjle5MuqTzoTIukWIr7Gm2wXvhTj3HyT/ku2J5oj7quBRbvZ8iYkjPyUFBpir3ZBnVQ5vFYswvpQg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "^8.0.1", - "@typescript-eslint/utils": "^8.0.1", - "minimatch": "^10.0.1", - "natural-compare-lite": "^1.4.0" - }, - "engines": { - "node": "^18.0.0 || >=20.0.0" - }, - "peerDependencies": { - "astro-eslint-parser": "^1.0.2", - "eslint": ">=8.0.0", - "svelte": ">=3.0.0", - "svelte-eslint-parser": "^0.41.0", - "vue-eslint-parser": ">=9.0.0" - }, - "peerDependenciesMeta": { - "astro-eslint-parser": { - "optional": true - }, - "svelte": { - "optional": true - }, - "svelte-eslint-parser": { - "optional": true - }, - "vue-eslint-parser": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-perfectionist/node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz", + "integrity": "sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -4694,13 +4663,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/eslint/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" - }, "node_modules/eslint/node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4762,6 +4724,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint/node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -4792,22 +4766,6 @@ "node": ">=10.13.0" } }, - "node_modules/eslint/node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/eslint/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4818,19 +4776,6 @@ "node": ">=8" } }, - "node_modules/eslint/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/eslint/node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -4889,32 +4834,30 @@ "node": ">=8" } }, - "node_modules/eslint/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "node_modules/espree": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", + "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", "dev": true, - "license": "(MIT OR CC0-1.0)", + "dependencies": { + "acorn": "^8.12.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.0.0" + }, "engines": { - "node": ">=10" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://opencollective.com/eslint" } }, - "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -4952,7 +4895,6 @@ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" }, @@ -5041,7 +4983,6 @@ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dev": true, - "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -5088,16 +5029,15 @@ } }, "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, - "license": "MIT", "dependencies": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16.0.0" } }, "node_modules/fill-range": { @@ -5128,26 +5068,23 @@ } }, "node_modules/flat-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", - "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, - "license": "MIT", "dependencies": { "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" + "keyv": "^4.5.4" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16" } }, "node_modules/flatted": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/fs-readdir-recursive": { "version": "1.1.0", @@ -5305,7 +5242,6 @@ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, - "license": "MIT", "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", @@ -5326,7 +5262,6 @@ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -5342,8 +5277,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/has-flag": { "version": "3.0.0", @@ -5400,7 +5334,6 @@ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, - "license": "MIT", "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -5417,7 +5350,6 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -7472,8 +7404,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", @@ -7486,8 +7417,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -7514,7 +7444,6 @@ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, - "license": "MIT", "dependencies": { "json-buffer": "3.0.1" } @@ -7692,7 +7621,6 @@ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 8" } @@ -7783,13 +7711,6 @@ "dev": true, "license": "MIT" }, - "node_modules/natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true, - "license": "MIT" - }, "node_modules/node-addon-api": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.0.0.tgz", @@ -7957,7 +7878,6 @@ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, - "license": "MIT", "dependencies": { "callsites": "^3.0.0" }, @@ -8026,7 +7946,6 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -8157,7 +8076,6 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } @@ -8380,23 +8298,6 @@ "node": ">=0.10.0" } }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -8850,7 +8751,6 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true, - "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -8859,6 +8759,29 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.1.0.tgz", + "integrity": "sha512-prB2U3jXPJLpo1iVLN338Lvolh6OrcCZO+9Yv6AR+tvegPPptYCDBIHiEEUdqRi8gAv2bXNKfMUrgAd2ejn/ow==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.1.0", + "@typescript-eslint/parser": "8.1.0", + "@typescript-eslint/utils": "8.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/uc.micro": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", @@ -8953,7 +8876,6 @@ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" } diff --git a/package.json b/package.json index 137d2cef3c..9a37822184 100644 --- a/package.json +++ b/package.json @@ -42,25 +42,26 @@ "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.3", "@babel/preset-typescript": "^7.24.7", + "@eslint/js": "^9.9.0", + "@ianvs/prettier-plugin-sort-imports": "^4.3.1", "@serialport/binding-mock": "^10.2.2", "@types/debounce": "^1.2.4", + "@types/eslint__js": "^8.42.3", "@types/jest": "^29.5.12", "@types/mz": "^2.7.8", "@types/nedb": "^1.8.16", "@types/node": "^22.2.0", - "@typescript-eslint/eslint-plugin": "^8.0.1", - "@typescript-eslint/parser": "^8.0.1", "babel-jest": "^29.7.0", - "eslint": "^8.57.0", + "eslint": "^9.9.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-perfectionist": "^3.1.3", "jest": "^29.7.0", "prettier": "^3.3.3", "regenerator-runtime": "^0.14.1", "typedoc": "^0.26.5", "typedoc-plugin-markdown": "^4.2.3", "typedoc-plugin-no-inherit": "^1.4.0", - "typescript": "^5.5.4" + "typescript": "^5.5.4", + "typescript-eslint": "^8.1.0" }, "homepage": "https://github.com/Koenkk/zigbee-herdsman", "keywords": [ @@ -84,7 +85,7 @@ "test": "jest test --silent --maxWorkers=50%", "test-with-coverage": "jest test --silent --maxWorkers=50% --coverage", "test-watch": "jest test --silent --maxWorkers=25% --watch", - "eslint": "eslint . --ext .ts --max-warnings=0", + "eslint": "eslint --max-warnings=0", "pretty:write": "prettier --write .", "pretty:check": "prettier --check .", "typedoc": "typedoc --gitRevision $(git describe --tag --abbrev=0) --tsconfig tsconfig.json --excludePrivate --excludeProtected --excludeExternals --entryPointStrategy expand ./src --sourceLinkTemplate 'https://github.com/Koenkk/zigbee-herdsman/blob/{gitRevision}/{path}#L{line}' -out typedoc", From 92fdb6ca28324ea2ba496e4c773ec7313084e83d Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Sat, 17 Aug 2024 22:59:57 +0200 Subject: [PATCH 2/4] Automatic changes --- src/adapter/adapter.ts | 3 +- src/adapter/deconz/adapter/deconzAdapter.ts | 22 +-- src/adapter/deconz/driver/driver.ts | 5 +- src/adapter/deconz/driver/frameParser.ts | 22 +-- src/adapter/deconz/driver/parser.ts | 4 +- src/adapter/deconz/driver/writer.ts | 5 +- src/adapter/ember/adapter/emberAdapter.ts | 41 ++--- src/adapter/ember/adapter/oneWaitress.ts | 1 + src/adapter/ember/adapter/tokensManager.ts | 3 +- src/adapter/ember/ezsp/buffalo.ts | 33 ++-- src/adapter/ember/ezsp/ezsp.ts | 131 +++++++------- src/adapter/ember/uart/ash.ts | 3 +- src/adapter/ember/uart/parser.ts | 1 + src/adapter/ember/uart/queues.ts | 1 + src/adapter/ember/uart/writer.ts | 1 + src/adapter/ember/utils/initters.ts | 3 +- src/adapter/ezsp/adapter/backup.ts | 3 +- src/adapter/ezsp/adapter/ezspAdapter.ts | 23 +-- src/adapter/ezsp/driver/commands.ts | 132 +++++++------- src/adapter/ezsp/driver/driver.ts | 29 ++-- src/adapter/ezsp/driver/ezsp.ts | 25 +-- src/adapter/ezsp/driver/frame.ts | 1 + src/adapter/ezsp/driver/multicast.ts | 1 + src/adapter/ezsp/driver/parser.ts | 1 + src/adapter/ezsp/driver/types/index.ts | 161 +++++++++--------- src/adapter/ezsp/driver/types/named.ts | 3 +- src/adapter/ezsp/driver/types/struct.ts | 3 +- src/adapter/ezsp/driver/uart.ts | 5 +- src/adapter/ezsp/driver/utils/crc16ccitt.ts | 3 +- src/adapter/ezsp/driver/utils/index.ts | 4 +- src/adapter/ezsp/driver/writer.ts | 1 + src/adapter/serialPort.ts | 2 +- src/adapter/z-stack/adapter/adapter-backup.ts | 2 +- .../z-stack/adapter/adapter-nv-memory.ts | 3 +- src/adapter/z-stack/adapter/manager.ts | 1 - src/adapter/z-stack/adapter/zStackAdapter.ts | 21 +-- .../structs/entries/address-manager-entry.ts | 1 + .../entries/aps-link-key-data-entry.ts | 1 + .../structs/entries/aps-tc-link-key-entry.ts | 1 + .../z-stack/structs/entries/channel-list.ts | 1 + .../z-stack/structs/entries/has-configured.ts | 1 + src/adapter/z-stack/structs/entries/nib.ts | 1 + .../structs/entries/nwk-key-descriptor.ts | 1 + .../z-stack/structs/entries/nwk-key.ts | 1 + .../z-stack/structs/entries/nwk-pan-id.ts | 1 + .../nwk-sec-material-descriptor-entry.ts | 1 + .../structs/entries/security-manager-entry.ts | 1 + .../structs/entries/security-manager-table.ts | 1 - src/adapter/z-stack/structs/struct.ts | 2 +- src/adapter/z-stack/structs/table.ts | 1 - src/adapter/z-stack/unpi/frame.ts | 2 +- src/adapter/z-stack/unpi/parser.ts | 2 +- src/adapter/z-stack/utils/network-options.ts | 1 - src/adapter/z-stack/znp/definition.ts | 2 +- src/adapter/z-stack/znp/znp.ts | 7 +- src/adapter/z-stack/znp/zpiObject.ts | 4 +- src/adapter/zigate/adapter/index.ts | 2 +- src/adapter/zigate/adapter/zigateAdapter.ts | 3 +- src/adapter/zigate/driver/buffaloZiGate.ts | 1 + src/adapter/zigate/driver/frame.ts | 1 + src/adapter/zigate/driver/ziGateObject.ts | 1 + src/adapter/zigate/driver/zigate.ts | 4 +- src/controller/controller.ts | 7 +- src/controller/index.ts | 1 + src/controller/model/device.ts | 2 +- src/utils/backup.ts | 4 +- src/utils/realpathSync.ts | 1 + src/zspec/zcl/definition/cluster.ts | 3 +- src/zspec/zcl/definition/foundation.ts | 3 +- src/zspec/zcl/definition/tstype.ts | 2 +- src/zspec/zcl/utils.ts | 2 +- src/zspec/zcl/zclFrame.ts | 4 +- src/zspec/zdo/buffaloZdo.ts | 82 ++++----- src/zspec/zdo/definition/tstypes.ts | 2 +- test/adapter/ember/ash.test.ts | 15 +- test/adapter/ember/emberAdapter.test.ts | 32 ++-- test/adapter/ember/ezsp.test.ts | 23 +-- test/adapter/ezsp/uart.test.ts | 7 +- test/adapter/z-stack/adapter.test.ts | 21 ++- test/adapter/z-stack/unpi.test.ts | 2 +- test/adapter/z-stack/znp.test.ts | 7 +- test/buffalo.test.ts | 1 + test/controller.test.ts | 28 +-- test/utils.test.ts | 3 +- test/zcl.test.ts | 3 +- test/zspec/zdo/buffalo.test.ts | 2 +- 86 files changed, 531 insertions(+), 474 deletions(-) diff --git a/src/adapter/adapter.ts b/src/adapter/adapter.ts index da24351b46..090d61ef03 100644 --- a/src/adapter/adapter.ts +++ b/src/adapter/adapter.ts @@ -1,6 +1,7 @@ -import Bonjour, {Service} from 'bonjour-service'; import events from 'events'; +import Bonjour, {Service} from 'bonjour-service'; + import * as Models from '../models'; import {logger} from '../utils/logger'; import {BroadcastAddress} from '../zspec/enums'; diff --git a/src/adapter/deconz/adapter/deconzAdapter.ts b/src/adapter/deconz/adapter/deconzAdapter.ts index c33cdac909..719aa544b1 100644 --- a/src/adapter/deconz/adapter/deconzAdapter.ts +++ b/src/adapter/deconz/adapter/deconzAdapter.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import assert from 'assert'; import Device from '../../../controller/model/device'; @@ -10,24 +11,23 @@ import * as Zcl from '../../../zspec/zcl'; import Adapter from '../../adapter'; import * as Events from '../../events'; import { - NetworkOptions, - SerialPortOptions, + ActiveEndpoints, + AdapterOptions, Coordinator, CoordinatorVersion, - NodeDescriptor, DeviceType, - ActiveEndpoints, - SimpleDescriptor, LQI, - RoutingTable, - NetworkParameters, - StartResult, LQINeighbor, + NetworkOptions, + NetworkParameters, + NodeDescriptor, + RoutingTable, RoutingTableEntry, - AdapterOptions, + SerialPortOptions, + SimpleDescriptor, + StartResult, } from '../../tstype'; -import PARAM from '../driver/constants'; -import {WaitForDataRequest, ApsDataRequest, ReceivedDataResponse, gpDataInd} from '../driver/constants'; +import PARAM, {ApsDataRequest, gpDataInd, ReceivedDataResponse, WaitForDataRequest} from '../driver/constants'; import Driver from '../driver/driver'; import processFrame, {frameParserEvents} from '../driver/frameParser'; diff --git a/src/adapter/deconz/driver/driver.ts b/src/adapter/deconz/driver/driver.ts index 9ed617992a..2d4a70839d 100644 --- a/src/adapter/deconz/driver/driver.ts +++ b/src/adapter/deconz/driver/driver.ts @@ -1,15 +1,16 @@ /* istanbul ignore file */ /* eslint-disable */ + import events from 'events'; import net from 'net'; + import slip from 'slip'; import {logger} from '../../../utils/logger'; import {SerialPort} from '../../serialPort'; import SerialPortUtils from '../../serialPortUtils'; import SocketPortUtils from '../../socketPortUtils'; -import PARAM from './constants'; -import {Request, parameterT, ApsDataRequest, ReceivedDataResponse} from './constants'; +import PARAM, {ApsDataRequest, parameterT, ReceivedDataResponse, Request} from './constants'; import {frameParserEvents} from './frameParser'; import Parser from './parser'; import Writer from './writer'; diff --git a/src/adapter/deconz/driver/frameParser.ts b/src/adapter/deconz/driver/frameParser.ts index 463a0f2dfc..74d6c169c6 100644 --- a/src/adapter/deconz/driver/frameParser.ts +++ b/src/adapter/deconz/driver/frameParser.ts @@ -1,23 +1,23 @@ /* istanbul ignore file */ + import {EventEmitter} from 'stream'; import {logger} from '../../../utils/logger'; -import PARAM from './constants'; -import { - Request, - ReceivedDataResponse, - DataStateResponse, +import PARAM, { Command, - ParamMac, - ParamPanId, - ParamNwkAddr, - ParamExtPanId, + DataStateResponse, + gpDataInd, ParamChannel, ParamChannelMask, + ParamExtPanId, + ParamMac, + ParamNwkAddr, + ParamPanId, ParamPermitJoin, - gpDataInd, + ReceivedDataResponse, + Request, } from './constants'; -import {busyQueue, apsBusyQueue, enableRTS, enableRtsTimeout} from './driver'; +import {apsBusyQueue, busyQueue, enableRTS, enableRtsTimeout} from './driver'; const NS = 'zh:deconz:frameparser'; diff --git a/src/adapter/deconz/driver/parser.ts b/src/adapter/deconz/driver/parser.ts index 2d06a5cbdf..0f5fd28949 100644 --- a/src/adapter/deconz/driver/parser.ts +++ b/src/adapter/deconz/driver/parser.ts @@ -1,7 +1,9 @@ /* istanbul ignore file */ -import slip from 'slip'; + import {Transform, TransformCallback} from 'stream'; +import slip from 'slip'; + import {logger} from '../../../utils/logger'; const NS = 'zh:deconz:driver:parser'; diff --git a/src/adapter/deconz/driver/writer.ts b/src/adapter/deconz/driver/writer.ts index 5e436b7b2b..1de397ec9c 100644 --- a/src/adapter/deconz/driver/writer.ts +++ b/src/adapter/deconz/driver/writer.ts @@ -1,10 +1,13 @@ /* istanbul ignore file */ /* eslint-disable */ + import * as stream from 'stream'; -import Frame from './frame'; + // @ts-ignore import slip from 'slip'; + import {logger} from '../../../utils/logger'; +import Frame from './frame'; const NS = 'zh:deconz:driver:writer'; diff --git a/src/adapter/ember/adapter/emberAdapter.ts b/src/adapter/ember/adapter/emberAdapter.ts index ef29f2c8c6..1422b43229 100644 --- a/src/adapter/ember/adapter/emberAdapter.ts +++ b/src/adapter/ember/adapter/emberAdapter.ts @@ -1,8 +1,9 @@ import {randomBytes} from 'crypto'; -import equals from 'fast-deep-equal/es6'; import {existsSync, readFileSync, renameSync} from 'fs'; import path from 'path'; +import equals from 'fast-deep-equal/es6'; + import {Adapter, TsType} from '../..'; import {Backup, UnifiedBackupStorage} from '../../../models'; import {BackupUtils, Queue, RealpathSync, Wait} from '../../../utils'; @@ -17,41 +18,41 @@ import {DeviceAnnouncePayload, DeviceJoinedPayload, DeviceLeavePayload, NetworkA import SerialPortUtils from '../../serialPortUtils'; import SocketPortUtils from '../../socketPortUtils'; import { + EMBER_HIGH_RAM_CONCENTRATOR, EMBER_INSTALL_CODE_CRC_SIZE, EMBER_INSTALL_CODE_SIZES, + EMBER_LOW_RAM_CONCENTRATOR, + EMBER_MIN_BROADCAST_ADDRESS, + INTERPAN_APS_FRAME_TYPE, + INVALID_RADIO_CHANNEL, LONG_DEST_FRAME_CONTROL, MAC_ACK_REQUIRED, MAXIMUM_INTERPAN_LENGTH, - STUB_NWK_FRAME_CONTROL, - INTERPAN_APS_FRAME_TYPE, + SECURITY_LEVEL_Z3, SHORT_DEST_FRAME_CONTROL, - EMBER_HIGH_RAM_CONCENTRATOR, - EMBER_LOW_RAM_CONCENTRATOR, STACK_PROFILE_ZIGBEE_PRO, - SECURITY_LEVEL_Z3, - INVALID_RADIO_CHANNEL, + STUB_NWK_FRAME_CONTROL, ZIGBEE_PROFILE_INTEROPERABILITY_LINK_KEY, - EMBER_MIN_BROADCAST_ADDRESS, } from '../consts'; import { EmberApsOption, - EmberOutgoingMessageType, - EzspStatus, - EmberVersionType, - SLStatus, - EmberNodeType, - EmberNetworkStatus, - SecManKeyType, - EmberInterpanMessageType, - EmberSourceRouteDiscoveryMode, - EmberJoinDecision, + EmberDeviceUpdate, EmberExtendedSecurityBitmask, + EmberIncomingMessageType, EmberInitialSecurityBitmask, + EmberInterpanMessageType, + EmberJoinDecision, EmberJoinMethod, EmberNetworkInitBitmask, - EmberDeviceUpdate, - EmberIncomingMessageType, + EmberNetworkStatus, + EmberNodeType, + EmberOutgoingMessageType, + EmberSourceRouteDiscoveryMode, EmberTransmitPriority, + EmberVersionType, + EzspStatus, + SecManKeyType, + SLStatus, } from '../enums'; import {EzspBuffalo} from '../ezsp/buffalo'; import {EMBER_ENCRYPTION_KEY_SIZE, EZSP_MIN_PROTOCOL_VERSION, EZSP_PROTOCOL_VERSION, EZSP_STACK_TYPE_MESH} from '../ezsp/consts'; diff --git a/src/adapter/ember/adapter/oneWaitress.ts b/src/adapter/ember/adapter/oneWaitress.ts index a5cd12d375..1199dded08 100644 --- a/src/adapter/ember/adapter/oneWaitress.ts +++ b/src/adapter/ember/adapter/oneWaitress.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import equals from 'fast-deep-equal/es6'; import {TOUCHLINK_PROFILE_ID} from '../../../zspec/consts'; diff --git a/src/adapter/ember/adapter/tokensManager.ts b/src/adapter/ember/adapter/tokensManager.ts index 7e64d5d8d4..e8c3ffaf0e 100644 --- a/src/adapter/ember/adapter/tokensManager.ts +++ b/src/adapter/ember/adapter/tokensManager.ts @@ -1,7 +1,8 @@ /* istanbul ignore file */ + import {logger} from '../../../utils/logger'; import {BLANK_EUI64} from '../../../zspec'; -import {SLStatus, SecManFlag, SecManKeyType} from '../enums'; +import {SecManFlag, SecManKeyType, SLStatus} from '../enums'; import {EMBER_ENCRYPTION_KEY_SIZE, EUI64_SIZE} from '../ezsp/consts'; import {EzspValueId} from '../ezsp/enums'; import {Ezsp} from '../ezsp/ezsp'; diff --git a/src/adapter/ember/ezsp/buffalo.ts b/src/adapter/ember/ezsp/buffalo.ts index 13bb0e5921..abe5e66ba1 100644 --- a/src/adapter/ember/ezsp/buffalo.ts +++ b/src/adapter/ember/ezsp/buffalo.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import Buffalo from '../../../buffalo/buffalo'; import {GP_SINK_LIST_ENTRIES} from '../consts'; import {EmberGpApplicationId, EmberGpSinkType, EzspStatus, SLStatus} from '../enums'; @@ -22,8 +23,8 @@ import { EmberInitialSecurityState, EmberKeyData, EmberMessageDigest, - EmberMultiPhyRadioParameters, EmberMulticastTableEntry, + EmberMultiPhyRadioParameters, EmberMultiprotocolPriorities, EmberNeighborTableEntry, EmberNetworkInitStruct, @@ -38,10 +39,10 @@ import { EmberSignature283k1Data, EmberSignatureData, EmberSmacData, - EmberTokTypeStackZllData, - EmberTokTypeStackZllSecurity, EmberTokenData, EmberTokenInfo, + EmberTokTypeStackZllData, + EmberTokTypeStackZllSecurity, EmberZigbeeNetwork, EmberZllAddressAssignment, EmberZllDeviceInfoRecord, @@ -55,29 +56,29 @@ import { } from '../types'; import {highByte} from '../utils/math'; import { - EMBER_ENCRYPTION_KEY_SIZE, - EMBER_CERTIFICATE_SIZE, - EMBER_PUBLIC_KEY_SIZE, - EMBER_PRIVATE_KEY_SIZE, - EMBER_SMAC_SIZE, - EMBER_SIGNATURE_SIZE, EMBER_AES_HASH_BLOCK_SIZE, EMBER_CERTIFICATE_283K1_SIZE, - EMBER_PUBLIC_KEY_283K1_SIZE, + EMBER_CERTIFICATE_SIZE, + EMBER_ENCRYPTION_KEY_SIZE, EMBER_PRIVATE_KEY_283K1_SIZE, + EMBER_PRIVATE_KEY_SIZE, + EMBER_PUBLIC_KEY_283K1_SIZE, + EMBER_PUBLIC_KEY_SIZE, EMBER_SIGNATURE_283K1_SIZE, + EMBER_SIGNATURE_SIZE, + EMBER_SMAC_SIZE, + EXTENDED_PAN_ID_SIZE, EZSP_EXTENDED_FRAME_CONTROL_HB_INDEX, - EZSP_EXTENDED_FRAME_FORMAT_VERSION_MASK, - EZSP_EXTENDED_FRAME_FORMAT_VERSION, EZSP_EXTENDED_FRAME_CONTROL_LB_INDEX, - EZSP_EXTENDED_PARAMETERS_INDEX, EZSP_EXTENDED_FRAME_CONTROL_RESERVED_MASK, + EZSP_EXTENDED_FRAME_FORMAT_VERSION, + EZSP_EXTENDED_FRAME_FORMAT_VERSION_MASK, + EZSP_EXTENDED_FRAME_ID_HB_INDEX, + EZSP_EXTENDED_FRAME_ID_LB_INDEX, + EZSP_EXTENDED_PARAMETERS_INDEX, EZSP_FRAME_CONTROL_INDEX, EZSP_FRAME_ID_INDEX, EZSP_PARAMETERS_INDEX, - EZSP_EXTENDED_FRAME_ID_HB_INDEX, - EZSP_EXTENDED_FRAME_ID_LB_INDEX, - EXTENDED_PAN_ID_SIZE, } from './consts'; import {EzspFrameID} from './enums'; diff --git a/src/adapter/ember/ezsp/ezsp.ts b/src/adapter/ember/ezsp/ezsp.ts index 4f7c992136..c69e240786 100644 --- a/src/adapter/ember/ezsp/ezsp.ts +++ b/src/adapter/ember/ezsp/ezsp.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import EventEmitter from 'events'; import {Queue} from '../../../utils'; @@ -24,119 +25,119 @@ import { STUB_NWK_SIZE, } from '../consts'; import { - EmberOutgoingMessageType, + EmberApsOption, EmberCounterType, + EmberDeviceUpdate, EmberDutyCycleState, EmberEntropySource, EmberEventUnits, + EmberExtendedSecurityBitmask, + EmberGpApplicationId, + EmberGpKeyType, + EmberGpSecurityLevel, + EmberGPStatus, + EmberIncomingMessageType, + EmberInterpanMessageType, + EmberJoinDecision, + EmberKeyStatus, + EmberLeaveNetworkOption, EmberLibraryId, EmberLibraryStatus, + EmberMacPassthroughType, EmberMultiPhyNwkConfig, EmberNetworkStatus, EmberNodeType, - EzspNetworkScanType, - EzspStatus, - SLStatus, - EmberIncomingMessageType, + EmberOutgoingMessageType, EmberSourceRouteDiscoveryMode, - EmberMacPassthroughType, - SecManKeyType, - EmberKeyStatus, - SecManFlag, - EmberDeviceUpdate, - EmberJoinDecision, - EzspZllNetworkOperation, - EmberGpSecurityLevel, - EmberGpKeyType, - EmberTXPowerMode, - EmberExtendedSecurityBitmask, EmberStackError, - EmberInterpanMessageType, - EmberGpApplicationId, - EmberLeaveNetworkOption, - EmberGPStatus, - EmberApsOption, EmberTransmitPriority, + EmberTXPowerMode, + EzspNetworkScanType, + EzspStatus, + EzspZllNetworkOperation, + SecManFlag, + SecManKeyType, + SLStatus, } from '../enums'; import {EzspError} from '../ezspError'; import { - EmberVersion, + EmberAesMmoHashContext, + EmberApsFrame, + EmberBeaconClassificationParams, EmberBeaconData, EmberBindingTableEntry, + EmberCertificate283k1Data, + EmberCertificateData, EmberChildData, + EmberCurrentSecurityState, EmberDutyCycleLimits, + EmberEndpointDescription, + EmberGpAddress, + EmberGpProxyTableEntry, + EmberGpSinkTableEntry, + EmberInitialSecurityState, + EmberKeyData, + EmberMessageDigest, + EmberMulticastTableEntry, EmberMultiPhyRadioParameters, + EmberMultiprotocolPriorities, EmberNeighborTableEntry, EmberNetworkInitStruct, EmberNetworkParameters, EmberPerDeviceDutyCycle, - EmberRouteTableEntry, - EmberApsFrame, - EmberMulticastTableEntry, - EmberBeaconClassificationParams, - EmberInitialSecurityState, - EmberCurrentSecurityState, - SecManContext, - SecManKey, - SecManNetworkKeyInfo, - SecManAPSKeyMetadata, - EmberKeyData, - EmberAesMmoHashContext, - EmberPublicKeyData, - EmberCertificateData, - EmberSmacData, + EmberPrivateKeyData, EmberPublicKey283k1Data, - EmberCertificate283k1Data, - EmberMessageDigest, - EmberSignatureData, + EmberPublicKeyData, + EmberRouteTableEntry, + EmberRxPacketInfo, EmberSignature283k1Data, - EmberPrivateKeyData, - EmberZllNetwork, - EmberZllInitialSecurityState, - EmberZllDeviceInfoRecord, - EmberZllAddressAssignment, + EmberSignatureData, + EmberSmacData, + EmberTokenData, + EmberTokenInfo, EmberTokTypeStackZllData, EmberTokTypeStackZllSecurity, - EmberGpAddress, - EmberGpProxyTableEntry, - EmberGpSinkTableEntry, - EmberTokenInfo, - EmberTokenData, + EmberVersion, EmberZigbeeNetwork, - EmberEndpointDescription, - EmberMultiprotocolPriorities, - EmberRxPacketInfo, + EmberZllAddressAssignment, + EmberZllDeviceInfoRecord, + EmberZllInitialSecurityState, + EmberZllNetwork, + SecManAPSKeyMetadata, + SecManContext, + SecManKey, + SecManNetworkKeyInfo, } from '../types'; import {UartAsh} from '../uart/ash'; import {initSecurityManagerContext} from '../utils/initters'; import {highByte, highLowToInt, lowByte} from '../utils/math'; import {EzspBuffalo} from './buffalo'; import { - EZSP_FRAME_CONTROL_ASYNCH_CB, - EZSP_FRAME_CONTROL_INDEX, - EZSP_MAX_FRAME_LENGTH, + EMBER_ENCRYPTION_KEY_SIZE, EZSP_EXTENDED_FRAME_CONTROL_HB_INDEX, EZSP_EXTENDED_FRAME_CONTROL_LB_INDEX, EZSP_EXTENDED_FRAME_FORMAT_VERSION, EZSP_EXTENDED_FRAME_ID_HB_INDEX, EZSP_EXTENDED_FRAME_ID_LB_INDEX, EZSP_EXTENDED_PARAMETERS_INDEX, + EZSP_FRAME_CONTROL_ASYNCH_CB, EZSP_FRAME_CONTROL_COMMAND, + EZSP_FRAME_CONTROL_DIRECTION_MASK, + EZSP_FRAME_CONTROL_INDEX, EZSP_FRAME_CONTROL_NETWORK_INDEX_MASK, EZSP_FRAME_CONTROL_NETWORK_INDEX_OFFSET, + EZSP_FRAME_CONTROL_OVERFLOW, + EZSP_FRAME_CONTROL_OVERFLOW_MASK, + EZSP_FRAME_CONTROL_PENDING_CB, + EZSP_FRAME_CONTROL_PENDING_CB_MASK, + EZSP_FRAME_CONTROL_RESPONSE, EZSP_FRAME_CONTROL_SLEEP_MODE_MASK, + EZSP_FRAME_CONTROL_TRUNCATED, + EZSP_FRAME_CONTROL_TRUNCATED_MASK, EZSP_FRAME_ID_INDEX, + EZSP_MAX_FRAME_LENGTH, EZSP_PARAMETERS_INDEX, EZSP_SEQUENCE_INDEX, - EZSP_FRAME_CONTROL_DIRECTION_MASK, - EZSP_FRAME_CONTROL_RESPONSE, - EZSP_FRAME_CONTROL_TRUNCATED_MASK, - EZSP_FRAME_CONTROL_TRUNCATED, - EZSP_FRAME_CONTROL_OVERFLOW_MASK, - EZSP_FRAME_CONTROL_OVERFLOW, - EZSP_FRAME_CONTROL_PENDING_CB_MASK, - EZSP_FRAME_CONTROL_PENDING_CB, - EMBER_ENCRYPTION_KEY_SIZE, } from './consts'; import { EmberLeaveReason, diff --git a/src/adapter/ember/uart/ash.ts b/src/adapter/ember/uart/ash.ts index 33b197d59a..b0d6c46613 100644 --- a/src/adapter/ember/uart/ash.ts +++ b/src/adapter/ember/uart/ash.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {Socket} from 'net'; import {EventEmitter} from 'stream'; @@ -8,7 +9,7 @@ import {SerialPort} from '../../serialPort'; import SocketPortUtils from '../../socketPortUtils'; import {SerialPortOptions} from '../../tstype'; import {EzspStatus} from '../enums'; -import {inc8, mod8, withinRange, halCommonCrc16} from '../utils/math'; +import {halCommonCrc16, inc8, mod8, withinRange} from '../utils/math'; import { ASH_ACKNUM_BIT, ASH_ACKNUM_MASK, diff --git a/src/adapter/ember/uart/parser.ts b/src/adapter/ember/uart/parser.ts index e00b62e8eb..86599beae4 100644 --- a/src/adapter/ember/uart/parser.ts +++ b/src/adapter/ember/uart/parser.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {Transform, TransformCallback, TransformOptions} from 'stream'; // import {logger} from '../../../utils/logger'; diff --git a/src/adapter/ember/uart/queues.ts b/src/adapter/ember/uart/queues.ts index c5ba12bfa3..251d7e9ed7 100644 --- a/src/adapter/ember/uart/queues.ts +++ b/src/adapter/ember/uart/queues.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {logger} from '../../../utils/logger'; import {EZSP_MAX_FRAME_LENGTH} from '../ezsp/consts'; diff --git a/src/adapter/ember/uart/writer.ts b/src/adapter/ember/uart/writer.ts index 06104a8d9a..a891fd480f 100644 --- a/src/adapter/ember/uart/writer.ts +++ b/src/adapter/ember/uart/writer.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {Readable, ReadableOptions} from 'stream'; // import {logger} from '../../../utils/logger'; diff --git a/src/adapter/ember/utils/initters.ts b/src/adapter/ember/utils/initters.ts index d827cb5e34..fd571a7755 100644 --- a/src/adapter/ember/utils/initters.ts +++ b/src/adapter/ember/utils/initters.ts @@ -1,7 +1,8 @@ /* istanbul ignore file */ + import * as ZSpec from '../../../zspec'; import {NetworkCache} from '../adapter/emberAdapter'; -import {ZB_PSA_ALG, INVALID_RADIO_CHANNEL} from '../consts'; +import {INVALID_RADIO_CHANNEL, ZB_PSA_ALG} from '../consts'; import {EmberJoinMethod, SecManDerivedKeyType, SecManFlag, SecManKeyType} from '../enums'; import {EMBER_AES_HASH_BLOCK_SIZE} from '../ezsp/consts'; import {EmberAesMmoHashContext, SecManContext} from '../types'; diff --git a/src/adapter/ezsp/adapter/backup.ts b/src/adapter/ezsp/adapter/backup.ts index 993c06997c..0338954406 100644 --- a/src/adapter/ezsp/adapter/backup.ts +++ b/src/adapter/ezsp/adapter/backup.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {fs} from 'mz'; import * as Models from '../../../models'; @@ -6,7 +7,7 @@ import {BackupUtils} from '../../../utils'; import {logger} from '../../../utils/logger'; import {uint32MaskToChannels} from '../../../zspec/utils'; import {Driver} from '../driver'; -import {EmberKeyType, EmberKeyStruct, EmberNetworkParameters, EmberSecurityManagerNetworkKeyInfo, EmberKeyData} from '../driver/types'; +import {EmberKeyData, EmberKeyStruct, EmberKeyType, EmberNetworkParameters, EmberSecurityManagerNetworkKeyInfo} from '../driver/types'; const NS = 'zh:ezsp:backup'; diff --git a/src/adapter/ezsp/adapter/ezspAdapter.ts b/src/adapter/ezsp/adapter/ezspAdapter.ts index 2f39827f39..7b9f703495 100644 --- a/src/adapter/ezsp/adapter/ezspAdapter.ts +++ b/src/adapter/ezsp/adapter/ezspAdapter.ts @@ -1,8 +1,9 @@ /* istanbul ignore file */ + import assert from 'assert'; import * as Models from '../../../models'; -import {Queue, Waitress, Wait, RealpathSync} from '../../../utils'; +import {Queue, RealpathSync, Wait, Waitress} from '../../../utils'; import {logger} from '../../../utils/logger'; import {BroadcastAddress} from '../../../zspec/enums'; import * as Zcl from '../../../zspec/zcl'; @@ -11,24 +12,24 @@ import * as Events from '../../events'; import SerialPortUtils from '../../serialPortUtils'; import SocketPortUtils from '../../socketPortUtils'; import { - NetworkOptions, - SerialPortOptions, + ActiveEndpoints, + AdapterOptions, Coordinator, CoordinatorVersion, - NodeDescriptor, - ActiveEndpoints, - SimpleDescriptor, LQI, - RoutingTable, - NetworkParameters, - StartResult, LQINeighbor, + NetworkOptions, + NetworkParameters, + NodeDescriptor, + RoutingTable, RoutingTableEntry, - AdapterOptions, + SerialPortOptions, + SimpleDescriptor, + StartResult, } from '../../tstype'; import {Driver, EmberIncomingMessage} from '../driver'; import {EZSPZDOResponseFrameData} from '../driver/ezsp'; -import {EmberZDOCmd, uint16_t, EmberEUI64, EmberStatus} from '../driver/types'; +import {EmberEUI64, EmberStatus, EmberZDOCmd, uint16_t} from '../driver/types'; const NS = 'zh:ezsp'; diff --git a/src/adapter/ezsp/driver/commands.ts b/src/adapter/ezsp/driver/commands.ts index 7e76bac4e5..566bd2a9d1 100644 --- a/src/adapter/ezsp/driver/commands.ts +++ b/src/adapter/ezsp/driver/commands.ts @@ -1,86 +1,82 @@ /* istanbul ignore file */ -import { - /* Basic Types */ - int8s, - uint8_t, - uint16_t, - uint32_t, - LVBytes, - fixed_list, - WordList, - /* Named Types */ - EmberNodeId, - EmberPanId, - EmberEUI64, - EmberLibraryStatus, - SecureEzspSecurityType, - SecureEzspSecurityLevel, - EmberGpSecurityLevel, - EmberGpKeyType, - SecureEzspRandomNumber, +import { Bool, - EzspConfigId, - EzspValueId, - EzspExtendedValueId, - EzspPolicyId, - EzspDecisionId, - EzspMfgTokenId, - EzspStatus, - EmberStatus, - EmberStackError, + EmberAesMmoHashContext, + EmberApsFrame, + EmberBindingTableEntry, + EmberCertificate283k1Data, + EmberCertificateData, + EmberCounterType, + EmberCurrentSecurityState, + EmberDeviceUpdate, + EmberEUI64, EmberEventUnits, - EmberNodeType, - EmberNetworkStatus, + EmberGpAddress, + EmberGpKeyType, + EmberGpSecurityLevel, EmberIncomingMessageType, - EmberOutgoingMessageType, - EmberMacPassthroughType, - EzspNetworkScanType, + EmberInitialSecurityState, EmberJoinDecision, - EmberKeyType, - EmberDeviceUpdate, + EmberKeyData, EmberKeyStatus, - EmberCounterType, - EzspZllNetworkOperation, - - /* Structs */ - EmberNetworkParameters, - EmberZigbeeNetwork, - EmberApsFrame, - EmberBindingTableEntry, + EmberKeyStruct, + EmberKeyType, + EmberLibraryStatus, + EmberMacPassthroughType, + EmberMessageDigest, + EmberMultiAddress, EmberMulticastTableEntry, - EmberKeyData, - EmberCertificateData, - EmberPublicKeyData, + EmberNeighbors, + EmberNeighborTableEntry, + EmberNetworkInitStruct /* Structs */, + EmberNetworkParameters, + EmberNetworkStatus, + EmberNodeDescriptor /* Named Types */, + EmberNodeId, + EmberNodeType, + EmberOutgoingMessageType, + EmberPanId, EmberPrivateKeyData, - EmberSmacData, - EmberSignatureData, - EmberCertificate283k1Data, EmberPublicKey283k1Data, - EmberSignature283k1Data, - EmberMessageDigest, - EmberAesMmoHashContext, - EmberNeighborTableEntry, + EmberPublicKeyData, EmberRouteTableEntry, - EmberInitialSecurityState, - EmberCurrentSecurityState, - EmberKeyStruct, - EmberNetworkInitStruct, - EmberZllNetwork, - EmberZllInitialSecurityState, - EmberZllDeviceInfoRecord, - EmberZllAddressAssignment, - EmberTokTypeStackZllData, - EmberTokTypeStackZllSecurity, - EmberGpAddress, - EmberNodeDescriptor, - EmberSimpleDescriptor, - EmberMultiAddress, - EmberNeighbors, EmberRoutingTable, EmberSecurityManagerContext, EmberSecurityManagerNetworkKeyInfo, + EmberSignature283k1Data, + EmberSignatureData, + EmberSimpleDescriptor, + EmberSmacData, + EmberStackError, + EmberStatus, + EmberTokTypeStackZllData, + EmberTokTypeStackZllSecurity, + EmberZigbeeNetwork, + EmberZllAddressAssignment, + EmberZllDeviceInfoRecord, + EmberZllInitialSecurityState, + EmberZllNetwork, + EzspConfigId, + EzspDecisionId, + EzspExtendedValueId, + EzspMfgTokenId, + EzspNetworkScanType, + EzspPolicyId, + EzspStatus, + EzspValueId, + EzspZllNetworkOperation, + fixed_list /* Basic Types */, + int8s, + LVBytes, + SecureEzspRandomNumber, + SecureEzspSecurityLevel, + SecureEzspSecurityType, SLStatus, + uint8_t, + uint16_t, + uint32_t, + WordList, } from './types'; export interface ParamsDesc { diff --git a/src/adapter/ezsp/driver/driver.ts b/src/adapter/ezsp/driver/driver.ts index 6dacef0534..c41cd3c4fa 100644 --- a/src/adapter/ezsp/driver/driver.ts +++ b/src/adapter/ezsp/driver/driver.ts @@ -1,8 +1,10 @@ /* istanbul ignore file */ + import {EventEmitter} from 'events'; + import equals from 'fast-deep-equal/es6'; -import {Waitress, Wait} from '../../../utils'; +import {Wait, Waitress} from '../../../utils'; import {logger} from '../../../utils/logger'; import {Clusters} from '../../../zspec/zcl/definition/cluster'; import {EZSPAdapterBackup} from '../adapter/backup'; @@ -10,30 +12,30 @@ import * as TsType from './../../tstype'; import {ParamsDesc} from './commands'; import {Ezsp, EZSPFrameData, EZSPZDOResponseFrameData} from './ezsp'; import {Multicast} from './multicast'; -import {EmberStatus, EmberNodeType, uint16_t, uint8_t, EmberZDOCmd, EmberApsOption, EmberKeyData, EmberJoinDecision} from './types'; +import {EmberApsOption, EmberJoinDecision, EmberKeyData, EmberNodeType, EmberStatus, EmberZDOCmd, uint8_t, uint16_t} from './types'; import { - EmberOutgoingMessageType, + EmberDerivedKeyType, + EmberDeviceUpdate, EmberEUI64, + EmberInitialSecurityBitmask, EmberJoinMethod, - EmberDeviceUpdate, - EzspValueId, - EzspPolicyId, - EzspDecisionBitmask, - EmberNetworkStatus, EmberKeyType, - EmberDerivedKeyType, + EmberNetworkStatus, + EmberOutgoingMessageType, EmberStackError, + EzspDecisionBitmask, + EzspPolicyId, + EzspValueId, SLStatus, - EmberInitialSecurityBitmask, } from './types/named'; import { + EmberAesMmoHashContext, EmberApsFrame, - EmberNetworkParameters, + EmberIeeeRawFrame, EmberInitialSecurityState, EmberKeyStruct, + EmberNetworkParameters, EmberRawFrame, - EmberIeeeRawFrame, - EmberAesMmoHashContext, EmberSecurityManagerContext, } from './types/struct'; import {ember_security} from './utils'; @@ -679,7 +681,6 @@ export class Driver extends EventEmitter { } } - /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ public async brequest(destination: number, apsFrame: EmberApsFrame, data: Buffer): Promise { try { const seq = (apsFrame.sequence + 1) & 0xff; diff --git a/src/adapter/ezsp/driver/ezsp.ts b/src/adapter/ezsp/driver/ezsp.ts index 4303970aec..26fcf7627a 100644 --- a/src/adapter/ezsp/driver/ezsp.ts +++ b/src/adapter/ezsp/driver/ezsp.ts @@ -1,29 +1,30 @@ /* istanbul ignore file */ + import {EventEmitter} from 'events'; -import {Queue, Waitress, Wait} from '../../../utils'; +import {Queue, Wait, Waitress} from '../../../utils'; import {logger} from '../../../utils/logger'; import {SerialPortOptions} from '../../tstype'; import { - FRAMES, - FRAME_NAMES_BY_ID, EZSPFrameDesc, + FRAME_NAMES_BY_ID, + FRAMES, ParamsDesc, - ZDOREQUESTS, ZDOREQUEST_NAME_BY_ID, - ZDORESPONSES, + ZDOREQUESTS, ZDORESPONSE_NAME_BY_ID, + ZDORESPONSES, } from './commands'; import * as t from './types'; import { - EmberStatus, - EmberOutgoingMessageType, - EzspPolicyId, - EzspDecisionId, - EzspDecisionBitmask, EmberConcentratorType, - EzspConfigId, + EmberOutgoingMessageType, + EmberStatus, EmberZdoConfigurationFlags, + EzspConfigId, + EzspDecisionBitmask, + EzspDecisionId, + EzspPolicyId, } from './types/named'; import {EmberApsFrame, EmberNetworkParameters} from './types/struct'; import {SerialDriver} from './uart'; @@ -314,7 +315,7 @@ export class EZSPZDOResponseFrameData { export class Ezsp extends EventEmitter { ezspV = 4; cmdSeq = 0; // command sequence - /* eslint-disable-next-line @typescript-eslint/no-explicit-any*/ + // COMMANDS_BY_ID = new Map(); private serialDriver: SerialDriver; private waitress: Waitress; diff --git a/src/adapter/ezsp/driver/frame.ts b/src/adapter/ezsp/driver/frame.ts index abb66c19b0..daf4a9762a 100644 --- a/src/adapter/ezsp/driver/frame.ts +++ b/src/adapter/ezsp/driver/frame.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {RANDOMIZE_SEQ, RANDOMIZE_START} from './consts'; import crc16ccitt from './utils/crc16ccitt'; diff --git a/src/adapter/ezsp/driver/multicast.ts b/src/adapter/ezsp/driver/multicast.ts index b962f3eff4..e6395a7a64 100644 --- a/src/adapter/ezsp/driver/multicast.ts +++ b/src/adapter/ezsp/driver/multicast.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {logger} from '../../../utils/logger'; import {Driver} from './driver'; import {EzspConfigId} from './types'; diff --git a/src/adapter/ezsp/driver/parser.ts b/src/adapter/ezsp/driver/parser.ts index f667a4fbcd..64e5137986 100644 --- a/src/adapter/ezsp/driver/parser.ts +++ b/src/adapter/ezsp/driver/parser.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import * as stream from 'stream'; import {logger} from '../../../utils/logger'; diff --git a/src/adapter/ezsp/driver/types/index.ts b/src/adapter/ezsp/driver/types/index.ts index 0c7b9101af..68153e2363 100644 --- a/src/adapter/ezsp/driver/types/index.ts +++ b/src/adapter/ezsp/driver/types/index.ts @@ -1,107 +1,108 @@ /* istanbul ignore file */ -import {int8s, uint_t, uint8_t, uint16_t, uint24_t, uint32_t, uint64_t, LVBytes, list, LVList, fixed_list, WordList, Bytes} from './basic'; + +import {Bytes, fixed_list, int8s, list, LVBytes, LVList, uint_t, uint8_t, uint16_t, uint24_t, uint32_t, uint64_t, WordList} from './basic'; import { - NcpResetCode, - EmberRf4ceTxOption, - EmberRf4ceNodeCapabilities, - EmberRf4ceApplicationCapabilities, - EmberNodeId, - EmberPanId, - EmberMulticastId, - EmberEUI64, - EmberLibraryStatus, - SecureEzspSecurityType, - SecureEzspSecurityLevel, - EmberGpSecurityLevel, - EmberGpKeyType, - SecureEzspRandomNumber, - SecureEzspSessionId, Bool, - EzspConfigId, - EzspValueId, - EzspExtendedValueId, - EzspEndpointFlags, + EmberApsOption, + EmberBindingType, + EmberConcentratorType, EmberConfigTxPowerMode, - EzspPolicyId, - EzspDecisionId, - EzspMfgTokenId, - EzspStatus, - EmberStatus, - SLStatus, - EmberStackError, + EmberCounterType, + EmberCurrentSecurityBitmask, + EmberDerivedKeyType, + EmberDeviceUpdate, + EmberEUI64, EmberEventUnits, - EmberNodeType, - EmberNetworkStatus, + EmberGpKeyType, + EmberGpSecurityLevel, EmberIncomingMessageType, - EmberOutgoingMessageType, - EmberMacPassthroughType, - EmberBindingType, - EmberApsOption, - EzspNetworkScanType, - EmberJoinDecision, EmberInitialSecurityBitmask, - EmberCurrentSecurityBitmask, - EmberKeyType, - EmberKeyStructBitmask, - EmberDeviceUpdate, - EmberKeyStatus, - EmberCounterType, + EmberJoinDecision, EmberJoinMethod, + EmberKeyStatus, + EmberKeyStructBitmask, + EmberKeyType, + EmberLibraryStatus, + EmberMacPassthroughType, + EmberMulticastId, + EmberNetworkInitBitmask, + EmberNetworkStatus, + EmberNodeId, + EmberNodeType, + EmberOutgoingMessageType, + EmberPanId, + EmberRf4ceApplicationCapabilities, + EmberRf4ceNodeCapabilities, + EmberRf4ceTxOption, + EmberStackError, + EmberStatus, + EmberZDOCmd, EmberZdoConfigurationFlags, - EmberConcentratorType, - EmberZllState, EmberZllKeyIndex, - EzspZllNetworkOperation, + EmberZllState, + EzspConfigId, + EzspDecisionId, + EzspEndpointFlags, + EzspExtendedValueId, + EzspMfgTokenId, + EzspNetworkScanType, + EzspPolicyId, EzspSourceRouteOverheadInformation, - EmberNetworkInitBitmask, - EmberZDOCmd, - EmberDerivedKeyType, + EzspStatus, + EzspValueId, + EzspZllNetworkOperation, + NcpResetCode, + SecureEzspRandomNumber, + SecureEzspSecurityLevel, + SecureEzspSecurityType, + SecureEzspSessionId, + SLStatus, } from './named'; import { - EzspStruct, - EmberNetworkParameters, - EmberZigbeeNetwork, + EmberAesMmoHashContext, EmberApsFrame, EmberBindingTableEntry, - EmberMulticastTableEntry, - EmberKeyData, - EmberCertificateData, - EmberPublicKeyData, - EmberPrivateKeyData, - EmberSmacData, - EmberSignatureData, EmberCertificate283k1Data, - EmberPublicKey283k1Data, - EmberPrivateKey283k1Data, - EmberSignature283k1Data, - EmberMessageDigest, - EmberAesMmoHashContext, - EmberNeighborTableEntry, - EmberRouteTableEntry, - EmberInitialSecurityState, + EmberCertificateData, EmberCurrentSecurityState, - EmberKeyStruct, - EmberNetworkInitStruct, - EmberZllSecurityAlgorithmData, - EmberZllNetwork, - EmberZllInitialSecurityState, - EmberZllDeviceInfoRecord, - EmberZllAddressAssignment, - EmberTokTypeStackZllData, - EmberTokTypeStackZllSecurity, - EmberRf4ceVendorInfo, - EmberRf4ceApplicationInfo, - EmberRf4cePairingTableEntry, EmberGpAddress, EmberGpSinkListEntry, - EmberNodeDescriptor, - EmberSimpleDescriptor, + EmberInitialSecurityState, + EmberKeyData, + EmberKeyStruct, + EmberMessageDigest, EmberMultiAddress, + EmberMulticastTableEntry, EmberNeighbors, + EmberNeighborTableEntry, + EmberNetworkInitStruct, + EmberNetworkParameters, + EmberNodeDescriptor, + EmberPrivateKey283k1Data, + EmberPrivateKeyData, + EmberPublicKey283k1Data, + EmberPublicKeyData, + EmberRf4ceApplicationInfo, + EmberRf4cePairingTableEntry, + EmberRf4ceVendorInfo, + EmberRouteTableEntry, EmberRoutingTable, EmberRoutingTableEntry, EmberSecurityManagerContext, EmberSecurityManagerNetworkKeyInfo, + EmberSignature283k1Data, + EmberSignatureData, + EmberSimpleDescriptor, + EmberSmacData, + EmberTokTypeStackZllData, + EmberTokTypeStackZllSecurity, + EmberZigbeeNetwork, + EmberZllAddressAssignment, + EmberZllDeviceInfoRecord, + EmberZllInitialSecurityState, + EmberZllNetwork, + EmberZllSecurityAlgorithmData, + EzspStruct, } from './struct'; /* eslint-disable-next-line @typescript-eslint/no-explicit-any*/ @@ -116,7 +117,7 @@ export function deserialize(payload: any, schema: any[]): any[] { return [result, data]; } -/* eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-function-type*/ +/* eslint-disable-next-line @typescript-eslint/no-explicit-any*/ export function serialize(data: any[], schema: {serialize: (schema: any, item: any) => Buffer}[]): Buffer { return Buffer.concat(schema.map((s, idx) => s.serialize(s, data[idx]))); } diff --git a/src/adapter/ezsp/driver/types/named.ts b/src/adapter/ezsp/driver/types/named.ts index 3940a2ddb5..87b9d7862a 100644 --- a/src/adapter/ezsp/driver/types/named.ts +++ b/src/adapter/ezsp/driver/types/named.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import * as basic from './basic'; import {fixed_list} from './basic'; @@ -60,7 +61,7 @@ export class EmberEUI64 extends fixed_list(8, basic.uint8_t) { value = (value as EmberEUI64).value as number[]; } // console.assert(cls._length === value.length); - /* eslint-disable-next-line @typescript-eslint/no-explicit-any*/ + const val = Buffer.from(value) .reverse() .map((i) => basic.uint8_t.serialize(basic.uint8_t, i)[0]); diff --git a/src/adapter/ezsp/driver/types/struct.ts b/src/adapter/ezsp/driver/types/struct.ts index 6f48cba4bf..cf4095be5e 100644 --- a/src/adapter/ezsp/driver/types/struct.ts +++ b/src/adapter/ezsp/driver/types/struct.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import * as basic from './basic'; import * as named from './named'; @@ -672,7 +673,7 @@ export class EmberMultiAddress extends EzspStruct { /* eslint-disable-next-line @typescript-eslint/no-explicit-any*/ static serialize(cls: any, obj: any): Buffer { const addrmode = obj['addrmode']; - /* eslint-disable-next-line @typescript-eslint/no-explicit-any*/ + const fields = addrmode == 3 ? cls.fields3 : cls.fields1; return Buffer.concat( /* eslint-disable-next-line @typescript-eslint/no-explicit-any*/ diff --git a/src/adapter/ezsp/driver/uart.ts b/src/adapter/ezsp/driver/uart.ts index a10e5b66ef..630ec92b48 100644 --- a/src/adapter/ezsp/driver/uart.ts +++ b/src/adapter/ezsp/driver/uart.ts @@ -1,14 +1,15 @@ /* istanbul ignore file */ + import {EventEmitter} from 'events'; import net from 'net'; -import {Queue, Waitress, Wait} from '../../../utils'; +import {Queue, Wait, Waitress} from '../../../utils'; import {logger} from '../../../utils/logger'; import wait from '../../../utils/wait'; import {SerialPort} from '../../serialPort'; import SocketPortUtils from '../../socketPortUtils'; import {SerialPortOptions} from '../../tstype'; -import {Frame as NpiFrame, FrameType} from './frame'; +import {FrameType, Frame as NpiFrame} from './frame'; import {Parser} from './parser'; import {Writer} from './writer'; diff --git a/src/adapter/ezsp/driver/utils/crc16ccitt.ts b/src/adapter/ezsp/driver/utils/crc16ccitt.ts index a846bc316c..2f153da521 100644 --- a/src/adapter/ezsp/driver/utils/crc16ccitt.ts +++ b/src/adapter/ezsp/driver/utils/crc16ccitt.ts @@ -1,11 +1,10 @@ /* istanbul ignore file */ + import {Buffer} from 'buffer'; type calcFn = (buf: Buffer | number[], previous: number) => number; -// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type function defineCrc(model: string, calc: calcFn): calcFn { - /* eslint-disable-next-line @typescript-eslint/no-explicit-any*/ const fn = (buf: Buffer | number[], previous: number): number => calc(buf, previous) >>> 0; fn.signed = calc; fn.unsigned = fn; diff --git a/src/adapter/ezsp/driver/utils/index.ts b/src/adapter/ezsp/driver/utils/index.ts index 8d374834bb..35ecbe1b19 100644 --- a/src/adapter/ezsp/driver/utils/index.ts +++ b/src/adapter/ezsp/driver/utils/index.ts @@ -1,7 +1,8 @@ /* istanbul ignore file */ + import {randomBytes} from 'crypto'; -import {EmberInitialSecurityBitmask, EmberEUI64} from '../types/named'; +import {EmberEUI64, EmberInitialSecurityBitmask} from '../types/named'; import {EmberInitialSecurityState, EmberKeyData} from '../types/struct'; import crc16ccitt from './crc16ccitt'; @@ -10,7 +11,6 @@ if (!Symbol.asyncIterator) { (Symbol).asyncIterator = Symbol.for('Symbol.asyncIterator'); } -/* eslint-disable-next-line @typescript-eslint/no-explicit-any*/ function ember_security(networkKey: Buffer): EmberInitialSecurityState { const isc: EmberInitialSecurityState = new EmberInitialSecurityState(); isc.bitmask = diff --git a/src/adapter/ezsp/driver/writer.ts b/src/adapter/ezsp/driver/writer.ts index d57c13795f..90f7ed1cdf 100644 --- a/src/adapter/ezsp/driver/writer.ts +++ b/src/adapter/ezsp/driver/writer.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import * as stream from 'stream'; import {logger} from '../../../utils/logger'; diff --git a/src/adapter/serialPort.ts b/src/adapter/serialPort.ts index 86b3976cde..0098eec9a5 100644 --- a/src/adapter/serialPort.ts +++ b/src/adapter/serialPort.ts @@ -1,5 +1,5 @@ /* istanbul ignore file */ -/* eslint-disable max-len */ + import {autoDetect, AutoDetectTypes, OpenOptionsFromBinding, SetOptions} from '@serialport/bindings-cpp'; // This file was copied from https://github.com/serialport/node-serialport/blob/master/packages/serialport/lib/serialport.ts. import {ErrorCallback, OpenOptions, SerialPortStream, StreamOptions} from '@serialport/stream'; diff --git a/src/adapter/z-stack/adapter/adapter-backup.ts b/src/adapter/z-stack/adapter/adapter-backup.ts index 4d2fc0b12a..b16d47774f 100644 --- a/src/adapter/z-stack/adapter/adapter-backup.ts +++ b/src/adapter/z-stack/adapter/adapter-backup.ts @@ -1,5 +1,5 @@ -/* eslint-disable max-len */ import assert from 'assert'; + import {fs} from 'mz'; import * as Models from '../../../models'; diff --git a/src/adapter/z-stack/adapter/adapter-nv-memory.ts b/src/adapter/z-stack/adapter/adapter-nv-memory.ts index 6e8e96bf1b..0117de09f7 100644 --- a/src/adapter/z-stack/adapter/adapter-nv-memory.ts +++ b/src/adapter/z-stack/adapter/adapter-nv-memory.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ import assert from 'assert'; import {NvItemsIds, NvSystemIds, ZnpCommandStatus} from '../constants/common'; @@ -93,7 +92,7 @@ export class AdapterNvMemory { * @param offset Offset within NV item to write the data. * @param autoInit Whether NV item should be automatically initialized if not present. */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any + public async writeItem(id: NvItemsIds, data: Buffer | Structs.SerializableMemoryObject, offset = 0, autoInit = true): Promise { this.checkMemoryAlignmentSetup(); const buffer = Buffer.isBuffer(data) ? data : data.serialize(this.memoryAlignment); diff --git a/src/adapter/z-stack/adapter/manager.ts b/src/adapter/z-stack/adapter/manager.ts index 3efd221f0d..743c505a14 100644 --- a/src/adapter/z-stack/adapter/manager.ts +++ b/src/adapter/z-stack/adapter/manager.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ import * as crypto from 'crypto'; import {TsType} from '../../'; diff --git a/src/adapter/z-stack/adapter/zStackAdapter.ts b/src/adapter/z-stack/adapter/zStackAdapter.ts index 5221a8edb0..ad192a9d44 100644 --- a/src/adapter/z-stack/adapter/zStackAdapter.ts +++ b/src/adapter/z-stack/adapter/zStackAdapter.ts @@ -1,8 +1,9 @@ import assert from 'assert'; + import debounce from 'debounce'; import * as Models from '../../../models'; -import {Queue, Waitress, Wait} from '../../../utils'; +import {Queue, Wait, Waitress} from '../../../utils'; import {logger} from '../../../utils/logger'; import {BroadcastAddress} from '../../../zspec/enums'; import * as Zcl from '../../../zspec/zcl'; @@ -10,21 +11,21 @@ import {Status as ZdoStatus} from '../../../zspec/zdo'; import Adapter from '../../adapter'; import * as Events from '../../events'; import { - NetworkOptions, - SerialPortOptions, + ActiveEndpoints, + AdapterOptions, Coordinator, CoordinatorVersion, - NodeDescriptor, DeviceType, - ActiveEndpoints, - SimpleDescriptor, LQI, - RoutingTable, - NetworkParameters, - StartResult, LQINeighbor, + NetworkOptions, + NetworkParameters, + NodeDescriptor, + RoutingTable, RoutingTableEntry, - AdapterOptions, + SerialPortOptions, + SimpleDescriptor, + StartResult, } from '../../tstype'; import * as Constants from '../constants'; import {Constants as UnpiConstants} from '../unpi'; diff --git a/src/adapter/z-stack/structs/entries/address-manager-entry.ts b/src/adapter/z-stack/structs/entries/address-manager-entry.ts index e536c74a88..b0428a93c6 100644 --- a/src/adapter/z-stack/structs/entries/address-manager-entry.ts +++ b/src/adapter/z-stack/structs/entries/address-manager-entry.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import {Struct} from '../struct'; /** diff --git a/src/adapter/z-stack/structs/entries/aps-link-key-data-entry.ts b/src/adapter/z-stack/structs/entries/aps-link-key-data-entry.ts index 88cf96d618..1493ecb589 100644 --- a/src/adapter/z-stack/structs/entries/aps-link-key-data-entry.ts +++ b/src/adapter/z-stack/structs/entries/aps-link-key-data-entry.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import {Struct} from '../struct'; /** diff --git a/src/adapter/z-stack/structs/entries/aps-tc-link-key-entry.ts b/src/adapter/z-stack/structs/entries/aps-tc-link-key-entry.ts index 630639509e..474268ee06 100644 --- a/src/adapter/z-stack/structs/entries/aps-tc-link-key-entry.ts +++ b/src/adapter/z-stack/structs/entries/aps-tc-link-key-entry.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import {Struct} from '../struct'; /** diff --git a/src/adapter/z-stack/structs/entries/channel-list.ts b/src/adapter/z-stack/structs/entries/channel-list.ts index 37a289e1cd..c53df3e09b 100644 --- a/src/adapter/z-stack/structs/entries/channel-list.ts +++ b/src/adapter/z-stack/structs/entries/channel-list.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import {Struct} from '../struct'; /** diff --git a/src/adapter/z-stack/structs/entries/has-configured.ts b/src/adapter/z-stack/structs/entries/has-configured.ts index 5ed18f30ad..5363c0b140 100644 --- a/src/adapter/z-stack/structs/entries/has-configured.ts +++ b/src/adapter/z-stack/structs/entries/has-configured.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import assert from 'assert'; import {Struct} from '../struct'; diff --git a/src/adapter/z-stack/structs/entries/nib.ts b/src/adapter/z-stack/structs/entries/nib.ts index bc02f14671..e6c9aea0e3 100644 --- a/src/adapter/z-stack/structs/entries/nib.ts +++ b/src/adapter/z-stack/structs/entries/nib.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import assert from 'assert'; import {Struct} from '../struct'; diff --git a/src/adapter/z-stack/structs/entries/nwk-key-descriptor.ts b/src/adapter/z-stack/structs/entries/nwk-key-descriptor.ts index 7c90a1cf14..ac3f7ab1d9 100644 --- a/src/adapter/z-stack/structs/entries/nwk-key-descriptor.ts +++ b/src/adapter/z-stack/structs/entries/nwk-key-descriptor.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import assert from 'assert'; import {Struct} from '../struct'; diff --git a/src/adapter/z-stack/structs/entries/nwk-key.ts b/src/adapter/z-stack/structs/entries/nwk-key.ts index faebfc6328..4132af31e2 100644 --- a/src/adapter/z-stack/structs/entries/nwk-key.ts +++ b/src/adapter/z-stack/structs/entries/nwk-key.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import assert from 'assert'; import {Struct} from '../struct'; diff --git a/src/adapter/z-stack/structs/entries/nwk-pan-id.ts b/src/adapter/z-stack/structs/entries/nwk-pan-id.ts index 7efa2503c0..8d9c3c4083 100644 --- a/src/adapter/z-stack/structs/entries/nwk-pan-id.ts +++ b/src/adapter/z-stack/structs/entries/nwk-pan-id.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import {Struct} from '../struct'; /** diff --git a/src/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.ts b/src/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.ts index 3a30ebe26f..9e96fad5ac 100644 --- a/src/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.ts +++ b/src/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import {Struct} from '../struct'; const emptyExtendedPanId = Buffer.alloc(8, 0x00); diff --git a/src/adapter/z-stack/structs/entries/security-manager-entry.ts b/src/adapter/z-stack/structs/entries/security-manager-entry.ts index c4dd759290..a6fcca21ff 100644 --- a/src/adapter/z-stack/structs/entries/security-manager-entry.ts +++ b/src/adapter/z-stack/structs/entries/security-manager-entry.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ + import {Struct} from '../struct'; /** diff --git a/src/adapter/z-stack/structs/entries/security-manager-table.ts b/src/adapter/z-stack/structs/entries/security-manager-table.ts index 4d36cb056e..9f59676b7f 100644 --- a/src/adapter/z-stack/structs/entries/security-manager-table.ts +++ b/src/adapter/z-stack/structs/entries/security-manager-table.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ import assert from 'assert'; import {StructMemoryAlignment} from '../struct'; diff --git a/src/adapter/z-stack/structs/struct.ts b/src/adapter/z-stack/structs/struct.ts index d7bcbb9d3d..1058360afc 100644 --- a/src/adapter/z-stack/structs/struct.ts +++ b/src/adapter/z-stack/structs/struct.ts @@ -133,7 +133,7 @@ export class Struct implements SerializableMemoryObject { /** * Returns structure contents in JS object format. */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/explicit-function-return-type + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type public toJSON() { return this.members.reduce((a, c) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/src/adapter/z-stack/structs/table.ts b/src/adapter/z-stack/structs/table.ts index 6423ccff11..f806abb351 100644 --- a/src/adapter/z-stack/structs/table.ts +++ b/src/adapter/z-stack/structs/table.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ import assert from 'assert'; import {SerializableMemoryObject} from './serializable-memory-object'; diff --git a/src/adapter/z-stack/unpi/frame.ts b/src/adapter/z-stack/unpi/frame.ts index dff0bec880..d860b2b02f 100644 --- a/src/adapter/z-stack/unpi/frame.ts +++ b/src/adapter/z-stack/unpi/frame.ts @@ -1,4 +1,4 @@ -import {Type, Subsystem, DataStart, SOF, PositionCmd0, PositionCmd1} from './constants'; +import {DataStart, PositionCmd0, PositionCmd1, SOF, Subsystem, Type} from './constants'; class Frame { public readonly type: Type; diff --git a/src/adapter/z-stack/unpi/parser.ts b/src/adapter/z-stack/unpi/parser.ts index 0ce590f53d..f96b7d1889 100644 --- a/src/adapter/z-stack/unpi/parser.ts +++ b/src/adapter/z-stack/unpi/parser.ts @@ -1,7 +1,7 @@ import * as stream from 'stream'; import {logger} from '../../../utils/logger'; -import {DataStart, SOF, MinMessageLength, PositionDataLength} from './constants'; +import {DataStart, MinMessageLength, PositionDataLength, SOF} from './constants'; import Frame from './frame'; const NS = 'zh:zstack:unpi:parser'; diff --git a/src/adapter/z-stack/utils/network-options.ts b/src/adapter/z-stack/utils/network-options.ts index 5e59bfdca3..45cc4c5edf 100644 --- a/src/adapter/z-stack/utils/network-options.ts +++ b/src/adapter/z-stack/utils/network-options.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ /* istanbul ignore file */ import * as Models from '../../../models'; diff --git a/src/adapter/z-stack/znp/definition.ts b/src/adapter/z-stack/znp/definition.ts index cb6c770587..372f93d0fb 100644 --- a/src/adapter/z-stack/znp/definition.ts +++ b/src/adapter/z-stack/znp/definition.ts @@ -1,4 +1,4 @@ -import {Subsystem, Type as CommandType} from '../unpi/constants'; +import {Type as CommandType, Subsystem} from '../unpi/constants'; import ParameterType from './parameterType'; import {MtCmd} from './tstype'; diff --git a/src/adapter/z-stack/znp/znp.ts b/src/adapter/z-stack/znp/znp.ts index 9bf3fd20f5..7b2bc71e6d 100755 --- a/src/adapter/z-stack/znp/znp.ts +++ b/src/adapter/z-stack/znp/znp.ts @@ -1,14 +1,15 @@ import events from 'events'; -import Equals from 'fast-deep-equal/es6'; import net from 'net'; -import {Wait, Queue, Waitress, RealpathSync} from '../../../utils'; +import Equals from 'fast-deep-equal/es6'; + +import {Queue, RealpathSync, Wait, Waitress} from '../../../utils'; import {logger} from '../../../utils/logger'; import {SerialPort} from '../../serialPort'; import SerialPortUtils from '../../serialPortUtils'; import SocketPortUtils from '../../socketPortUtils'; import * as Constants from '../constants'; -import {Writer as UnpiWriter, Parser as UnpiParser, Frame as UnpiFrame} from '../unpi'; +import {Frame as UnpiFrame, Parser as UnpiParser, Writer as UnpiWriter} from '../unpi'; import {Subsystem, Type} from '../unpi/constants'; import {ZpiObjectPayload} from './tstype'; import ZpiObject from './zpiObject'; diff --git a/src/adapter/z-stack/znp/zpiObject.ts b/src/adapter/z-stack/znp/zpiObject.ts index 9ece8ce68e..b1826e92b7 100755 --- a/src/adapter/z-stack/znp/zpiObject.ts +++ b/src/adapter/z-stack/znp/zpiObject.ts @@ -1,9 +1,9 @@ import {Frame as UnpiFrame} from '../unpi'; -import {Subsystem, Type, MaxDataSize} from '../unpi/constants'; +import {MaxDataSize, Subsystem, Type} from '../unpi/constants'; import BuffaloZnp from './buffaloZnp'; import Definition from './definition'; import ParameterType from './parameterType'; -import {MtParameter, MtCmd, ZpiObjectPayload, MtType, BuffaloZnpOptions} from './tstype'; +import {BuffaloZnpOptions, MtCmd, MtParameter, MtType, ZpiObjectPayload} from './tstype'; const BufferAndListTypes = [ ParameterType.BUFFER, diff --git a/src/adapter/zigate/adapter/index.ts b/src/adapter/zigate/adapter/index.ts index 9ee5615918..6d1ad6d68a 100644 --- a/src/adapter/zigate/adapter/index.ts +++ b/src/adapter/zigate/adapter/index.ts @@ -1,5 +1,5 @@ /* istanbul ignore file */ -/* eslint-disable */ + import ZiGateAdapter from './zigateAdapter'; export {ZiGateAdapter}; diff --git a/src/adapter/zigate/adapter/zigateAdapter.ts b/src/adapter/zigate/adapter/zigateAdapter.ts index 8e3f1c5c15..ebfc40bab9 100644 --- a/src/adapter/zigate/adapter/zigateAdapter.ts +++ b/src/adapter/zigate/adapter/zigateAdapter.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {Buffalo} from '../../../buffalo'; import {KeyValue} from '../../../controller/tstype'; import * as Models from '../../../models'; @@ -12,8 +13,8 @@ import * as TsType from '../../tstype'; import {ActiveEndpoints, DeviceType, LQI, LQINeighbor, NodeDescriptor, SimpleDescriptor} from '../../tstype'; import {RawAPSDataRequestPayload} from '../driver/commandType'; import {ADDRESS_MODE, coordinatorEndpoints, DEVICE_TYPE, ZiGateCommandCode, ZiGateMessageCode, ZPSNwkKeyState} from '../driver/constants'; -import ZiGateObject from '../driver/ziGateObject'; import Driver from '../driver/zigate'; +import ZiGateObject from '../driver/ziGateObject'; const NS = 'zh:zigate'; const default_bind_group = 901; // https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/lib/constants.js#L3 diff --git a/src/adapter/zigate/driver/buffaloZiGate.ts b/src/adapter/zigate/driver/buffaloZiGate.ts index 8207644033..eaa0916e25 100644 --- a/src/adapter/zigate/driver/buffaloZiGate.ts +++ b/src/adapter/zigate/driver/buffaloZiGate.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {Buffalo} from '../../../buffalo'; import {BuffaloZclOptions} from '../../../zspec/zcl/definition/tstype'; import {LOG_LEVEL} from './constants'; diff --git a/src/adapter/zigate/driver/frame.ts b/src/adapter/zigate/driver/frame.ts index 2f69b9fa90..6b7f298a60 100644 --- a/src/adapter/zigate/driver/frame.ts +++ b/src/adapter/zigate/driver/frame.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {logger} from '../../../utils/logger'; const NS = 'zh:zigate:frame'; diff --git a/src/adapter/zigate/driver/ziGateObject.ts b/src/adapter/zigate/driver/ziGateObject.ts index 41c8fd234e..df36b34243 100755 --- a/src/adapter/zigate/driver/ziGateObject.ts +++ b/src/adapter/zigate/driver/ziGateObject.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import {logger} from '../../../utils/logger'; import BuffaloZiGate, {BuffaloZiGateOptions} from './buffaloZiGate'; import {ZiGateCommand, ZiGateCommandParameter, ZiGateCommandType} from './commandType'; diff --git a/src/adapter/zigate/driver/zigate.ts b/src/adapter/zigate/driver/zigate.ts index b90632dc9f..fd19cfe7f2 100644 --- a/src/adapter/zigate/driver/zigate.ts +++ b/src/adapter/zigate/driver/zigate.ts @@ -1,8 +1,10 @@ /* istanbul ignore file */ -import {DelimiterParser} from '@serialport/parser-delimiter'; + import {EventEmitter} from 'events'; import net from 'net'; +import {DelimiterParser} from '@serialport/parser-delimiter'; + import {Buffalo} from '../../../buffalo'; import {Queue} from '../../../utils'; import {logger} from '../../../utils/logger'; diff --git a/src/controller/controller.ts b/src/controller/controller.ts index 8b1e8eacc5..abbbc4dfec 100644 --- a/src/controller/controller.ts +++ b/src/controller/controller.ts @@ -1,9 +1,10 @@ import assert from 'assert'; import events from 'events'; import fs from 'fs'; + import mixinDeep from 'mixin-deep'; -import {TsType as AdapterTsType, Adapter, Events as AdapterEvents} from '../adapter'; +import {Adapter, Events as AdapterEvents, TsType as AdapterTsType} from '../adapter'; import {BackupUtils} from '../utils'; import {logger} from '../utils/logger'; import {isNumberArrayOfLength} from '../utils/utils'; @@ -13,10 +14,10 @@ import Database from './database'; import * as Events from './events'; import GreenPower from './greenPower'; import {ZclFrameConverter} from './helpers'; -import {Entity, Device} from './model'; +import {Device, Entity} from './model'; import Group from './model/group'; import Touchlink from './touchlink'; -import {KeyValue, DeviceType, GreenPowerDeviceJoinedPayload} from './tstype'; +import {DeviceType, GreenPowerDeviceJoinedPayload, KeyValue} from './tstype'; const NS = 'zh:controller'; diff --git a/src/controller/index.ts b/src/controller/index.ts index 0071e7e4e0..419c22386c 100644 --- a/src/controller/index.ts +++ b/src/controller/index.ts @@ -1,4 +1,5 @@ import Controller from './controller'; + /** * @internal */ diff --git a/src/controller/model/device.ts b/src/controller/model/device.ts index 6fb96dbc8e..879a39df9d 100755 --- a/src/controller/model/device.ts +++ b/src/controller/model/device.ts @@ -9,7 +9,7 @@ import {ClusterDefinition, CustomClusters} from '../../zspec/zcl/definition/tsty import {ControllerEventMap} from '../controller'; import {ZclFrameConverter} from '../helpers'; import ZclTransactionSequenceNumber from '../helpers/zclTransactionSequenceNumber'; -import {KeyValue, DatabaseEntry, DeviceType} from '../tstype'; +import {DatabaseEntry, DeviceType, KeyValue} from '../tstype'; import Endpoint from './endpoint'; import Entity from './entity'; diff --git a/src/utils/backup.ts b/src/utils/backup.ts index aab103f14a..e4866e81f2 100644 --- a/src/utils/backup.ts +++ b/src/utils/backup.ts @@ -1,7 +1,7 @@ -/* eslint-disable max-len */ -import {fs} from 'mz'; import * as path from 'path'; +import {fs} from 'mz'; + import * as ZStackStructs from '../adapter/z-stack/structs'; import * as ZStackUtils from '../adapter/z-stack/utils'; import * as Models from '../models'; diff --git a/src/utils/realpathSync.ts b/src/utils/realpathSync.ts index 2a46d702f2..3b2424b896 100644 --- a/src/utils/realpathSync.ts +++ b/src/utils/realpathSync.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ + import fs from 'fs'; /* Only used for mocking purposes */ diff --git a/src/zspec/zcl/definition/cluster.ts b/src/zspec/zcl/definition/cluster.ts index efedbf91a8..35145362a0 100644 --- a/src/zspec/zcl/definition/cluster.ts +++ b/src/zspec/zcl/definition/cluster.ts @@ -1,5 +1,6 @@ /* eslint max-len: 0 */ -import {DataType, BuffaloZclDataType, ParameterCondition} from './enums'; + +import {BuffaloZclDataType, DataType, ParameterCondition} from './enums'; import {ManufacturerCode} from './manufacturerCode'; import {Status} from './status'; import {ClusterDefinition, ClusterName} from './tstype'; diff --git a/src/zspec/zcl/definition/foundation.ts b/src/zspec/zcl/definition/foundation.ts index f133e94044..4f84070675 100644 --- a/src/zspec/zcl/definition/foundation.ts +++ b/src/zspec/zcl/definition/foundation.ts @@ -1,5 +1,6 @@ /* eslint max-len: 0 */ -import {DataType, BuffaloZclDataType, Direction, ParameterCondition, DataTypeClass} from './enums'; + +import {BuffaloZclDataType, DataType, DataTypeClass, Direction, ParameterCondition} from './enums'; import {Status} from './status'; import {ParameterDefinition} from './tstype'; diff --git a/src/zspec/zcl/definition/tstype.ts b/src/zspec/zcl/definition/tstype.ts index 0260f555c1..bfce3a8a03 100644 --- a/src/zspec/zcl/definition/tstype.ts +++ b/src/zspec/zcl/definition/tstype.ts @@ -1,4 +1,4 @@ -import {DataType, FrameType, Direction, BuffaloZclDataType, StructuredIndicatorType, ParameterCondition, DataTypeClass} from './enums'; +import {BuffaloZclDataType, DataType, DataTypeClass, Direction, FrameType, ParameterCondition, StructuredIndicatorType} from './enums'; import {Status} from './status'; export interface BuffaloZclOptions { diff --git a/src/zspec/zcl/utils.ts b/src/zspec/zcl/utils.ts index 65a77367df..2e24fe081c 100644 --- a/src/zspec/zcl/utils.ts +++ b/src/zspec/zcl/utils.ts @@ -1,6 +1,6 @@ import {Clusters} from './definition/cluster'; import {DataType, DataTypeClass} from './definition/enums'; -import {Foundation, FoundationDefinition, FoundationCommandName} from './definition/foundation'; +import {Foundation, FoundationCommandName, FoundationDefinition} from './definition/foundation'; import {Attribute, Cluster, ClusterDefinition, ClusterName, Command, CustomClusters} from './definition/tstype'; const DATA_TYPE_CLASS_DISCRETE = [ diff --git a/src/zspec/zcl/zclFrame.ts b/src/zspec/zcl/zclFrame.ts index cb00f03ac7..5f7e46216b 100644 --- a/src/zspec/zcl/zclFrame.ts +++ b/src/zspec/zcl/zclFrame.ts @@ -1,8 +1,8 @@ import {BuffaloZcl} from './buffaloZcl'; -import {Direction, DataType, BuffaloZclDataType, FrameType, ParameterCondition} from './definition/enums'; +import {BuffaloZclDataType, DataType, Direction, FrameType, ParameterCondition} from './definition/enums'; import {FoundationCommandName} from './definition/foundation'; import {Status} from './definition/status'; -import {BuffaloZclOptions, Cluster, Command, ClusterName, CustomClusters, ParameterDefinition} from './definition/tstype'; +import {BuffaloZclOptions, Cluster, ClusterName, Command, CustomClusters, ParameterDefinition} from './definition/tstype'; import * as Utils from './utils'; import {ZclHeader} from './zclHeader'; diff --git a/src/zspec/zdo/buffaloZdo.ts b/src/zspec/zdo/buffaloZdo.ts index 8581cf4108..ea3007e105 100644 --- a/src/zspec/zdo/buffaloZdo.ts +++ b/src/zspec/zdo/buffaloZdo.ts @@ -4,65 +4,65 @@ import {DEFAULT_ENCRYPTION_KEY_SIZE, EUI64_SIZE, EXTENDED_PAN_ID_SIZE, PAN_ID_SI import {ClusterId, EUI64, NodeId, ProfileId} from '../tstypes'; import * as ZSpecUtils from '../utils'; import {ClusterId as ZdoClusterId} from './definition/clusters'; -import {ZDO_MESSAGE_OVERHEAD, UNICAST_BINDING, MULTICAST_BINDING, CHALLENGE_VALUE_SIZE, CURVE_PUBLIC_POINT_SIZE} from './definition/consts'; -import {LeaveRequestFlags, GlobalTLV} from './definition/enums'; +import {CHALLENGE_VALUE_SIZE, CURVE_PUBLIC_POINT_SIZE, MULTICAST_BINDING, UNICAST_BINDING, ZDO_MESSAGE_OVERHEAD} from './definition/consts'; +import {GlobalTLV, LeaveRequestFlags} from './definition/enums'; import {Status} from './definition/status'; import { ActiveEndpointsResponse, + APSFrameCounterChallengeTLV, + APSFrameCounterResponseTLV, + AuthenticationTokenIdTLV, + BeaconAppendixEncapsulationGlobalTLV, + BeaconSurveyConfigurationTLV, + BeaconSurveyResultsTLV, + BindingTableEntry, BindingTableResponse, + ChallengeResponse, + ClearAllBindingsReqEUI64TLV, + ConfigurationParametersGlobalTLV, + Curve25519PublicPointTLV, + DeviceAuthenticationLevelTLV, + DeviceCapabilityExtensionGlobalTLV, + DeviceEUI64ListTLV, EndDeviceAnnounce, + FragmentationParametersGlobalTLV, + GetAuthenticationLevelResponse, + GetConfigurationResponse, IEEEAddressResponse, + JoinerEncapsulationGlobalTLV, + LocalTLVReader, + LQITableEntry, LQITableResponse, + ManufacturerSpecificGlobalTLV, MatchDescriptorsResponse, NetworkAddressResponse, + NextChannelChangeGlobalTLV, + NextPanIdChangeGlobalTLV, NodeDescriptorResponse, - ParentAnnounceResponse, - PowerDescriptorResponse, - RoutingTableResponse, - SimpleDescriptorResponse, - SystemServerDiscoveryResponse, - LQITableEntry, - RoutingTableEntry, - BindingTableEntry, - NwkUpdateResponse, + NwkBeaconSurveyResponse, NwkEnhancedUpdateResponse, NwkIEEEJoiningListResponse, NwkUnsolicitedEnhancedUpdateResponse, - NwkBeaconSurveyResponse, - StartKeyNegotiationResponse, - RetrieveAuthenticationTokenResponse, - GetAuthenticationLevelResponse, - SetConfigurationResponse, - GetConfigurationResponse, - ChallengeResponse, - APSFrameCounterChallengeTLV, - AuthenticationTokenIdTLV, - Curve25519PublicPointTLV, - FragmentationParametersGlobalTLV, - SelectedKeyNegotiationMethodTLV, + NwkUpdateResponse, + PanIdConflictReportGlobalTLV, + ParentAnnounceResponse, PotentialParentsTLV, - ClearAllBindingsReqEUI64TLV, - BeaconAppendixEncapsulationGlobalTLV, - TargetIEEEAddressTLV, - NextPanIdChangeGlobalTLV, - NextChannelChangeGlobalTLV, - ConfigurationParametersGlobalTLV, - DeviceEUI64ListTLV, - BeaconSurveyResultsTLV, - DeviceAuthenticationLevelTLV, + PowerDescriptorResponse, ProcessingStatusTLV, - APSFrameCounterResponseTLV, - BeaconSurveyConfigurationTLV, - ManufacturerSpecificGlobalTLV, + RetrieveAuthenticationTokenResponse, + RouterInformationGlobalTLV, + RoutingTableEntry, + RoutingTableResponse, + SelectedKeyNegotiationMethodTLV, + ServerMask, + SetConfigurationResponse, + SimpleDescriptorResponse, + StartKeyNegotiationResponse, SupportedKeyNegotiationMethodsGlobalTLV, - PanIdConflictReportGlobalTLV, SymmetricPassphraseGlobalTLV, - RouterInformationGlobalTLV, - JoinerEncapsulationGlobalTLV, - DeviceCapabilityExtensionGlobalTLV, + SystemServerDiscoveryResponse, + TargetIEEEAddressTLV, TLV, - LocalTLVReader, - ServerMask, } from './definition/tstypes'; import * as Utils from './utils'; import {ZdoStatusError} from './zdoStatusError'; diff --git a/src/zspec/zdo/definition/tstypes.ts b/src/zspec/zdo/definition/tstypes.ts index e71a9db749..c2d765952a 100644 --- a/src/zspec/zdo/definition/tstypes.ts +++ b/src/zspec/zdo/definition/tstypes.ts @@ -1,5 +1,5 @@ import {ClusterId, EUI64, ExtendedPanId, NodeId, PanId, ProfileId} from '../../tstypes'; -import {JoiningPolicy, ActiveLinkKeyType, InitialJoinMethod, SelectedKeyNegotiationProtocol, SelectedPreSharedSecret} from './enums'; +import {ActiveLinkKeyType, InitialJoinMethod, JoiningPolicy, SelectedKeyNegotiationProtocol, SelectedPreSharedSecret} from './enums'; import {Status} from './status'; /** diff --git a/test/adapter/ember/ash.test.ts b/test/adapter/ember/ash.test.ts index a94a7783b9..8bc916fe08 100644 --- a/test/adapter/ember/ash.test.ts +++ b/test/adapter/ember/ash.test.ts @@ -1,5 +1,8 @@ -import {OpenOptions} from '@serialport/stream'; import {MockBinding, MockPortBinding} from '@serialport/binding-mock'; +import {OpenOptions} from '@serialport/stream'; + +import {EzspStatus} from '../../../src/adapter/ember/enums'; +import {EzspBuffalo} from '../../../src/adapter/ember/ezsp/buffalo.ts'; import { EZSP_EXTENDED_FRAME_CONTROL_LB_INDEX, EZSP_FRAME_CONTROL_COMMAND, @@ -11,15 +14,13 @@ import { EZSP_PARAMETERS_INDEX, EZSP_SEQUENCE_INDEX, } from '../../../src/adapter/ember/ezsp/consts'; -import {EzspStatus} from '../../../src/adapter/ember/enums'; -import {EzspBuffer} from '../../../src/adapter/ember/uart/queues'; -import {UartAsh, CONFIG_TX_K} from '../../../src/adapter/ember/uart/ash'; +import {EzspFrameID} from '../../../src/adapter/ember/ezsp/enums.ts'; +import {CONFIG_TX_K, UartAsh} from '../../../src/adapter/ember/uart/ash'; import {EZSP_HOST_RX_POOL_SIZE, TX_POOL_BUFFERS} from '../../../src/adapter/ember/uart/consts'; -import {RECD_RSTACK_BYTES, SEND_RST_BYTES, SEND_ACK_FIRST_BYTES, adapterSONOFFDongleE, ASH_ACK_FIRST_BYTES} from './consts'; -import {EzspBuffalo} from '../../../src/adapter/ember/ezsp/buffalo.ts'; +import {EzspBuffer} from '../../../src/adapter/ember/uart/queues'; import {lowByte} from '../../../src/adapter/ember/utils/math'; -import {EzspFrameID} from '../../../src/adapter/ember/ezsp/enums.ts'; import {Wait} from '../../../src/utils/'; +import {adapterSONOFFDongleE, ASH_ACK_FIRST_BYTES, RECD_RSTACK_BYTES, SEND_ACK_FIRST_BYTES, SEND_RST_BYTES} from './consts'; const mockSerialPortCloseEvent = jest.fn(); const mockSerialPortErrorEvent = jest.fn(); diff --git a/test/adapter/ember/emberAdapter.test.ts b/test/adapter/ember/emberAdapter.test.ts index 0196fece23..391adbc609 100644 --- a/test/adapter/ember/emberAdapter.test.ts +++ b/test/adapter/ember/emberAdapter.test.ts @@ -1,16 +1,13 @@ -import path from 'path'; import {existsSync, mkdirSync, unlinkSync, writeFileSync} from 'fs'; +import path from 'path'; import {EventEmitter} from 'stream'; -import * as Zcl from '../../../src/zspec/zcl'; -import * as Zdo from '../../../src/zspec/zdo'; -import * as ZdoTypes from '../../../src/zspec/zdo/definition/tstypes'; -import * as ZSpec from '../../../src/zspec'; import {TsType} from '../../../src/adapter'; -import {EmberEzspEventMap, Ezsp} from '../../../src/adapter/ember/ezsp/ezsp'; import {EmberAdapter} from '../../../src/adapter/ember/adapter'; -import {AdapterOptions, NetworkOptions, SerialPortOptions} from '../../../src/adapter/tstype'; import {DEFAULT_APS_OPTIONS, DEFAULT_STACK_CONFIG, LinkKeyBackupData, NetworkCache} from '../../../src/adapter/ember/adapter/emberAdapter'; +import {FIXED_ENDPOINTS} from '../../../src/adapter/ember/adapter/endpoints'; +import {OneWaitressEvents} from '../../../src/adapter/ember/adapter/oneWaitress'; +import {EMBER_LOW_RAM_CONCENTRATOR, INVALID_RADIO_CHANNEL, SECURITY_LEVEL_Z3} from '../../../src/adapter/ember/consts'; import { EmberApsOption, EmberDeviceUpdate, @@ -28,6 +25,10 @@ import { SecManKeyType, SLStatus, } from '../../../src/adapter/ember/enums'; +import {EZSP_MIN_PROTOCOL_VERSION, EZSP_PROTOCOL_VERSION, EZSP_STACK_TYPE_MESH} from '../../../src/adapter/ember/ezsp/consts'; +import {EzspConfigId, EzspDecisionBitmask, EzspEndpointFlag, EzspPolicyId, EzspValueId} from '../../../src/adapter/ember/ezsp/enums'; +import {EmberEzspEventMap, Ezsp} from '../../../src/adapter/ember/ezsp/ezsp'; +import {EzspError} from '../../../src/adapter/ember/ezspError'; import { EmberAesMmoHashContext, EmberApsFrame, @@ -40,18 +41,17 @@ import { SecManKey, SecManNetworkKeyInfo, } from '../../../src/adapter/ember/types'; -import {EzspEndpointFlag, EzspConfigId, EzspValueId, EzspPolicyId, EzspDecisionBitmask} from '../../../src/adapter/ember/ezsp/enums'; -import {EZSP_MIN_PROTOCOL_VERSION, EZSP_PROTOCOL_VERSION, EZSP_STACK_TYPE_MESH} from '../../../src/adapter/ember/ezsp/consts'; -import {FIXED_ENDPOINTS} from '../../../src/adapter/ember/adapter/endpoints'; -import {EMBER_LOW_RAM_CONCENTRATOR, INVALID_RADIO_CHANNEL, SECURITY_LEVEL_Z3} from '../../../src/adapter/ember/consts'; import {lowHighBytes} from '../../../src/adapter/ember/utils/math'; -import {logger} from '../../../src/utils/logger'; -import {UnifiedBackupStorage} from '../../../src/models/backup-storage-unified'; import {DeviceAnnouncePayload, DeviceJoinedPayload, DeviceLeavePayload, NetworkAddressPayload, ZclPayload} from '../../../src/adapter/events'; -import {EUI64, NodeId, PanId} from '../../../src/zspec/tstypes'; -import {OneWaitressEvents} from '../../../src/adapter/ember/adapter/oneWaitress'; +import {AdapterOptions, NetworkOptions, SerialPortOptions} from '../../../src/adapter/tstype'; import {Backup} from '../../../src/models/backup'; -import {EzspError} from '../../../src/adapter/ember/ezspError'; +import {UnifiedBackupStorage} from '../../../src/models/backup-storage-unified'; +import {logger} from '../../../src/utils/logger'; +import * as ZSpec from '../../../src/zspec'; +import {EUI64, NodeId, PanId} from '../../../src/zspec/tstypes'; +import * as Zcl from '../../../src/zspec/zcl'; +import * as Zdo from '../../../src/zspec/zdo'; +import * as ZdoTypes from '../../../src/zspec/zdo/definition/tstypes'; // https://github.com/jestjs/jest/issues/6028#issuecomment-567669082 function defuseRejection(promise: Promise) { diff --git a/test/adapter/ember/ezsp.test.ts b/test/adapter/ember/ezsp.test.ts index 82c5414464..3213253fb2 100644 --- a/test/adapter/ember/ezsp.test.ts +++ b/test/adapter/ember/ezsp.test.ts @@ -1,26 +1,27 @@ -import {OpenOptions} from '@serialport/stream'; import {MockBinding, MockPortBinding} from '@serialport/binding-mock'; +import {OpenOptions} from '@serialport/stream'; + +import {EzspStatus} from '../../../src/adapter/ember/enums'; import {Ezsp} from '../../../src/adapter/ember/ezsp/ezsp'; +import {logger} from '../../../src/utils/logger'; import { + adapterSONOFFDongleE, ASH_ACK_FIRST_BYTES, - RCED_DATA_WITH_CRC_ERROR, + INCOMING_MESSAGE_HANDLER_FN2_ASH_RAW, + MESSAGE_SENT_HANDLER_FN0_ASH_RAW, + MESSAGE_SENT_HANDLER_FN1_ASH_RAW, RCED_DATA_VERSION, RCED_DATA_VERSION_RES, + RCED_DATA_WITH_CRC_ERROR, + RCED_ERROR_WATCHDOG_BYTES, RECD_ERROR_ACK_TIMEOUT_BYTES, RECD_RSTACK_BYTES, - SEND_RST_BYTES, - adapterSONOFFDongleE, - SEND_DATA_VERSION, SEND_ACK_FIRST_BYTES, - RCED_ERROR_WATCHDOG_BYTES, + SEND_DATA_VERSION, + SEND_RST_BYTES, SEND_UNICAST_REPLY_FN0_ASH_RAW, - MESSAGE_SENT_HANDLER_FN1_ASH_RAW, - INCOMING_MESSAGE_HANDLER_FN2_ASH_RAW, - MESSAGE_SENT_HANDLER_FN0_ASH_RAW, SET_POLICY_REPLY_FN1_ASH_RAW, } from './consts'; -import {EzspStatus} from '../../../src/adapter/ember/enums'; -import {logger} from '../../../src/utils/logger'; const emitFromSerial = async (ezsp: Ezsp, data: Buffer, skipAdvanceTimers: boolean = false): Promise => { //@ts-expect-error private diff --git a/test/adapter/ezsp/uart.test.ts b/test/adapter/ezsp/uart.test.ts index 1b2cc8b484..12657c0e45 100644 --- a/test/adapter/ezsp/uart.test.ts +++ b/test/adapter/ezsp/uart.test.ts @@ -1,9 +1,10 @@ import 'regenerator-runtime/runtime'; -import {SerialPort} from '../../../src/adapter/serialPort'; + +import {FrameType} from '../../../src/adapter/ezsp/driver/frame'; +import {Parser} from '../../../src/adapter/ezsp/driver/parser'; import {SerialDriver} from '../../../src/adapter/ezsp/driver/uart'; import {Writer} from '../../../src/adapter/ezsp/driver/writer'; -import {Parser} from '../../../src/adapter/ezsp/driver/parser'; -import {FrameType} from '../../../src/adapter/ezsp/driver/frame'; +import {SerialPort} from '../../../src/adapter/serialPort'; let mockParser; const mockSerialPortClose = jest.fn().mockImplementation((cb) => (cb ? cb() : null)); diff --git a/test/adapter/z-stack/adapter.test.ts b/test/adapter/z-stack/adapter.test.ts index e18f7068d8..a4f797711a 100644 --- a/test/adapter/z-stack/adapter.test.ts +++ b/test/adapter/z-stack/adapter.test.ts @@ -1,19 +1,22 @@ import 'regenerator-runtime/runtime'; -import {Znp} from '../../../src/adapter/z-stack/znp'; -import {ZStackAdapter} from '../../../src/adapter/z-stack/adapter'; -import {DevStates, NvItemsIds, NvSystemIds, ZnpCommandStatus} from '../../../src/adapter/z-stack/constants/common'; -import {Subsystem, Type} from '../../../src/adapter/z-stack/unpi/constants'; -import equals from 'fast-deep-equal/es6'; -import {ZnpVersion} from '../../../src/adapter/z-stack/adapter/tstype'; -import * as Structs from '../../../src/adapter/z-stack/structs'; + import * as fs from 'fs'; import * as path from 'path'; -import * as Zcl from '../../../src/zspec/zcl'; -import * as Constants from '../../../src/adapter/z-stack/constants'; + +import equals from 'fast-deep-equal/es6'; + import {ZclPayload} from '../../../src/adapter/events'; +import {ZStackAdapter} from '../../../src/adapter/z-stack/adapter'; +import {ZnpVersion} from '../../../src/adapter/z-stack/adapter/tstype'; +import * as Constants from '../../../src/adapter/z-stack/constants'; +import {DevStates, NvItemsIds, NvSystemIds, ZnpCommandStatus} from '../../../src/adapter/z-stack/constants/common'; +import * as Structs from '../../../src/adapter/z-stack/structs'; +import {Subsystem, Type} from '../../../src/adapter/z-stack/unpi/constants'; +import {Znp} from '../../../src/adapter/z-stack/znp'; import {UnifiedBackupStorage} from '../../../src/models'; import {setLogger} from '../../../src/utils/logger'; import {BroadcastAddress} from '../../../src/zspec/enums'; +import * as Zcl from '../../../src/zspec/zcl'; import {Status} from '../../../src/zspec/zdo'; const mockLogger = { diff --git a/test/adapter/z-stack/unpi.test.ts b/test/adapter/z-stack/unpi.test.ts index 0b1de61604..698ef62036 100644 --- a/test/adapter/z-stack/unpi.test.ts +++ b/test/adapter/z-stack/unpi.test.ts @@ -1,4 +1,4 @@ -import {Parser, Constants, Frame, Writer} from '../../../src/adapter/z-stack/unpi'; +import {Constants, Frame, Parser, Writer} from '../../../src/adapter/z-stack/unpi'; describe('Parser', () => { let parser; diff --git a/test/adapter/z-stack/znp.test.ts b/test/adapter/z-stack/znp.test.ts index 8bb5c9bdd9..eb30e98bf8 100644 --- a/test/adapter/z-stack/znp.test.ts +++ b/test/adapter/z-stack/znp.test.ts @@ -1,10 +1,11 @@ import 'regenerator-runtime/runtime'; -import {Znp, ZpiObject} from '../../../src/adapter/z-stack/znp'; + import {SerialPort} from '../../../src/adapter/serialPort'; -import {Frame as UnpiFrame, Constants as UnpiConstants} from '../../../src/adapter/z-stack/unpi'; -import {duplicateArray, ieeeaAddr1, ieeeaAddr2} from '../../testUtils'; +import {Constants as UnpiConstants, Frame as UnpiFrame} from '../../../src/adapter/z-stack/unpi'; +import {Znp, ZpiObject} from '../../../src/adapter/z-stack/znp'; import BuffaloZnp from '../../../src/adapter/z-stack/znp/buffaloZnp'; import ParameterType from '../../../src/adapter/z-stack/znp/parameterType'; +import {duplicateArray, ieeeaAddr1, ieeeaAddr2} from '../../testUtils'; const mockSerialPortClose = jest.fn().mockImplementation((cb) => (cb ? cb() : null)); const mockSerialPortFlush = jest.fn().mockImplementation((cb) => cb()); diff --git a/test/buffalo.test.ts b/test/buffalo.test.ts index cf93470182..979fc592be 100644 --- a/test/buffalo.test.ts +++ b/test/buffalo.test.ts @@ -1,4 +1,5 @@ import 'regenerator-runtime/runtime'; + import {Buffalo} from '../src/buffalo'; import {ieeeaAddr1, ieeeaAddr2} from './testUtils'; diff --git a/test/controller.test.ts b/test/controller.test.ts index 8660a2b257..a4fbf3d72b 100755 --- a/test/controller.test.ts +++ b/test/controller.test.ts @@ -1,23 +1,27 @@ import 'regenerator-runtime/runtime'; -import {Controller} from '../src/controller'; -import {ZStackAdapter} from '../src/adapter/z-stack/adapter'; + +import fs from 'fs'; +import path from 'path'; + +import Bonjour, {BrowserConfig, Service} from 'bonjour-service'; +import equals from 'fast-deep-equal/es6'; + +import {Adapter} from '../src/adapter'; import {DeconzAdapter} from '../src/adapter/deconz/adapter'; +import {ZStackAdapter} from '../src/adapter/z-stack/adapter'; import {ZiGateAdapter} from '../src/adapter/zigate/adapter'; -import equals from 'fast-deep-equal/es6'; -import fs from 'fs'; -import {Device, Group} from '../src/controller/model'; -import * as Zcl from '../src/zspec/zcl'; -import zclTransactionSequenceNumber from '../src/controller/helpers/zclTransactionSequenceNumber'; +import {Controller} from '../src/controller'; import Request from '../src/controller/helpers/request'; -import {Adapter} from '../src/adapter'; -import path from 'path'; -import {Wait} from '../src/utils'; +import zclTransactionSequenceNumber from '../src/controller/helpers/zclTransactionSequenceNumber'; +import ZclTransactionSequenceNumber from '../src/controller/helpers/zclTransactionSequenceNumber'; +import {Device, Group} from '../src/controller/model'; import * as Models from '../src/models'; +import {Wait} from '../src/utils'; import * as Utils from '../src/utils'; -import Bonjour, {BrowserConfig, Service} from 'bonjour-service'; import {setLogger} from '../src/utils/logger'; import {BroadcastAddress} from '../src/zspec/enums'; -import ZclTransactionSequenceNumber from '../src/controller/helpers/zclTransactionSequenceNumber'; +import * as Zcl from '../src/zspec/zcl'; + const globalSetImmediate = setImmediate; const flushPromises = () => new Promise(globalSetImmediate); diff --git a/test/utils.test.ts b/test/utils.test.ts index e04ba51a13..7e2ce24226 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -1,5 +1,6 @@ import 'regenerator-runtime/runtime'; -import {Utils, Wait, Queue, Waitress} from '../src/utils'; + +import {Queue, Utils, Wait, Waitress} from '../src/utils'; import {logger, setLogger} from '../src/utils/logger'; const mockLogger = { diff --git a/test/zcl.test.ts b/test/zcl.test.ts index ae78dfc034..869ba196ac 100644 --- a/test/zcl.test.ts +++ b/test/zcl.test.ts @@ -1,7 +1,8 @@ import 'regenerator-runtime/runtime'; + import * as Zcl from '../src/zspec/zcl'; -import {BuffaloZclDataType, DataType, FrameType, Direction, StructuredIndicatorType} from '../src/zspec/zcl/definition/enums'; import {BuffaloZcl} from '../src/zspec/zcl/buffaloZcl'; +import {BuffaloZclDataType, DataType, Direction, FrameType, StructuredIndicatorType} from '../src/zspec/zcl/definition/enums'; describe('Zcl', () => { it('Get cluster by name', () => { diff --git a/test/zspec/zdo/buffalo.test.ts b/test/zspec/zdo/buffalo.test.ts index 0c997a9d0f..57dac17a22 100644 --- a/test/zspec/zdo/buffalo.test.ts +++ b/test/zspec/zdo/buffalo.test.ts @@ -4,9 +4,9 @@ import * as Zcl from '../../../src/zspec/zcl'; import * as Zdo from '../../../src/zspec/zdo'; import {BuffaloZdo} from '../../../src/zspec/zdo/buffaloZdo'; import { + ActiveEndpointsResponse, APSFrameCounterChallengeTLV, APSFrameCounterResponseTLV, - ActiveEndpointsResponse, AuthenticationTokenIdTLV, BeaconAppendixEncapsulationGlobalTLV, BeaconSurveyConfigurationTLV, From 6cc25cb4859b58d47d6188bb6810449904611f22 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Sat, 17 Aug 2024 23:13:09 +0200 Subject: [PATCH 3/4] Manual fixes --- src/adapter/deconz/adapter/deconzAdapter.ts | 24 ++++++---------- src/adapter/deconz/driver/frameParser.ts | 30 +++++++++++++------- src/adapter/ember/adapter/emberAdapter.ts | 4 ++- src/adapter/ember/ezsp/buffalo.ts | 6 ++-- src/adapter/ember/uart/ash.ts | 3 +- src/adapter/ezsp/adapter/ezspAdapter.ts | 28 ++++++++---------- src/adapter/ezsp/driver/multicast.ts | 2 +- src/adapter/z-stack/adapter/zStackAdapter.ts | 4 ++- src/adapter/z-stack/structs/struct.ts | 6 ++-- src/adapter/z-stack/znp/znp.ts | 2 +- src/adapter/zigate/driver/zigate.ts | 3 +- src/controller/greenPower.ts | 12 ++++++-- src/controller/model/device.ts | 2 +- src/controller/model/endpoint.ts | 10 +++---- 14 files changed, 75 insertions(+), 61 deletions(-) diff --git a/src/adapter/deconz/adapter/deconzAdapter.ts b/src/adapter/deconz/adapter/deconzAdapter.ts index 719aa544b1..07f8814c8b 100644 --- a/src/adapter/deconz/adapter/deconzAdapter.ts +++ b/src/adapter/deconz/adapter/deconzAdapter.ts @@ -759,7 +759,9 @@ class DeconzAdapter extends Adapter { if (skip === false) { try { simpleDesc = await this.simpleDescriptor(0x0, 1); - } catch {} + } catch { + /* empty */ + } if (simpleDesc == undefined) { await this.checkCoordinatorSimpleDescriptor(false); @@ -877,7 +879,7 @@ class DeconzAdapter extends Adapter { .then(() => { logger.debug(`sendZclFrameToEndpoint - message send with transSeq Nr.: ${zclFrame.header.transactionSequenceNumber}`, NS); logger.debug( - command.hasOwnProperty('response') + + (command.response !== undefined) + ', ' + zclFrame.header.frameControl.disableDefaultResponse + ', ' + @@ -950,13 +952,8 @@ class DeconzAdapter extends Adapter { request.txOptions = 0; request.radius = PARAM.PARAM.txRadius.UNLIMITED; - try { - logger.debug(`sendZclFrameToGroup - message send`, NS); - return this.driver.enqueueSendDataRequest(request) as Promise; - } catch (error) { - //logger.debug(`sendZclFrameToGroup ERROR: ${error}`, NS); - throw error; - } + logger.debug(`sendZclFrameToGroup - message send`, NS); + return this.driver.enqueueSendDataRequest(request) as Promise; } public async sendZclFrameToAll(endpoint: number, zclFrame: Zcl.Frame, sourceEndpoint: number, destination: BroadcastAddress): Promise { @@ -979,13 +976,8 @@ class DeconzAdapter extends Adapter { request.txOptions = 0; request.radius = PARAM.PARAM.txRadius.UNLIMITED; - try { - logger.debug(`sendZclFrameToAll - message send`, NS); - return this.driver.enqueueSendDataRequest(request) as Promise; - } catch (error) { - //logger.debug(`sendZclFrameToAll ERROR: ${error}`, NS); - throw error; - } + logger.debug(`sendZclFrameToAll - message send`, NS); + return this.driver.enqueueSendDataRequest(request) as Promise; } public async bind( diff --git a/src/adapter/deconz/driver/frameParser.ts b/src/adapter/deconz/driver/frameParser.ts index 74d6c169c6..44eef27fe6 100644 --- a/src/adapter/deconz/driver/frameParser.ts +++ b/src/adapter/deconz/driver/frameParser.ts @@ -36,7 +36,7 @@ function parseReadParameterResponse(view: DataView): Command | null { const parameterId = view.getUint8(7); switch (parameterId) { - case PARAM.PARAM.Network.MAC: + case PARAM.PARAM.Network.MAC: { const mac: ParamMac = view.getBigUint64(8, littleEndian).toString(16); let result = mac; while (result.length < 16) { @@ -45,15 +45,18 @@ function parseReadParameterResponse(view: DataView): Command | null { result = '0x' + result; logger.debug(`MAC: ${result}`, NS); return result; - case PARAM.PARAM.Network.PAN_ID: + } + case PARAM.PARAM.Network.PAN_ID: { const panId: ParamPanId = view.getUint16(8, littleEndian); logger.debug('PANID: ' + panId.toString(16), NS); return panId; - case PARAM.PARAM.Network.NWK_ADDRESS: + } + case PARAM.PARAM.Network.NWK_ADDRESS: { const nwkAddr: ParamNwkAddr = view.getUint16(8, littleEndian); logger.debug('NWKADDR: ' + nwkAddr.toString(16), NS); return nwkAddr; - case PARAM.PARAM.Network.EXT_PAN_ID: + } + case PARAM.PARAM.Network.EXT_PAN_ID: { const extPanId: ParamExtPanId = view.getBigUint64(8, littleEndian).toString(16); let res = extPanId; while (res.length < 16) { @@ -62,7 +65,8 @@ function parseReadParameterResponse(view: DataView): Command | null { res = '0x' + res; logger.debug(`EXT_PANID: ${res}`, NS); return res; - case PARAM.PARAM.Network.APS_EXT_PAN_ID: + } + case PARAM.PARAM.Network.APS_EXT_PAN_ID: { const apsExtPanId: ParamExtPanId = view.getBigUint64(8, littleEndian).toString(16); let resAEPID = apsExtPanId; while (resAEPID.length < 16) { @@ -71,7 +75,8 @@ function parseReadParameterResponse(view: DataView): Command | null { resAEPID = '0x' + resAEPID; logger.debug(`APS_EXT_PANID: ${resAEPID}`, NS); return resAEPID; - case PARAM.PARAM.Network.NETWORK_KEY: + } + case PARAM.PARAM.Network.NETWORK_KEY: { const networkKey1 = view.getBigUint64(9).toString(16); let res1 = networkKey1; while (res1.length < 16) { @@ -84,22 +89,27 @@ function parseReadParameterResponse(view: DataView): Command | null { } logger.debug('NETWORK_KEY: hidden', NS); return '0x' + res1 + res2; - case PARAM.PARAM.Network.CHANNEL: + } + case PARAM.PARAM.Network.CHANNEL: { const channel: ParamChannel = view.getUint8(8); logger.debug('CHANNEL: ' + channel, NS); return channel; - case PARAM.PARAM.Network.CHANNEL_MASK: + } + case PARAM.PARAM.Network.CHANNEL_MASK: { const chMask: ParamChannelMask = view.getUint32(8, littleEndian); logger.debug('CHANNELMASK: ' + chMask.toString(16), NS); return chMask; - case PARAM.PARAM.Network.PERMIT_JOIN: + } + case PARAM.PARAM.Network.PERMIT_JOIN: { const permitJoin: ParamPermitJoin = view.getUint8(8); logger.debug('PERMIT_JOIN: ' + permitJoin, NS); return permitJoin; - case PARAM.PARAM.Network.WATCHDOG_TTL: + } + case PARAM.PARAM.Network.WATCHDOG_TTL: { const ttl: ParamPermitJoin = view.getUint32(8); logger.debug('WATCHDOG_TTL: ' + ttl, NS); return ttl; + } default: //throw new Error(`unknown parameter id ${parameterId}`); logger.debug(`unknown parameter id ${parameterId}`, NS); diff --git a/src/adapter/ember/adapter/emberAdapter.ts b/src/adapter/ember/adapter/emberAdapter.ts index 1422b43229..2b96ef3ff3 100644 --- a/src/adapter/ember/adapter/emberAdapter.ts +++ b/src/adapter/ember/adapter/emberAdapter.ts @@ -381,7 +381,9 @@ export class EmberAdapter extends Adapter { logger.info(`Using stack config ${JSON.stringify(config)}.`, NS); return config; - } catch {} + } catch { + /* empty */ + } logger.info(`Using default stack config.`, NS); return DEFAULT_STACK_CONFIG; diff --git a/src/adapter/ember/ezsp/buffalo.ts b/src/adapter/ember/ezsp/buffalo.ts index abe5e66ba1..ecea7cfc0a 100644 --- a/src/adapter/ember/ezsp/buffalo.ts +++ b/src/adapter/ember/ezsp/buffalo.ts @@ -904,7 +904,7 @@ export class EzspBuffalo extends Buffalo { case EmberGpSinkType.FULL_UNICAST: case EmberGpSinkType.LW_UNICAST: case EmberGpSinkType.UNUSED: - default: + default: { const sinkNodeId = this.readUInt16(); const sinkEUI = this.readIeeeAddr(); @@ -916,8 +916,9 @@ export class EzspBuffalo extends Buffalo { }, }); break; + } case EmberGpSinkType.D_GROUPCAST: - case EmberGpSinkType.GROUPCAST: + case EmberGpSinkType.GROUPCAST: { const alias = this.readUInt16(); const groupID = this.readUInt16(); @@ -934,6 +935,7 @@ export class EzspBuffalo extends Buffalo { }, }); break; + } } } diff --git a/src/adapter/ember/uart/ash.ts b/src/adapter/ember/uart/ash.ts index b0d6c46613..17d5737a1b 100644 --- a/src/adapter/ember/uart/ash.ts +++ b/src/adapter/ember/uart/ash.ts @@ -1134,7 +1134,7 @@ export class UartAsh extends EventEmitter { // Process frames received while connected switch (frameType) { - case AshFrameType.DATA: + case AshFrameType.DATA: { frmNum = ashGetFrmNum(this.rxSHBuffer[0]); const frameStr = `[FRAME type=${frameTypeStr} ackNum=${ackNum} frmNum=${frmNum}](frmRx=${this.frmRx})`; @@ -1186,6 +1186,7 @@ export class UartAsh extends EventEmitter { } } break; + } case AshFrameType.ACK: // already fully processed break; diff --git a/src/adapter/ezsp/adapter/ezspAdapter.ts b/src/adapter/ezsp/adapter/ezspAdapter.ts index 7b9f703495..27dbc9fbe1 100644 --- a/src/adapter/ezsp/adapter/ezspAdapter.ts +++ b/src/adapter/ezsp/adapter/ezspAdapter.ts @@ -701,22 +701,18 @@ class EZSPAdapter extends Adapter { public async sendZclFrameInterPANToIeeeAddr(zclFrame: Zcl.Frame, ieeeAddr: string): Promise { return this.queue.execute(async () => { logger.debug(`sendZclFrameInterPANToIeeeAddr to ${ieeeAddr}`, NS); - try { - const frame = this.driver.makeEmberIeeeRawFrame(); - frame.ieeeFrameControl = 0xcc21; - frame.destPanId = 0xffff; - frame.destAddress = new EmberEUI64(ieeeAddr); - frame.sourcePanId = this.driver.networkParams.panId; - frame.sourceAddress = this.driver.ieee; - frame.nwkFrameControl = 0x000b; - frame.appFrameControl = 0x03; - frame.clusterId = zclFrame.cluster.ID; - frame.profileId = 0xc05e; - - await this.driver.ieeerawrequest(frame, zclFrame.toBuffer()); - } catch (error) { - throw error; - } + const frame = this.driver.makeEmberIeeeRawFrame(); + frame.ieeeFrameControl = 0xcc21; + frame.destPanId = 0xffff; + frame.destAddress = new EmberEUI64(ieeeAddr); + frame.sourcePanId = this.driver.networkParams.panId; + frame.sourceAddress = this.driver.ieee; + frame.nwkFrameControl = 0x000b; + frame.appFrameControl = 0x03; + frame.clusterId = zclFrame.cluster.ID; + frame.profileId = 0xc05e; + + await this.driver.ieeerawrequest(frame, zclFrame.toBuffer()); }); } diff --git a/src/adapter/ezsp/driver/multicast.ts b/src/adapter/ezsp/driver/multicast.ts index e6395a7a64..14a9f2065a 100644 --- a/src/adapter/ezsp/driver/multicast.ts +++ b/src/adapter/ezsp/driver/multicast.ts @@ -47,7 +47,7 @@ export class Multicast { } public async subscribe(group_id: number, endpoint: number): Promise { - if (this._multicast.hasOwnProperty(group_id)) { + if (this._multicast[group_id] !== undefined) { logger.debug(`${group_id} is already subscribed`, NS); return EmberStatus.SUCCESS; } diff --git a/src/adapter/z-stack/adapter/zStackAdapter.ts b/src/adapter/z-stack/adapter/zStackAdapter.ts index ad192a9d44..102c007d86 100644 --- a/src/adapter/z-stack/adapter/zStackAdapter.ts +++ b/src/adapter/z-stack/adapter/zStackAdapter.ts @@ -566,7 +566,9 @@ class ZStackAdapter extends Adapter { } else { logger.debug('Network address did not change', NS); } - } catch {} + } catch { + /* empty */ + } } else { logger.debug('Wait 2000ms', NS); await Wait(2000); diff --git a/src/adapter/z-stack/structs/struct.ts b/src/adapter/z-stack/structs/struct.ts index 1058360afc..c021a6261d 100644 --- a/src/adapter/z-stack/structs/struct.ts +++ b/src/adapter/z-stack/structs/struct.ts @@ -75,11 +75,12 @@ export class Struct implements SerializableMemoryObject { aligned.set(this.buffer.slice(member.offset, member.offset + member.length), offset); offset += member.length; break; - case 'struct': + case 'struct': { const structData = this.childStructs[member.key].struct.serialize(alignment, false, offset); aligned.set(structData, offset); offset += structData.length; break; + } } } return aligned; @@ -347,12 +348,13 @@ export class Struct implements SerializableMemoryObject { this.buffer.set(data.slice(offset, offset + member.length), member.offset); offset += member.length; break; - case 'struct': + case 'struct': { const child = this.childStructs[member.key]; child.struct.build(data.slice(offset, offset + child.struct.length)); this.buffer.set(child.struct.serialize(), member.offset); offset += child.struct.length; break; + } } } } else { diff --git a/src/adapter/z-stack/znp/znp.ts b/src/adapter/z-stack/znp/znp.ts index 7b2bc71e6d..863d933431 100755 --- a/src/adapter/z-stack/znp/znp.ts +++ b/src/adapter/z-stack/znp/znp.ts @@ -298,7 +298,7 @@ class Znp extends events.EventEmitter { const waiter = this.waitress.waitFor({type: Type.SRSP, subsystem: object.subsystem, command: object.command}, timeout || t); this.unpiWriter.writeFrame(frame); const result = await waiter.start().promise; - if (result && result.payload.hasOwnProperty('status') && !expectedStatuses.includes(result.payload.status)) { + if (result?.payload.status !== undefined && !expectedStatuses.includes(result.payload.status)) { if (typeof waiterID === 'number') { this.waitress.remove(waiterID); } diff --git a/src/adapter/zigate/driver/zigate.ts b/src/adapter/zigate/driver/zigate.ts index fd19cfe7f2..9b258fd270 100644 --- a/src/adapter/zigate/driver/zigate.ts +++ b/src/adapter/zigate/driver/zigate.ts @@ -283,11 +283,12 @@ export default class ZiGate extends EventEmitter { switch (ziGateObject.payload.profileID) { case 0x0000: switch (ziGateObject.payload.clusterID) { - case 0x0013: + case 0x0013: { const networkAddress = ziGateObject.payload.payload.readUInt16LE(1); const ieeeAddr = new Buffalo(ziGateObject.payload.payload.slice(3, 11)).readIeeeAddr(); this.emit('DeviceAnnounce', networkAddress, ieeeAddr); break; + } } break; case 0x0104: diff --git a/src/controller/greenPower.ts b/src/controller/greenPower.ts index 18e09a9e35..43ab844681 100644 --- a/src/controller/greenPower.ts +++ b/src/controller/greenPower.ts @@ -59,11 +59,13 @@ class GreenPower extends events.EventEmitter { break; /* istanbul ignore next */ case 0b00: // Full unicast forwarding - case 0b11: // Lightweight unicast forwarding + case 0b11: { + // Lightweight unicast forwarding const coordinator = await this.adapter.getCoordinator(); payload.sinkIEEEAddr = coordinator.ieeeAddr; payload.sinkNwkAddr = coordinator.networkAddress; break; + } /* istanbul ignore next */ default: logger.error(`Unhandled applicationID: ${payload.options & 7}`, NS); @@ -103,7 +105,8 @@ class GreenPower extends events.EventEmitter { case undefined: logger.error(`Received undefined command from '${dataPayload.address}'`, NS); break; - case 0xe0: // GP Commissioning + case 0xe0: { + // GP Commissioning logger.info(`Received commissioning from '${dataPayload.address}'`, NS); /* istanbul ignore if */ @@ -185,11 +188,13 @@ class GreenPower extends events.EventEmitter { }); break; + } /* istanbul ignore next */ case 0xe2: // GP Success logger.debug(`Received success from '${dataPayload.address}'`, NS); break; - case 0xe3: // GP Channel Request + case 0xe3: { + // GP Channel Request logger.debug(`Received channel request from '${dataPayload.address}'`, NS); const networkParameters = await this.adapter.getNetworkParameters(); // Channel notification @@ -220,6 +225,7 @@ class GreenPower extends events.EventEmitter { await this.adapter.sendZclFrameToAll(242, replyFrame, 242, BroadcastAddress.RX_ON_WHEN_IDLE); break; + } /* istanbul ignore next */ case 0xa1: // GP Manufacturer-specific Attribute Reporting break; diff --git a/src/controller/model/device.ts b/src/controller/model/device.ts index 879a39df9d..d76cef18ca 100755 --- a/src/controller/model/device.ts +++ b/src/controller/model/device.ts @@ -538,7 +538,7 @@ class Device extends Entity { /* istanbul ignore else */ } // always load value from database available (modernExtend.quirkCheckinInterval() exists for devices without genPollCtl) - if (entry.hasOwnProperty('checkinInterval')) { + if (entry.checkinInterval !== undefined) { // if the checkin interval is known, messages expire by default after one checkin interval pendingRequestTimeout = entry.checkinInterval * 1000; // milliseconds } diff --git a/src/controller/model/endpoint.ts b/src/controller/model/endpoint.ts index f254f72a21..cc8231003c 100644 --- a/src/controller/model/endpoint.ts +++ b/src/controller/model/endpoint.ts @@ -396,12 +396,12 @@ class Endpoint extends Entity { attributes: KeyValue, options?: Options, ): Promise { - assert(!options || !options.hasOwnProperty('transactionSequenceNumber'), 'Use parameter'); + assert(options?.transactionSequenceNumber === undefined, 'Use parameter'); const cluster = this.getCluster(clusterKey); const payload: {status: number; attrId: number}[] = []; for (const [nameOrID, value] of Object.entries(attributes)) { - if (value.hasOwnProperty('status')) { + if (value.status !== undefined) { if (cluster.hasAttribute(nameOrID)) { const attribute = cluster.getAttribute(nameOrID); payload.push({attrId: attribute.ID, status: value.status}); @@ -455,7 +455,7 @@ class Endpoint extends Entity { attributes: KeyValue, options?: Options, ): Promise { - assert(!options || !options.hasOwnProperty('transactionSequenceNumber'), 'Use parameter'); + assert(options?.transactionSequenceNumber === undefined, 'Use parameter'); const cluster = this.getCluster(clusterKey); const payload: {attrId: number; status: number; dataType: number; attrData: number | string}[] = []; @@ -605,7 +605,7 @@ class Endpoint extends Entity { transactionSequenceNumber: number, options?: Options, ): Promise { - assert(!options || !options.hasOwnProperty('transactionSequenceNumber'), 'Use parameter'); + assert(options?.transactionSequenceNumber === undefined, 'Use parameter'); const payload = {cmdId: commandID, statusCode: status}; await this.zclCommand(clusterID, 'defaultRsp', payload, {direction: Zcl.Direction.SERVER_TO_CLIENT, ...options, transactionSequenceNumber}); } @@ -693,7 +693,7 @@ class Endpoint extends Entity { options?: Options, transactionSequenceNumber?: number, ): Promise { - assert(!options || options.transactionSequenceNumber === undefined, 'Use parameter'); + assert(options?.transactionSequenceNumber === undefined, 'Use parameter'); const device = this.getDevice(); const cluster = this.getCluster(clusterKey, device); From e0e1bc3450c5fa5b1ca68de2f6e72f09cbf1ed59 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Sun, 18 Aug 2024 13:59:03 +0200 Subject: [PATCH 4/4] Feedback --- .prettierrc | 17 ++++++++++++++++- src/adapter/ezsp/adapter/backup.ts | 6 +++--- src/adapter/z-stack/adapter/adapter-backup.ts | 7 +++---- src/utils/backup.ts | 5 ++--- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.prettierrc b/.prettierrc index 7414ca72f4..d8de3f2638 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,6 +6,21 @@ "bracketSpacing": false, "endOfLine": "lf", "tabWidth": 4, - "importOrder": ["", "^node:", "", "", "", "^zigbee", "", "^[./]"], + "importOrder": [ + "", + "^(node:)", + "", + "", + "", + "^[.]", + "", + "", + "", + "", + "", + "^zigbee", + "", + "^[.]" + ], "plugins": ["@ianvs/prettier-plugin-sort-imports"] } diff --git a/src/adapter/ezsp/adapter/backup.ts b/src/adapter/ezsp/adapter/backup.ts index 0338954406..f66eb23034 100644 --- a/src/adapter/ezsp/adapter/backup.ts +++ b/src/adapter/ezsp/adapter/backup.ts @@ -1,6 +1,6 @@ /* istanbul ignore file */ -import {fs} from 'mz'; +import * as fs from 'fs'; import * as Models from '../../../models'; import {BackupUtils} from '../../../utils'; @@ -79,13 +79,13 @@ export class EZSPAdapterBackup { */ public async getStoredBackup(): Promise { try { - await fs.access(this.defaultPath); + fs.accessSync(this.defaultPath); } catch { return undefined; } let data; try { - data = JSON.parse((await fs.readFile(this.defaultPath)).toString()); + data = JSON.parse(fs.readFileSync(this.defaultPath).toString()); } catch (error) { throw new Error(`Coordinator backup is corrupted (${(error as Error).stack})`); } diff --git a/src/adapter/z-stack/adapter/adapter-backup.ts b/src/adapter/z-stack/adapter/adapter-backup.ts index b16d47774f..20a8c8f921 100644 --- a/src/adapter/z-stack/adapter/adapter-backup.ts +++ b/src/adapter/z-stack/adapter/adapter-backup.ts @@ -1,6 +1,5 @@ import assert from 'assert'; - -import {fs} from 'mz'; +import * as fs from 'fs'; import * as Models from '../../../models'; import {BackupUtils} from '../../../utils'; @@ -36,13 +35,13 @@ export class AdapterBackup { */ public async getStoredBackup(): Promise { try { - await fs.access(this.defaultPath); + fs.accessSync(this.defaultPath); } catch { return undefined; } let data; try { - data = JSON.parse((await fs.readFile(this.defaultPath)).toString()); + data = JSON.parse(fs.readFileSync(this.defaultPath).toString()); } catch (error) { throw new Error(`Coordinator backup is corrupted (${error})`); } diff --git a/src/utils/backup.ts b/src/utils/backup.ts index e4866e81f2..5d93db5437 100644 --- a/src/utils/backup.ts +++ b/src/utils/backup.ts @@ -1,7 +1,6 @@ +import * as fs from 'fs'; import * as path from 'path'; -import {fs} from 'mz'; - import * as ZStackStructs from '../adapter/z-stack/structs'; import * as ZStackUtils from '../adapter/z-stack/utils'; import * as Models from '../models'; @@ -13,7 +12,7 @@ import * as Models from '../models'; * @param backup Backup to create unified backup format from. */ export const toUnifiedBackup = async (backup: Models.Backup): Promise => { - const packageInfo = JSON.parse((await fs.readFile(path.join(__dirname, '../../', 'package.json'))).toString()); + const packageInfo = JSON.parse(fs.readFileSync(path.join(__dirname, '../../', 'package.json')).toString()); /* istanbul ignore next */ return {