From 24d86f2c0a91c31582b091bc666b259c2874967c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Mon, 12 Aug 2024 17:06:41 +0200 Subject: [PATCH] Update to ESLint 9 (#304) --- .eslintrc.js | 179 ----- .github/workflows/mediasoup-client.yaml | 10 +- eslint.config.mjs | 187 +++++ npm-scripts.mjs | 7 +- package-lock.json | 866 +++++++++++++----------- package.json | 20 +- src/Consumer.ts | 2 +- src/DataConsumer.ts | 2 +- src/DataProducer.ts | 2 +- src/Device.ts | 3 +- src/Producer.ts | 2 +- src/Transport.ts | 24 +- src/errors.ts | 3 - src/handlers/Chrome111.ts | 13 +- src/handlers/Chrome55.ts | 13 +- src/handlers/Chrome67.ts | 13 +- src/handlers/Chrome70.ts | 17 +- src/handlers/Chrome74.ts | 15 +- src/handlers/Edge11.ts | 10 +- src/handlers/FakeHandler.ts | 8 +- src/handlers/Firefox120.ts | 18 +- src/handlers/Firefox60.ts | 32 +- src/handlers/ReactNative.ts | 13 +- src/handlers/ReactNativeUnifiedPlan.ts | 17 +- src/handlers/Safari11.ts | 13 +- src/handlers/Safari12.ts | 17 +- src/handlers/ortc/edgeUtils.ts | 20 +- src/handlers/ortc/utils.ts | 2 +- src/handlers/sdp/MediaSection.ts | 28 +- src/handlers/sdp/RemoteSdp.ts | 2 +- src/handlers/sdp/commonUtils.ts | 2 +- src/handlers/sdp/planBUtils.ts | 4 +- src/handlers/sdp/unifiedPlanUtils.ts | 8 +- src/ortc.ts | 14 +- src/scalabilityModes.ts | 2 +- src/test/fakeParameters.ts | 15 +- src/test/test.ts | 95 +-- tsconfig.json | 2 +- 38 files changed, 882 insertions(+), 818 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5fcd0c7a..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,179 +0,0 @@ -const eslintConfig = { - env: { - es6: true, - node: true, - browser: true, - }, - plugins: ['prettier'], - settings: {}, - parserOptions: { - ecmaVersion: 2022, - sourceType: 'module', - ecmaFeatures: { - impliedStrict: true, - }, - lib: ['es2022', 'dom'], - }, - globals: { - NodeJS: 'readonly', - }, - extends: ['eslint:recommended', 'plugin:prettier/recommended'], - rules: { - 'prettier/prettier': 2, - 'constructor-super': 2, - curly: [2, 'all'], - // Unfortunatelly `curly` does not apply to blocks in `switch` cases so - // this is needed. - 'no-restricted-syntax': [ - 2, - { - selector: 'SwitchCase > *.consequent[type!="BlockStatement"]', - message: 'Switch cases without blocks are disallowed', - }, - ], - 'guard-for-in': 2, - 'newline-after-var': 2, - 'newline-before-return': 2, - 'no-alert': 2, - 'no-caller': 2, - 'no-case-declarations': 2, - 'no-catch-shadow': 2, - 'no-class-assign': 2, - 'no-console': 2, - 'no-const-assign': 2, - 'no-debugger': 2, - 'no-dupe-args': 2, - 'no-dupe-keys': 2, - 'no-duplicate-case': 2, - 'no-div-regex': 2, - 'no-empty': [2, { allowEmptyCatch: true }], - 'no-empty-pattern': 2, - 'no-else-return': 0, - 'no-eval': 2, - 'no-extend-native': 2, - 'no-ex-assign': 2, - 'no-extra-bind': 2, - 'no-extra-boolean-cast': 2, - 'no-extra-label': 2, - 'no-fallthrough': 2, - 'no-func-assign': 2, - 'no-global-assign': 2, - 'no-implicit-coercion': 2, - 'no-implicit-globals': 2, - 'no-inner-declarations': 2, - 'no-invalid-regexp': 2, - 'no-invalid-this': 2, - 'no-irregular-whitespace': 2, - 'no-lonely-if': 2, - 'no-multi-str': 2, - 'no-native-reassign': 2, - 'no-negated-in-lhs': 2, - 'no-new': 2, - 'no-new-func': 2, - 'no-new-wrappers': 2, - 'no-obj-calls': 2, - 'no-proto': 2, - 'no-prototype-builtins': 0, - 'no-redeclare': 2, - 'no-regex-spaces': 2, - 'no-restricted-imports': 2, - 'no-return-assign': 2, - 'no-self-assign': 2, - 'no-self-compare': 2, - 'no-sequences': 2, - 'no-shadow': 2, - 'no-shadow-restricted-names': 2, - 'no-sparse-arrays': 2, - 'no-this-before-super': 2, - 'no-throw-literal': 2, - 'no-undef': 2, - 'no-unmodified-loop-condition': 2, - 'no-unreachable': 2, - 'no-unused-vars': [1, { vars: 'all', args: 'after-used' }], - 'no-use-before-define': 0, - 'no-useless-call': 2, - 'no-useless-computed-key': 2, - 'no-useless-concat': 2, - 'no-useless-rename': 2, - 'no-var': 2, - 'object-curly-newline': 0, - 'prefer-const': 2, - 'prefer-rest-params': 2, - 'prefer-spread': 2, - 'prefer-template': 2, - 'spaced-comment': [2, 'always'], - strict: 2, - 'valid-typeof': 2, - yoda: 2, - }, - overrides: [], -}; - -const tsRules = { - 'no-unused-vars': 0, - '@typescript-eslint/ban-types': 0, - '@typescript-eslint/ban-ts-comment': 0, - '@typescript-eslint/ban-ts-ignore': 0, - '@typescript-eslint/explicit-module-boundary-types': 0, - '@typescript-eslint/semi': 2, - '@typescript-eslint/member-delimiter-style': [ - 2, - { - multiline: { delimiter: 'semi', requireLast: true }, - singleline: { delimiter: 'semi', requireLast: false }, - }, - ], - '@typescript-eslint/no-explicit-any': 0, - '@typescript-eslint/no-unused-vars': [ - 2, - { - vars: 'all', - args: 'after-used', - ignoreRestSiblings: false, - }, - ], - '@typescript-eslint/no-use-before-define': [2, { functions: false }], - '@typescript-eslint/no-empty-function': 0, - '@typescript-eslint/no-non-null-assertion': 0, -}; - -eslintConfig.overrides.push({ - files: ['*.ts'], - parser: '@typescript-eslint/parser', - parserOptions: { - ...eslintConfig.parserOptions, - project: 'tsconfig.json', - }, - plugins: [...eslintConfig.plugins, '@typescript-eslint'], - extends: [ - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - ...eslintConfig.extends, - ], - rules: { ...eslintConfig.rules, ...tsRules }, -}); - -eslintConfig.overrides.push({ - files: ['src/test/*.ts'], - parserOptions: { - ...eslintConfig.parserOptions, - project: 'tsconfig.json', - }, - env: { - ...eslintConfig.env, - 'jest/globals': true, - }, - extends: [ - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - ...eslintConfig.extends, - ], - plugins: [...eslintConfig.plugins, '@typescript-eslint', 'jest'], - rules: { - ...eslintConfig.rules, - ...tsRules, - 'jest/no-disabled-tests': 2, - }, -}); - -module.exports = eslintConfig; diff --git a/.github/workflows/mediasoup-client.yaml b/.github/workflows/mediasoup-client.yaml index 1cedb89c..e2a923a3 100644 --- a/.github/workflows/mediasoup-client.yaml +++ b/.github/workflows/mediasoup-client.yaml @@ -13,18 +13,18 @@ jobs: strategy: matrix: ci: - - os: ubuntu-20.04 - node: 16 - os: ubuntu-20.04 node: 18 - os: ubuntu-22.04 node: 20 + - os: ubuntu-24.04 + node: 22 - os: macos-12 - node: 18 - - os: macos-14 node: 20 + - os: macos-14 + node: 22 - os: windows-2022 - node: 20 + node: 22 runs-on: ${{ matrix.ci.os }} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..769c1e33 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,187 @@ +import eslint from '@eslint/js'; +import tsEslint from 'typescript-eslint'; +import jestEslint from 'eslint-plugin-jest'; +import prettierRecommendedEslint from 'eslint-plugin-prettier/recommended'; +import globals from 'globals'; + +const config = tsEslint.config( + { + languageOptions: { + sourceType: 'module', + globals: { ...globals.node }, + }, + linterOptions: { + noInlineConfig: false, + reportUnusedDisableDirectives: 'error', + }, + }, + eslint.configs.recommended, + { + rules: { + 'constructor-super': 2, + curly: [2, 'all'], + // Unfortunatelly `curly` does not apply to blocks in `switch` cases so + // this is needed. + 'no-restricted-syntax': [ + 2, + { + selector: 'SwitchCase > *.consequent[type!="BlockStatement"]', + message: 'Switch cases without blocks are disallowed', + }, + ], + 'guard-for-in': 2, + 'newline-after-var': 2, + 'newline-before-return': 2, + 'no-alert': 2, + 'no-caller': 2, + 'no-case-declarations': 2, + 'no-catch-shadow': 2, + 'no-class-assign': 2, + 'no-console': 2, + 'no-const-assign': 2, + 'no-debugger': 2, + 'no-dupe-args': 2, + 'no-dupe-keys': 2, + 'no-duplicate-case': 2, + 'no-div-regex': 2, + 'no-empty': [2, { allowEmptyCatch: true }], + 'no-empty-pattern': 2, + 'no-eval': 2, + 'no-extend-native': 2, + 'no-ex-assign': 2, + 'no-extra-bind': 2, + 'no-extra-boolean-cast': 2, + 'no-extra-label': 2, + 'no-fallthrough': 2, + 'no-func-assign': 2, + 'no-global-assign': 2, + 'no-implicit-coercion': 2, + 'no-implicit-globals': 2, + 'no-inner-declarations': 2, + 'no-invalid-regexp': 2, + 'no-invalid-this': 2, + 'no-irregular-whitespace': 2, + 'no-lonely-if': 2, + 'no-multi-str': 2, + 'no-native-reassign': 2, + 'no-negated-in-lhs': 2, + 'no-new': 2, + 'no-new-func': 2, + 'no-new-wrappers': 2, + 'no-obj-calls': 2, + 'no-proto': 2, + 'no-prototype-builtins': 0, + 'no-redeclare': 2, + 'no-regex-spaces': 2, + 'no-restricted-imports': 2, + 'no-return-assign': 2, + 'no-self-assign': 2, + 'no-self-compare': 2, + 'no-sequences': 2, + 'no-shadow': 2, + 'no-shadow-restricted-names': 2, + 'no-sparse-arrays': 2, + 'no-this-before-super': 2, + 'no-throw-literal': 2, + 'no-undef': 2, + 'no-unmodified-loop-condition': 2, + 'no-unreachable': 2, + 'no-unused-vars': [ + 2, + { vars: 'all', args: 'after-used', caughtErrors: 'none' }, + ], + 'no-use-before-define': 0, + 'no-useless-call': 2, + 'no-useless-computed-key': 2, + 'no-useless-concat': 2, + 'no-useless-rename': 2, + 'no-var': 2, + 'object-curly-newline': 0, + 'prefer-const': 2, + 'prefer-rest-params': 2, + 'prefer-spread': 2, + 'prefer-template': 2, + 'spaced-comment': [2, 'always'], + strict: 2, + 'valid-typeof': 2, + yoda: 2, + }, + }, + // NOTE: We need to apply this only to .ts files (and not to .mjs files). + ...tsEslint.configs.recommendedTypeChecked.map(item => ({ + ...item, + files: ['src/**/*.ts'], + })), + // NOTE: We need to apply this only to .ts files (and not to .mjs files). + ...tsEslint.configs.stylisticTypeChecked.map(item => ({ + ...item, + files: ['src/**/*.ts'], + })), + { + name: 'mediasoup-client .ts files', + files: ['src/**/*.ts'], + languageOptions: { + parserOptions: { + projectService: true, + project: 'tsconfig.json', + }, + }, + rules: { + '@typescript-eslint/consistent-generic-constructors': [ + 2, + 'type-annotation', + ], + '@typescript-eslint/dot-notation': 0, + '@typescript-eslint/no-unused-vars': [ + 2, + { + vars: 'all', + args: 'after-used', + caughtErrors: 'none', + ignoreRestSiblings: false, + }, + ], + // We want to use `type` instead of `interface`. + '@typescript-eslint/consistent-type-definitions': 0, + // Sorry, we need many `any` usage. + '@typescript-eslint/no-explicit-any': 0, + '@typescript-eslint/no-unsafe-member-access': 0, + '@typescript-eslint/no-unsafe-assignment': 0, + '@typescript-eslint/no-unsafe-call': 0, + '@typescript-eslint/no-unsafe-return': 0, + '@typescript-eslint/no-unsafe-argument': 0, + '@typescript-eslint/consistent-indexed-object-style': 0, + '@typescript-eslint/no-empty-function': 0, + '@typescript-eslint/require-await': 0, + '@typescript-eslint/restrict-template-expressions': 0, + '@typescript-eslint/no-duplicate-type-constituents': [ + 2, + { ignoreUnions: true }, + ], + '@typescript-eslint/unbound-method': 0, + }, + }, + { + name: 'mediasoup-client .ts test files', + ...jestEslint.configs['flat/recommended'], + files: ['src/test/**/*.ts'], + rules: { + ...jestEslint.configs['flat/recommended'].rules, + 'jest/no-disabled-tests': 2, + 'jest/prefer-expect-assertions': 0, + '@typescript-eslint/no-unnecessary-type-assertion': 0, + }, + }, + prettierRecommendedEslint +); + +// console.log('*** config:***\n', config); + +// console.log( +// '---tsEslint.configs.strictTypeChecked: %o', +// tsEslint.configs.strictTypeChecked +// ); + +// process.exit(1); + +export default config; diff --git a/npm-scripts.mjs b/npm-scripts.mjs index e96e2321..439748e5 100644 --- a/npm-scripts.mjs +++ b/npm-scripts.mjs @@ -7,7 +7,7 @@ const PKG = JSON.parse(fs.readFileSync('./package.json').toString()); const MAYOR_VERSION = PKG.version.split('.')[0]; // Paths for ESLint to check. Converted to string for convenience. -const ESLINT_PATHS = ['src', 'npm-scripts.mjs'].join(' '); +const ESLINT_PATHS = ['eslint.config.mjs', 'src', 'npm-scripts.mjs'].join(' '); // Paths for ESLint to ignore. Converted to string argument for convenience. const ESLINT_IGNORE_PATTERN_ARGS = [] .map(entry => `--ignore-pattern ${entry}`) @@ -17,6 +17,7 @@ const ESLINT_IGNORE_PATTERN_ARGS = [] // node/src/fbs. const PRETTIER_PATHS = [ 'README.md', + 'eslint.config.mjs', 'src', 'npm-scripts.mjs', 'package.json', @@ -165,10 +166,10 @@ function lint() { // Ensure there are no rules that are unnecessary or conflict with Prettier // rules. - executeCmd('eslint-config-prettier .eslintrc.js'); + executeCmd('eslint-config-prettier eslint.config.mjs'); executeCmd( - `eslint -c .eslintrc.js --ext=ts,js,mjs --max-warnings 0 ${ESLINT_IGNORE_PATTERN_ARGS} ${ESLINT_PATHS}` + `eslint -c eslint.config.mjs --max-warnings 0 ${ESLINT_IGNORE_PATTERN_ARGS} ${ESLINT_PATHS}` ); executeCmd(`prettier --check ${PRETTIER_PATHS}`); diff --git a/package-lock.json b/package-lock.json index c05c6e76..ec284f24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@types/debug": "^4.1.12", "@types/npm-events-package": "npm:@types/events@^3.0.3", "awaitqueue": "^3.0.2", - "debug": "^4.3.5", + "debug": "^4.3.6", "fake-mediastreamtrack": "^1.2.0", "h264-profile-level-id": "^2.0.0", "npm-events-package": "npm:events@^3.3.0", @@ -22,21 +22,24 @@ "ua-parser-js": "^1.0.38" }, "devDependencies": { + "@eslint/js": "^9.9.0", "@types/jest": "^29.5.12", - "@types/node": "20", + "@types/node": "22", "@types/sdp-transform": "^2.4.9", "@types/ua-parser-js": "^0.7.39", - "@typescript-eslint/eslint-plugin": "^7.17.0", - "@typescript-eslint/parser": "^7.17.0", - "eslint": "^8.57.0", + "@typescript-eslint/eslint-plugin": "^8.0.1", + "@typescript-eslint/parser": "^8.0.1", + "eslint": "^9.9.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-jest": "^28.6.0", + "eslint-plugin-jest": "^28.8.0", "eslint-plugin-prettier": "^5.2.1", + "globals": "^15.9.0", "jest": "^29.7.0", "open-cli": "^8.0.0", "prettier": "^3.3.3", - "ts-jest": "^29.2.3", - "typescript": "^5.5.4" + "ts-jest": "^29.2.4", + "typescript": "^5.5.4", + "typescript-eslint": "^8.0.1" }, "engines": { "node": ">=16" @@ -655,24 +658,38 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", - "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", + "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", "dev": true, "engines": { "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/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, "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", @@ -680,33 +697,40 @@ "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" } }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "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==", + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.9.0.tgz", + "integrity": "sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.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==", + "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, - "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" - }, "engines": { - "node": ">=10.10.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@humanwhocodes/module-importer": { @@ -721,11 +745,18 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", - "dev": true + "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, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", @@ -1332,12 +1363,12 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.14.2", - "resolved": "https://registry.npmmirror.com/@types/node/-/node-20.14.2.tgz", - "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.2.0.tgz", + "integrity": "sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==", "dev": true, "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.13.0" } }, "node_modules/@types/npm-events-package": { @@ -1377,31 +1408,31 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.17.0.tgz", - "integrity": "sha512-pyiDhEuLM3PuANxH7uNYan1AaFs5XE0zw1hq69JBvGvE7gSuEoQl1ydtEe/XQeoC3GQxLXyOVa5kNOATgM638A==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.0.1.tgz", + "integrity": "sha512-5g3Y7GDFsJAnY4Yhvk8sZtFfV6YNF2caLzjrRPUBzewjPCaj0yokePB4LJSobyCzGMzjZZYFbwuzbfDHlimXbQ==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.17.0", - "@typescript-eslint/type-utils": "7.17.0", - "@typescript-eslint/utils": "7.17.0", - "@typescript-eslint/visitor-keys": "7.17.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", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^7.0.0", - "eslint": "^8.56.0" + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -1410,26 +1441,26 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.17.0.tgz", - "integrity": "sha512-puiYfGeg5Ydop8eusb/Hy1k7QmOU6X3nvsqCgzrB2K4qMavK//21+PzNE8qeECgNOIoertJPUC1SpegHDI515A==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.0.1.tgz", + "integrity": "sha512-5IgYJ9EO/12pOUwiBKFkpU7rS3IU21mtXzB81TNwq2xEybcmAZrE9qwDtsb5uQd9aVO9o0fdabFyAmKveXyujg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.17.0", - "@typescript-eslint/types": "7.17.0", - "@typescript-eslint/typescript-estree": "7.17.0", - "@typescript-eslint/visitor-keys": "7.17.0", + "@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", "debug": "^4.3.4" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" + "eslint": "^8.57.0 || ^9.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -1438,16 +1469,16 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.17.0.tgz", - "integrity": "sha512-0P2jTTqyxWp9HiKLu/Vemr2Rg1Xb5B7uHItdVZ6iAenXmPo4SZ86yOPCJwMqpCyaMiEHTNqizHfsbmCFT1x9SA==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.0.1.tgz", + "integrity": "sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.17.0", - "@typescript-eslint/visitor-keys": "7.17.0" + "@typescript-eslint/types": "8.0.1", + "@typescript-eslint/visitor-keys": "8.0.1" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", @@ -1455,26 +1486,23 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.17.0.tgz", - "integrity": "sha512-XD3aaBt+orgkM/7Cei0XNEm1vwUxQ958AOLALzPlbPqb8C1G8PZK85tND7Jpe69Wualri81PLU+Zc48GVKIMMA==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.0.1.tgz", + "integrity": "sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.17.0", - "@typescript-eslint/utils": "7.17.0", + "@typescript-eslint/typescript-estree": "8.0.1", + "@typescript-eslint/utils": "8.0.1", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, - "peerDependencies": { - "eslint": "^8.56.0" - }, "peerDependenciesMeta": { "typescript": { "optional": true @@ -1482,12 +1510,12 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.17.0.tgz", - "integrity": "sha512-a29Ir0EbyKTKHnZWbNsrc/gqfIBqYPwj3F2M+jWE/9bqfEHg0AMtXzkbUkOG6QgEScxh2+Pz9OXe11jHDnHR7A==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.0.1.tgz", + "integrity": "sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw==", "dev": true, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", @@ -1495,13 +1523,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.17.0.tgz", - "integrity": "sha512-72I3TGq93t2GoSBWI093wmKo0n6/b7O4j9o8U+f65TVD0FS6bI2180X5eGEr8MA8PhKMvYe9myZJquUT2JkCZw==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.0.1.tgz", + "integrity": "sha512-8V9hriRvZQXPWU3bbiUV4Epo7EvgM6RTs+sUmxp5G//dBGy402S7Fx0W0QkB2fb4obCF8SInoUzvTYtc3bkb5w==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.17.0", - "@typescript-eslint/visitor-keys": "7.17.0", + "@typescript-eslint/types": "8.0.1", + "@typescript-eslint/visitor-keys": "8.0.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1510,7 +1538,7 @@ "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", @@ -1547,54 +1575,48 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.17.0.tgz", - "integrity": "sha512-r+JFlm5NdB+JXc7aWWZ3fKSm1gn0pkswEwIYsrGPdsT2GjsRATAKXiNtp3vgAAO1xZhX8alIOEQnNMl3kbTgJw==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.0.1.tgz", + "integrity": "sha512-CBFR0G0sCt0+fzfnKaciu9IBsKvEKYwN9UZ+eeogK1fYHg4Qxk1yf/wLQkLXlq8wbU2dFlgAesxt8Gi76E8RTA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.17.0", - "@typescript-eslint/types": "7.17.0", - "@typescript-eslint/typescript-estree": "7.17.0" + "@typescript-eslint/scope-manager": "8.0.1", + "@typescript-eslint/types": "8.0.1", + "@typescript-eslint/typescript-estree": "8.0.1" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" + "eslint": "^8.57.0 || ^9.0.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.17.0.tgz", - "integrity": "sha512-RVGC9UhPOCsfCdI9pU++K4nD7to+jTcMIbXTSOcrLqUEW6gF2pU1UUbYJKc9cvcRSK1UDeMJ7pdMxf4bhMpV/A==", + "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==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.17.0", + "@typescript-eslint/types": "8.0.1", "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "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 - }, "node_modules/acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -2112,9 +2134,9 @@ } }, "node_modules/debug": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", "dependencies": { "ms": "2.1.2" }, @@ -2225,17 +2247,6 @@ "node": ">=8" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -2302,41 +2313,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, "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", @@ -2350,10 +2357,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": { @@ -2369,18 +2384,18 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "28.6.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.6.0.tgz", - "integrity": "sha512-YG28E1/MIKwnz+e2H7VwYPzHUYU4aMa19w0yGcwXnnmJH6EfgHahTJ2un3IyraUxNfnz/KUhJAFXNNwWPo12tg==", + "version": "28.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.8.0.tgz", + "integrity": "sha512-Tubj1hooFxCl52G4qQu0edzV/+EZzPUeN8p2NnW5uu4fbDs+Yo7+qDVDc4/oG3FbCqEBmu/OC3LSsyiU22oghw==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "^6.0.0 || ^7.0.0" + "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "engines": { "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0", + "@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0 || ^8.0.0", "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0", "jest": "*" }, @@ -2423,27 +2438,27 @@ } } }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "node_modules/eslint-scope": { + "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, + "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" } }, - "node_modules/eslint/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==", + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -2451,27 +2466,42 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "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": ">=4.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "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==", + "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, "dependencies": { - "acorn": "^8.9.0", + "acorn": "^8.12.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^4.0.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" + } + }, + "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, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -2500,18 +2530,11 @@ "node": ">=0.10" } }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, "node_modules/esrecurse": { "version": "4.3.0", + "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" }, @@ -2519,18 +2542,20 @@ "node": ">=4.0" } }, - "node_modules/esrecurse/node_modules/estraverse": { + "node_modules/estraverse": { "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, - "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } }, "node_modules/esutils": { "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, - "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" } @@ -2670,14 +2695,15 @@ } }, "node_modules/file-entry-cache": { - "version": "6.0.1", + "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/file-type": { @@ -2755,21 +2781,23 @@ } }, "node_modules/flat-cache": { - "version": "3.0.4", + "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.1.0", - "rimraf": "^3.0.2" + "flatted": "^3.2.9", + "keyv": "^4.5.4" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16" } }, "node_modules/flatted": { - "version": "3.2.7", - "dev": true, - "license": "ISC" + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "dev": true }, "node_modules/fs.realpath": { "version": "1.0.0", @@ -2873,15 +2901,12 @@ } }, "node_modules/globals": { - "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", + "version": "15.9.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.9.0.tgz", + "integrity": "sha512-SmSKyLLKFbSr6rptvP8izbyxJL4ILwqO9Jg23UA0sDlGlu58V59D1//I3vlc0KJphVdUR7vMjHIplYnzBxorQA==", "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3893,6 +3918,12 @@ "node": ">=4" } }, + "node_modules/json-buffer": { + "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 + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "dev": true, @@ -3920,6 +3951,15 @@ "node": ">=6" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -4633,20 +4673,6 @@ "node": ">=0.10.0" } }, - "node_modules/rimraf": { - "version": "3.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/run-applescript": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", @@ -5061,9 +5087,9 @@ } }, "node_modules/ts-jest": { - "version": "29.2.3", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.3.tgz", - "integrity": "sha512-yCcfVdiBFngVz9/keHin9EnsrQtQtEu3nRykNy9RVp+FiPFFbPJ3Sg6Qg4+TkmH0vMP5qsTKgXSsk80HRwvdgQ==", + "version": "29.2.4", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.4.tgz", + "integrity": "sha512-3d6tgDyhCI29HlpwIq87sNuI+3Q6GLTTCeYRHCs7vDz+/3GCMwEtV9jezLyl4ZtnBgx00I7hm8PCP8cTksMGrw==", "dev": true, "dependencies": { "bs-logger": "0.x", @@ -5134,18 +5160,6 @@ "node": ">=4" } }, - "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, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/typescript": { "version": "5.5.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", @@ -5159,6 +5173,29 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.0.1.tgz", + "integrity": "sha512-V3Y+MdfhawxEjE16dWpb7/IOgeXnLwAEEkS7v8oDqNcR1oYlqWhGH/iHqHdKVdpWme1VPZ0SoywXAkCqawj2eQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.0.1", + "@typescript-eslint/parser": "8.0.1", + "@typescript-eslint/utils": "8.0.1" + }, + "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/ua-parser-js": { "version": "1.0.38", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.38.tgz", @@ -5182,9 +5219,9 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz", + "integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==", "dev": true }, "node_modules/unique-string": { @@ -5812,53 +5849,67 @@ } }, "@eslint-community/regexpp": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", - "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", + "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", "dev": true }, + "@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, + "requires": { + "@eslint/object-schema": "^2.1.4", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + } + }, "@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, "requires": { "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", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true + } } }, "@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==", + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.9.0.tgz", + "integrity": "sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug==", "dev": true }, - "@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", - "dev": true, - "requires": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" - } + "@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 }, "@humanwhocodes/module-importer": { "version": "1.0.1", "dev": true }, - "@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", + "@humanwhocodes/retry": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", + "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", "dev": true }, "@istanbuljs/load-nyc-config": { @@ -6339,12 +6390,12 @@ "version": "0.7.31" }, "@types/node": { - "version": "20.14.2", - "resolved": "https://registry.npmmirror.com/@types/node/-/node-20.14.2.tgz", - "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.2.0.tgz", + "integrity": "sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==", "dev": true, "requires": { - "undici-types": "~5.26.4" + "undici-types": "~6.13.0" } }, "@types/npm-events-package": { @@ -6380,16 +6431,16 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.17.0.tgz", - "integrity": "sha512-pyiDhEuLM3PuANxH7uNYan1AaFs5XE0zw1hq69JBvGvE7gSuEoQl1ydtEe/XQeoC3GQxLXyOVa5kNOATgM638A==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.0.1.tgz", + "integrity": "sha512-5g3Y7GDFsJAnY4Yhvk8sZtFfV6YNF2caLzjrRPUBzewjPCaj0yokePB4LJSobyCzGMzjZZYFbwuzbfDHlimXbQ==", "dev": true, "requires": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.17.0", - "@typescript-eslint/type-utils": "7.17.0", - "@typescript-eslint/utils": "7.17.0", - "@typescript-eslint/visitor-keys": "7.17.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", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -6397,54 +6448,54 @@ } }, "@typescript-eslint/parser": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.17.0.tgz", - "integrity": "sha512-puiYfGeg5Ydop8eusb/Hy1k7QmOU6X3nvsqCgzrB2K4qMavK//21+PzNE8qeECgNOIoertJPUC1SpegHDI515A==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.0.1.tgz", + "integrity": "sha512-5IgYJ9EO/12pOUwiBKFkpU7rS3IU21mtXzB81TNwq2xEybcmAZrE9qwDtsb5uQd9aVO9o0fdabFyAmKveXyujg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "7.17.0", - "@typescript-eslint/types": "7.17.0", - "@typescript-eslint/typescript-estree": "7.17.0", - "@typescript-eslint/visitor-keys": "7.17.0", + "@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", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.17.0.tgz", - "integrity": "sha512-0P2jTTqyxWp9HiKLu/Vemr2Rg1Xb5B7uHItdVZ6iAenXmPo4SZ86yOPCJwMqpCyaMiEHTNqizHfsbmCFT1x9SA==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.0.1.tgz", + "integrity": "sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ==", "dev": true, "requires": { - "@typescript-eslint/types": "7.17.0", - "@typescript-eslint/visitor-keys": "7.17.0" + "@typescript-eslint/types": "8.0.1", + "@typescript-eslint/visitor-keys": "8.0.1" } }, "@typescript-eslint/type-utils": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.17.0.tgz", - "integrity": "sha512-XD3aaBt+orgkM/7Cei0XNEm1vwUxQ958AOLALzPlbPqb8C1G8PZK85tND7Jpe69Wualri81PLU+Zc48GVKIMMA==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.0.1.tgz", + "integrity": "sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "7.17.0", - "@typescript-eslint/utils": "7.17.0", + "@typescript-eslint/typescript-estree": "8.0.1", + "@typescript-eslint/utils": "8.0.1", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" } }, "@typescript-eslint/types": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.17.0.tgz", - "integrity": "sha512-a29Ir0EbyKTKHnZWbNsrc/gqfIBqYPwj3F2M+jWE/9bqfEHg0AMtXzkbUkOG6QgEScxh2+Pz9OXe11jHDnHR7A==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.0.1.tgz", + "integrity": "sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.17.0.tgz", - "integrity": "sha512-72I3TGq93t2GoSBWI093wmKo0n6/b7O4j9o8U+f65TVD0FS6bI2180X5eGEr8MA8PhKMvYe9myZJquUT2JkCZw==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.0.1.tgz", + "integrity": "sha512-8V9hriRvZQXPWU3bbiUV4Epo7EvgM6RTs+sUmxp5G//dBGy402S7Fx0W0QkB2fb4obCF8SInoUzvTYtc3bkb5w==", "dev": true, "requires": { - "@typescript-eslint/types": "7.17.0", - "@typescript-eslint/visitor-keys": "7.17.0", + "@typescript-eslint/types": "8.0.1", + "@typescript-eslint/visitor-keys": "8.0.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -6474,37 +6525,31 @@ } }, "@typescript-eslint/utils": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.17.0.tgz", - "integrity": "sha512-r+JFlm5NdB+JXc7aWWZ3fKSm1gn0pkswEwIYsrGPdsT2GjsRATAKXiNtp3vgAAO1xZhX8alIOEQnNMl3kbTgJw==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.0.1.tgz", + "integrity": "sha512-CBFR0G0sCt0+fzfnKaciu9IBsKvEKYwN9UZ+eeogK1fYHg4Qxk1yf/wLQkLXlq8wbU2dFlgAesxt8Gi76E8RTA==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.17.0", - "@typescript-eslint/types": "7.17.0", - "@typescript-eslint/typescript-estree": "7.17.0" + "@typescript-eslint/scope-manager": "8.0.1", + "@typescript-eslint/types": "8.0.1", + "@typescript-eslint/typescript-estree": "8.0.1" } }, "@typescript-eslint/visitor-keys": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.17.0.tgz", - "integrity": "sha512-RVGC9UhPOCsfCdI9pU++K4nD7to+jTcMIbXTSOcrLqUEW6gF2pU1UUbYJKc9cvcRSK1UDeMJ7pdMxf4bhMpV/A==", + "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==", "dev": true, "requires": { - "@typescript-eslint/types": "7.17.0", + "@typescript-eslint/types": "8.0.1", "eslint-visitor-keys": "^3.4.3" } }, - "@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 - }, "acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true }, "acorn-jsx": { @@ -6853,9 +6898,9 @@ } }, "debug": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", "requires": { "ms": "2.1.2" } @@ -6920,13 +6965,6 @@ "path-type": "^4.0.0" } }, - "doctrine": { - "version": "3.0.0", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, "ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -6968,41 +7006,37 @@ "dev": true }, "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, "requires": { "@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", @@ -7013,20 +7047,10 @@ "text-table": "^0.2.0" }, "dependencies": { - "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==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - } - }, - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "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 } } @@ -7039,12 +7063,12 @@ "requires": {} }, "eslint-plugin-jest": { - "version": "28.6.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.6.0.tgz", - "integrity": "sha512-YG28E1/MIKwnz+e2H7VwYPzHUYU4aMa19w0yGcwXnnmJH6EfgHahTJ2un3IyraUxNfnz/KUhJAFXNNwWPo12tg==", + "version": "28.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.8.0.tgz", + "integrity": "sha512-Tubj1hooFxCl52G4qQu0edzV/+EZzPUeN8p2NnW5uu4fbDs+Yo7+qDVDc4/oG3FbCqEBmu/OC3LSsyiU22oghw==", "dev": true, "requires": { - "@typescript-eslint/utils": "^6.0.0 || ^7.0.0" + "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "eslint-plugin-prettier": { @@ -7057,6 +7081,16 @@ "synckit": "^0.9.1" } }, + "eslint-scope": { + "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, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, "eslint-visitor-keys": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", @@ -7064,14 +7098,22 @@ "dev": true }, "espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "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, "requires": { - "acorn": "^8.9.0", + "acorn": "^8.12.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^4.0.0" + }, + "dependencies": { + "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 + } } }, "esprima": { @@ -7083,29 +7125,27 @@ "dev": true, "requires": { "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "dev": true - } } }, "esrecurse": { "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "requires": { "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "dev": true - } } }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, "esutils": { "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, "event-target-shim": { @@ -7217,10 +7257,12 @@ } }, "file-entry-cache": { - "version": "6.0.1", + "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, "requires": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" } }, "file-type": { @@ -7281,15 +7323,19 @@ } }, "flat-cache": { - "version": "3.0.4", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" + "flatted": "^3.2.9", + "keyv": "^4.5.4" } }, "flatted": { - "version": "3.2.7", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true }, "fs.realpath": { @@ -7349,13 +7395,10 @@ } }, "globals": { - "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } + "version": "15.9.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.9.0.tgz", + "integrity": "sha512-SmSKyLLKFbSr6rptvP8izbyxJL4ILwqO9Jg23UA0sDlGlu58V59D1//I3vlc0KJphVdUR7vMjHIplYnzBxorQA==", + "dev": true }, "globby": { "version": "11.1.0", @@ -8072,6 +8115,12 @@ "version": "2.5.2", "dev": true }, + "json-buffer": { + "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 + }, "json-parse-even-better-errors": { "version": "2.3.1", "dev": true @@ -8090,6 +8139,15 @@ "version": "2.2.3", "dev": true }, + "keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "requires": { + "json-buffer": "3.0.1" + } + }, "kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -8541,13 +8599,6 @@ "version": "1.0.4", "dev": true }, - "rimraf": { - "version": "3.0.2", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, "run-applescript": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", @@ -8803,9 +8854,9 @@ "requires": {} }, "ts-jest": { - "version": "29.2.3", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.3.tgz", - "integrity": "sha512-yCcfVdiBFngVz9/keHin9EnsrQtQtEu3nRykNy9RVp+FiPFFbPJ3Sg6Qg4+TkmH0vMP5qsTKgXSsk80HRwvdgQ==", + "version": "29.2.4", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.4.tgz", + "integrity": "sha512-3d6tgDyhCI29HlpwIq87sNuI+3Q6GLTTCeYRHCs7vDz+/3GCMwEtV9jezLyl4ZtnBgx00I7hm8PCP8cTksMGrw==", "dev": true, "requires": { "bs-logger": "0.x", @@ -8838,27 +8889,32 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, - "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 - }, "typescript": { "version": "5.5.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true }, + "typescript-eslint": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.0.1.tgz", + "integrity": "sha512-V3Y+MdfhawxEjE16dWpb7/IOgeXnLwAEEkS7v8oDqNcR1oYlqWhGH/iHqHdKVdpWme1VPZ0SoywXAkCqawj2eQ==", + "dev": true, + "requires": { + "@typescript-eslint/eslint-plugin": "8.0.1", + "@typescript-eslint/parser": "8.0.1", + "@typescript-eslint/utils": "8.0.1" + } + }, "ua-parser-js": { "version": "1.0.38", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.38.tgz", "integrity": "sha512-Aq5ppTOfvrCMgAPneW1HfWj66Xi7XL+/mIy996R1/CLS/rcyJQm6QZdsKrUeivDFQ+Oc9Wyuwor8Ze8peEoUoQ==" }, "undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz", + "integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==", "dev": true }, "unique-string": { diff --git a/package.json b/package.json index c8777c35..a5e57f97 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "lib" ], "engines": { - "node": ">=16" + "node": ">=18" }, "keywords": [ "webrtc", @@ -67,7 +67,7 @@ "@types/debug": "^4.1.12", "@types/npm-events-package": "npm:@types/events@^3.0.3", "awaitqueue": "^3.0.2", - "debug": "^4.3.5", + "debug": "^4.3.6", "npm-events-package": "npm:events@^3.3.0", "fake-mediastreamtrack": "^1.2.0", "h264-profile-level-id": "^2.0.0", @@ -77,20 +77,24 @@ "ua-parser-js": "^1.0.38" }, "devDependencies": { + "@eslint/js": "^9.9.0", "@types/jest": "^29.5.12", - "@types/node": "20", + "@types/node": "22", "@types/sdp-transform": "^2.4.9", "@types/ua-parser-js": "^0.7.39", - "@typescript-eslint/eslint-plugin": "^7.17.0", - "@typescript-eslint/parser": "^7.17.0", + "@typescript-eslint/eslint-plugin": "^8.0.1", + "@typescript-eslint/parser": "^8.0.1", "eslint": "^8.57.0", + "eslint": "^9.9.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-jest": "^28.6.0", + "eslint-plugin-jest": "^28.8.0", "eslint-plugin-prettier": "^5.2.1", + "globals": "^15.9.0", "jest": "^29.7.0", "open-cli": "^8.0.0", "prettier": "^3.3.3", - "ts-jest": "^29.2.3", - "typescript": "^5.5.4" + "ts-jest": "^29.2.4", + "typescript": "^5.5.4", + "typescript-eslint": "^8.0.1" } } diff --git a/src/Consumer.ts b/src/Consumer.ts index 8f704fed..e7f83026 100644 --- a/src/Consumer.ts +++ b/src/Consumer.ts @@ -94,7 +94,7 @@ export class Consumer< this._track = track; this._rtpParameters = rtpParameters; this._paused = !track.enabled; - this._appData = appData || ({} as ConsumerAppData); + this._appData = appData ?? ({} as ConsumerAppData); this.onTrackEnded = this.onTrackEnded.bind(this); this.handleTrack(); diff --git a/src/DataConsumer.ts b/src/DataConsumer.ts index 55113ac3..d54947e2 100644 --- a/src/DataConsumer.ts +++ b/src/DataConsumer.ts @@ -72,7 +72,7 @@ export class DataConsumer< this._dataProducerId = dataProducerId; this._dataChannel = dataChannel; this._sctpStreamParameters = sctpStreamParameters; - this._appData = appData || ({} as DataConsumerAppData); + this._appData = appData ?? ({} as DataConsumerAppData); this.handleDataChannel(); } diff --git a/src/DataProducer.ts b/src/DataProducer.ts index 4598c9a6..ae74862b 100644 --- a/src/DataProducer.ts +++ b/src/DataProducer.ts @@ -68,7 +68,7 @@ export class DataProducer< this._id = id; this._dataChannel = dataChannel; this._sctpStreamParameters = sctpStreamParameters; - this._appData = appData || ({} as DataProducerAppData); + this._appData = appData ?? ({} as DataProducerAppData); this.handleDataChannel(); } diff --git a/src/Device.ts b/src/Device.ts index 1a89cacb..bf63164c 100644 --- a/src/Device.ts +++ b/src/Device.ts @@ -179,6 +179,7 @@ export function detectDevice(): BuiltinHandlerName | undefined { } // Best effort for Chromium based browsers. else if (engineName === 'blink') { + // eslint-disable-next-line @typescript-eslint/prefer-regexp-exec const match = ua.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i); if (match) { @@ -635,7 +636,7 @@ export class Device { } // Create a new Transport. - const transport = new Transport({ + const transport: Transport = new Transport({ direction, id, iceParameters, diff --git a/src/Producer.ts b/src/Producer.ts index a649538d..174450b0 100644 --- a/src/Producer.ts +++ b/src/Producer.ts @@ -142,7 +142,7 @@ export class Producer< this._stopTracks = stopTracks; this._disableTrackOnPause = disableTrackOnPause; this._zeroRtpOnPause = zeroRtpOnPause; - this._appData = appData || ({} as ProducerAppData); + this._appData = appData ?? ({} as ProducerAppData); this.onTrackEnded = this.onTrackEnded.bind(this); // NOTE: Minor issue. If zeroRtpOnPause is true, we cannot emit the diff --git a/src/Transport.ts b/src/Transport.ts index ee72e30f..cb81ff2d 100644 --- a/src/Transport.ts +++ b/src/Transport.ts @@ -286,7 +286,7 @@ export class Transport< : null; // Clone and sanitize additionalSettings. - const clonedAdditionalSettings = utils.clone(additionalSettings) || {}; + const clonedAdditionalSettings = utils.clone(additionalSettings) ?? {}; delete clonedAdditionalSettings.iceServers; delete clonedAdditionalSettings.iceTransportPolicy; @@ -309,7 +309,7 @@ export class Transport< extendedRtpCapabilities, }); - this._appData = appData || ({} as TransportAppData); + this._appData = appData ?? ({} as TransportAppData); this.handleHandler(); } @@ -595,7 +595,7 @@ export class Transport< } ); - const producer = new Producer({ + const producer: Producer = new Producer({ id, localId, rtpSender, @@ -700,7 +700,7 @@ export class Transport< } if (this._consumerCreationInProgress === false) { - this.createPendingConsumers(); + void this.createPendingConsumers(); } }); @@ -771,7 +771,7 @@ export class Transport< ); }); - const dataProducer = new DataProducer({ + const dataProducer: DataProducer = new DataProducer({ id, dataChannel, sctpStreamParameters, @@ -836,7 +836,7 @@ export class Transport< protocol, }); - const dataConsumer = new DataConsumer({ + const dataConsumer: DataConsumer = new DataConsumer({ id, dataProducerId, dataChannel, @@ -887,7 +887,7 @@ export class Transport< optionsList.push({ trackId: id!, - kind: kind as MediaKind, + kind: kind!, rtpParameters, streamId, onRtpReceiver, @@ -903,7 +903,7 @@ export class Transport< const { id, producerId, kind, rtpParameters, appData } = task.consumerOptions; const { localId, rtpReceiver, track } = result; - const consumer = new Consumer({ + const consumer: Consumer = new Consumer({ id: id!, localId, producerId: producerId!, @@ -941,7 +941,7 @@ export class Transport< if (videoConsumerForProbator) { try { const probatorRtpParameters = ortc.generateProbatorRtpParameters( - videoConsumerForProbator!.rtpParameters + videoConsumerForProbator.rtpParameters ); await this._handler.receive([ @@ -970,7 +970,7 @@ export class Transport< // There are pending Consumer tasks, enqueue their creation. if (this._pendingConsumerTasks.length > 0) { - this.createPendingConsumers(); + void this.createPendingConsumers(); } }) // NOTE: We only get here when the await queue is closed. @@ -1240,7 +1240,7 @@ export class Transport< producer.on('@getstats', (callback, errback) => { if (this._closed) { - return errback!(new InvalidStateError('closed')); + return errback(new InvalidStateError('closed')); } this._handler @@ -1313,7 +1313,7 @@ export class Transport< consumer.on('@getstats', (callback, errback) => { if (this._closed) { - return errback!(new InvalidStateError('closed')); + return errback(new InvalidStateError('closed')); } this._handler diff --git a/src/errors.ts b/src/errors.ts index 0f1f0493..73b77e3c 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -8,8 +8,6 @@ export class UnsupportedError extends Error { this.name = 'UnsupportedError'; if (Error.hasOwnProperty('captureStackTrace')) { - // Just in V8. - // @ts-ignore Error.captureStackTrace(this, UnsupportedError); } else { this.stack = new Error(message).stack; @@ -28,7 +26,6 @@ export class InvalidStateError extends Error { if (Error.hasOwnProperty('captureStackTrace')) { // Just in V8. - // @ts-ignore Error.captureStackTrace(this, InvalidStateError); } else { this.stack = new Error(message).stack; diff --git a/src/handlers/Chrome111.ts b/src/handlers/Chrome111.ts index 75c82264..b43725bb 100644 --- a/src/handlers/Chrome111.ts +++ b/src/handlers/Chrome111.ts @@ -27,6 +27,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('Chrome111'); +const NAME = 'Chrome111'; const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 }; export class Chrome111 extends HandlerInterface { @@ -70,7 +71,7 @@ export class Chrome111 extends HandlerInterface { } get name(): string { - return 'Chrome111'; + return NAME; } close(): void { @@ -187,8 +188,8 @@ export class Chrome111 extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'unified-plan', @@ -478,7 +479,7 @@ export class Chrome111 extends HandlerInterface { throw new Error('associated RTCRtpTransceiver not found'); } - transceiver.sender.replaceTrack(null); + void transceiver.sender.replaceTrack(null); this._pc.removeTrack(transceiver.sender); @@ -810,7 +811,7 @@ export class Chrome111 extends HandlerInterface { logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind); - const localId = rtpParameters.mid || String(this._mapMidTransceiver.size); + const localId = rtpParameters.mid ?? String(this._mapMidTransceiver.size); mapLocalId.set(trackId, localId); @@ -818,7 +819,7 @@ export class Chrome111 extends HandlerInterface { mid: localId, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } diff --git a/src/handlers/Chrome55.ts b/src/handlers/Chrome55.ts index 2f43a4ed..a66559cb 100644 --- a/src/handlers/Chrome55.ts +++ b/src/handlers/Chrome55.ts @@ -25,6 +25,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('Chrome55'); +const NAME = 'Chrome55'; const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 }; export class Chrome55 extends HandlerInterface { @@ -77,7 +78,7 @@ export class Chrome55 extends HandlerInterface { } get name(): string { - return 'Chrome55'; + return NAME; } close(): void { @@ -184,8 +185,8 @@ export class Chrome55 extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'plan-b', @@ -622,7 +623,7 @@ export class Chrome55 extends HandlerInterface { mid, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } @@ -674,7 +675,7 @@ export class Chrome55 extends HandlerInterface { const { kind, trackId, rtpParameters } = options; const mid = kind; const localId = trackId; - const streamId = options.streamId || rtpParameters.rtcp!.cname!; + const streamId = options.streamId ?? rtpParameters.rtcp!.cname!; const stream = this._pc .getRemoteStreams() .find((s: any) => s.id === streamId); @@ -700,7 +701,7 @@ export class Chrome55 extends HandlerInterface { logger.debug('stopReceiving() [localId:%s]', localId); const { mid, rtpParameters } = - this._mapRecvLocalIdInfo.get(localId) || {}; + this._mapRecvLocalIdInfo.get(localId) ?? {}; // Remove from the map. this._mapRecvLocalIdInfo.delete(localId); diff --git a/src/handlers/Chrome67.ts b/src/handlers/Chrome67.ts index 7b416871..161d909a 100644 --- a/src/handlers/Chrome67.ts +++ b/src/handlers/Chrome67.ts @@ -24,6 +24,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('Chrome67'); +const NAME = 'Chrome67'; const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 }; export class Chrome67 extends HandlerInterface { @@ -77,7 +78,7 @@ export class Chrome67 extends HandlerInterface { } get name(): string { - return 'Chrome67'; + return NAME; } close(): void { @@ -184,8 +185,8 @@ export class Chrome67 extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'plan-b', @@ -711,7 +712,7 @@ export class Chrome67 extends HandlerInterface { mid, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } @@ -795,7 +796,7 @@ export class Chrome67 extends HandlerInterface { logger.debug('stopReceiving() [localId:%s]', localId); const { mid, rtpParameters } = - this._mapRecvLocalIdInfo.get(localId) || {}; + this._mapRecvLocalIdInfo.get(localId) ?? {}; // Remove from the map. this._mapRecvLocalIdInfo.delete(localId); @@ -842,7 +843,7 @@ export class Chrome67 extends HandlerInterface { async getReceiverStats(localId: string): Promise { this.assertRecvDirection(); - const { rtpReceiver } = this._mapRecvLocalIdInfo.get(localId) || {}; + const { rtpReceiver } = this._mapRecvLocalIdInfo.get(localId) ?? {}; if (!rtpReceiver) { throw new Error('associated RTCRtpReceiver not found'); diff --git a/src/handlers/Chrome70.ts b/src/handlers/Chrome70.ts index 3750d321..febe4d53 100644 --- a/src/handlers/Chrome70.ts +++ b/src/handlers/Chrome70.ts @@ -25,6 +25,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('Chrome70'); +const NAME = 'Chrome70'; const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 }; export class Chrome70 extends HandlerInterface { @@ -66,7 +67,7 @@ export class Chrome70 extends HandlerInterface { } get name(): string { - return 'Chrome70'; + return NAME; } close(): void { @@ -172,8 +173,8 @@ export class Chrome70 extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'unified-plan', @@ -358,7 +359,7 @@ export class Chrome70 extends HandlerInterface { // Special case for VP9 with SVC. let hackVp9Svc = false; - const layers = parseScalabilityMode((encodings || [{}])[0].scalabilityMode); + const layers = parseScalabilityMode((encodings ?? [{}])[0].scalabilityMode); if ( encodings && @@ -390,7 +391,7 @@ export class Chrome70 extends HandlerInterface { const parameters = transceiver.sender.getParameters(); - for (let idx = 0; idx < (parameters.encodings || []).length; ++idx) { + for (let idx = 0; idx < (parameters.encodings ?? []).length; ++idx) { const encoding = parameters.encodings[idx]; const desiredEncoding = encodings[idx]; @@ -488,7 +489,7 @@ export class Chrome70 extends HandlerInterface { throw new Error('associated RTCRtpTransceiver not found'); } - transceiver.sender.replaceTrack(null); + void transceiver.sender.replaceTrack(null); this._pc.removeTrack(transceiver.sender); @@ -756,7 +757,7 @@ export class Chrome70 extends HandlerInterface { logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind); - const localId = rtpParameters.mid || String(this._mapMidTransceiver.size); + const localId = rtpParameters.mid ?? String(this._mapMidTransceiver.size); mapLocalId.set(trackId, localId); @@ -764,7 +765,7 @@ export class Chrome70 extends HandlerInterface { mid: localId, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } diff --git a/src/handlers/Chrome74.ts b/src/handlers/Chrome74.ts index d09a3d9a..cf386834 100644 --- a/src/handlers/Chrome74.ts +++ b/src/handlers/Chrome74.ts @@ -31,6 +31,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('Chrome74'); +const NAME = 'Chrome74'; const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 }; export class Chrome74 extends HandlerInterface { @@ -74,7 +75,7 @@ export class Chrome74 extends HandlerInterface { } get name(): string { - return 'Chrome74'; + return NAME; } close(): void { @@ -189,8 +190,8 @@ export class Chrome74 extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'unified-plan', @@ -375,7 +376,7 @@ export class Chrome74 extends HandlerInterface { // Special case for VP9 with SVC. let hackVp9Svc = false; - const layers = parseScalabilityMode((encodings || [{}])[0].scalabilityMode); + const layers = parseScalabilityMode((encodings ?? [{}])[0].scalabilityMode); if ( encodings && @@ -501,7 +502,7 @@ export class Chrome74 extends HandlerInterface { throw new Error('associated RTCRtpTransceiver not found'); } - transceiver.sender.replaceTrack(null); + void transceiver.sender.replaceTrack(null); this._pc.removeTrack(transceiver.sender); @@ -833,7 +834,7 @@ export class Chrome74 extends HandlerInterface { logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind); - const localId = rtpParameters.mid || String(this._mapMidTransceiver.size); + const localId = rtpParameters.mid ?? String(this._mapMidTransceiver.size); mapLocalId.set(trackId, localId); @@ -841,7 +842,7 @@ export class Chrome74 extends HandlerInterface { mid: localId, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } diff --git a/src/handlers/Edge11.ts b/src/handlers/Edge11.ts index 5d03e032..9fe02d0a 100644 --- a/src/handlers/Edge11.ts +++ b/src/handlers/Edge11.ts @@ -27,6 +27,8 @@ import { SctpCapabilities } from '../SctpParameters'; const logger = new Logger('Edge11'); +const NAME = 'Edge11'; + export class Edge11 extends HandlerInterface { // Generic sending RTP parameters for audio and video. private _sendingRtpParametersByKind?: { [key: string]: RtpParameters }; @@ -65,7 +67,7 @@ export class Edge11 extends HandlerInterface { } get name(): string { - return 'Edge11'; + return NAME; } close(): void { @@ -480,10 +482,10 @@ export class Edge11 extends HandlerInterface { iceServers?: any[]; iceTransportPolicy?: RTCIceTransportPolicy; }): void { - // @ts-ignore + // @ts-expect-error --- On purpose const iceGatherer = new (RTCIceGatherer as any)({ - iceServers: iceServers || [], - gatherPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + gatherPolicy: iceTransportPolicy ?? 'all', }); iceGatherer.addEventListener('error', (event: any) => { diff --git a/src/handlers/FakeHandler.ts b/src/handlers/FakeHandler.ts index 644f102e..9a112715 100644 --- a/src/handlers/FakeHandler.ts +++ b/src/handlers/FakeHandler.ts @@ -28,6 +28,8 @@ import { SctpCapabilities } from '../SctpParameters'; const logger = new Logger('FakeHandler'); +const NAME = 'FakeHandler'; + class FakeDataChannel extends EnhancedEventEmitter { id?: number; ordered?: boolean; @@ -113,7 +115,7 @@ export class FakeHandler extends HandlerInterface { } get name(): string { - return 'FakeHandler'; + return NAME; } close(): void { @@ -351,7 +353,7 @@ export class FakeHandler extends HandlerInterface { maxRetransmits: maxRetransmits, }; - // @ts-ignore. + // @ts-expect-error --- On purpose. return { dataChannel, sctpStreamParameters }; } @@ -441,7 +443,7 @@ export class FakeHandler extends HandlerInterface { protocol, }); - // @ts-ignore. + // @ts-expect-error --- On purpose. return { dataChannel }; } diff --git a/src/handlers/Firefox120.ts b/src/handlers/Firefox120.ts index e956992f..1a06906b 100644 --- a/src/handlers/Firefox120.ts +++ b/src/handlers/Firefox120.ts @@ -30,6 +30,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('Firefox120'); +const NAME = 'Firefox120'; const SCTP_NUM_STREAMS = { OS: 16, MIS: 2048 }; export class Firefox120 extends HandlerInterface { @@ -70,7 +71,7 @@ export class Firefox120 extends HandlerInterface { } get name(): string { - return 'Firefox120'; + return NAME; } close(): void { @@ -211,8 +212,8 @@ export class Firefox120 extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', ...additionalSettings, @@ -399,7 +400,7 @@ export class Firefox120 extends HandlerInterface { await this.setupTransport({ localDtlsRole: 'client', localSdpObject }); } - const layers = parseScalabilityMode((encodings || [{}])[0].scalabilityMode); + const layers = parseScalabilityMode((encodings ?? [{}])[0].scalabilityMode); logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer); @@ -501,7 +502,7 @@ export class Firefox120 extends HandlerInterface { throw new Error('associated transceiver not found'); } - transceiver.sender.replaceTrack(null); + void transceiver.sender.replaceTrack(null); // NOTE: Cannot use stop() the transceiver due to the the note above in // send() method. @@ -539,7 +540,6 @@ export class Firefox120 extends HandlerInterface { this._mapMidTransceiver.delete(localId); } - // eslint-disable-next-line @typescript-eslint/no-unused-vars async pauseSending(localId: string): Promise { this.assertNotClosed(); this.assertSendDirection(); @@ -574,7 +574,6 @@ export class Firefox120 extends HandlerInterface { await this._pc.setRemoteDescription(answer); } - // eslint-disable-next-line @typescript-eslint/no-unused-vars async resumeSending(localId: string): Promise { this.assertNotClosed(); this.assertSendDirection(); @@ -821,7 +820,6 @@ export class Firefox120 extends HandlerInterface { } async receive( - // eslint-disable-next-line @typescript-eslint/no-unused-vars optionsList: HandlerReceiveOptions[] ): Promise { this.assertNotClosed(); @@ -835,7 +833,7 @@ export class Firefox120 extends HandlerInterface { logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind); - const localId = rtpParameters.mid || String(this._mapMidTransceiver.size); + const localId = rtpParameters.mid ?? String(this._mapMidTransceiver.size); mapLocalId.set(trackId, localId); @@ -843,7 +841,7 @@ export class Firefox120 extends HandlerInterface { mid: localId, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } diff --git a/src/handlers/Firefox60.ts b/src/handlers/Firefox60.ts index 371677ee..57d1d264 100644 --- a/src/handlers/Firefox60.ts +++ b/src/handlers/Firefox60.ts @@ -30,6 +30,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('Firefox60'); +const NAME = 'Firefox60'; const SCTP_NUM_STREAMS = { OS: 16, MIS: 2048 }; export class Firefox60 extends HandlerInterface { @@ -70,7 +71,7 @@ export class Firefox60 extends HandlerInterface { } get name(): string { - return 'Firefox60'; + return NAME; } close(): void { @@ -214,8 +215,8 @@ export class Firefox60 extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', ...additionalSettings, @@ -352,15 +353,13 @@ export class Firefox60 extends HandlerInterface { if (encodings) { encodings = utils.clone(encodings); - if (encodings!.length > 1) { - encodings!.forEach((encoding, idx) => { - encoding.rid = `r${idx}`; - }); + encodings.forEach((encoding, idx) => { + encoding.rid = `r${idx}`; + }); - // Clone the encodings and reverse them because Firefox likes them - // from high to low. - encodings!.reverse(); - } + // Clone the encodings and reverse them because Firefox likes them + // from high to low. + encodings.reverse(); } const sendingRtpParameters = utils.clone( @@ -411,7 +410,7 @@ export class Firefox60 extends HandlerInterface { await this.setupTransport({ localDtlsRole: 'client', localSdpObject }); } - const layers = parseScalabilityMode((encodings || [{}])[0].scalabilityMode); + const layers = parseScalabilityMode((encodings ?? [{}])[0].scalabilityMode); logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer); @@ -514,7 +513,7 @@ export class Firefox60 extends HandlerInterface { throw new Error('associated transceiver not found'); } - transceiver.sender.replaceTrack(null); + void transceiver.sender.replaceTrack(null); // NOTE: Cannot use stop() the transceiver due to the the note above in // send() method. @@ -552,7 +551,6 @@ export class Firefox60 extends HandlerInterface { this._mapMidTransceiver.delete(localId); } - // eslint-disable-next-line @typescript-eslint/no-unused-vars async pauseSending(localId: string): Promise { this.assertNotClosed(); this.assertSendDirection(); @@ -587,7 +585,6 @@ export class Firefox60 extends HandlerInterface { await this._pc.setRemoteDescription(answer); } - // eslint-disable-next-line @typescript-eslint/no-unused-vars async resumeSending(localId: string): Promise { this.assertNotClosed(); this.assertSendDirection(); @@ -838,7 +835,6 @@ export class Firefox60 extends HandlerInterface { } async receive( - // eslint-disable-next-line @typescript-eslint/no-unused-vars optionsList: HandlerReceiveOptions[] ): Promise { this.assertNotClosed(); @@ -852,7 +848,7 @@ export class Firefox60 extends HandlerInterface { logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind); - const localId = rtpParameters.mid || String(this._mapMidTransceiver.size); + const localId = rtpParameters.mid ?? String(this._mapMidTransceiver.size); mapLocalId.set(trackId, localId); @@ -860,7 +856,7 @@ export class Firefox60 extends HandlerInterface { mid: localId, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } diff --git a/src/handlers/ReactNative.ts b/src/handlers/ReactNative.ts index f5bb9dab..67e2fd62 100644 --- a/src/handlers/ReactNative.ts +++ b/src/handlers/ReactNative.ts @@ -25,6 +25,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('ReactNative'); +const NAME = 'ReactNative'; const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 }; export class ReactNative extends HandlerInterface { @@ -77,7 +78,7 @@ export class ReactNative extends HandlerInterface { } get name(): string { - return 'ReactNative'; + return NAME; } close(): void { @@ -85,7 +86,7 @@ export class ReactNative extends HandlerInterface { // Free/dispose native MediaStream but DO NOT free/dispose native // MediaStreamTracks (that is parent's business). - // @ts-ignore (proprietary API in react-native-webrtc). + // @ts-expect-error --- Proprietary API in react-native-webrtc. this._sendStream.release(/* releaseTracks */ false); // Close RTCPeerConnection. @@ -189,8 +190,8 @@ export class ReactNative extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'plan-b', @@ -624,7 +625,7 @@ export class ReactNative extends HandlerInterface { logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind); const mid = kind; - let streamId = options.streamId || rtpParameters.rtcp!.cname!; + let streamId = options.streamId ?? rtpParameters.rtcp!.cname!; // NOTE: In React-Native we cannot reuse the same remote MediaStream for new // remote tracks. This is because react-native-webrtc does not react on new @@ -721,7 +722,7 @@ export class ReactNative extends HandlerInterface { logger.debug('stopReceiving() [localId:%s]', localId); const { mid, rtpParameters } = - this._mapRecvLocalIdInfo.get(localId) || {}; + this._mapRecvLocalIdInfo.get(localId) ?? {}; // Remove from the map. this._mapRecvLocalIdInfo.delete(localId); diff --git a/src/handlers/ReactNativeUnifiedPlan.ts b/src/handlers/ReactNativeUnifiedPlan.ts index 08928e56..c20ebd4a 100644 --- a/src/handlers/ReactNativeUnifiedPlan.ts +++ b/src/handlers/ReactNativeUnifiedPlan.ts @@ -31,6 +31,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('ReactNativeUnifiedPlan'); +const NAME = 'ReactNativeUnifiedPlan'; const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 }; export class ReactNativeUnifiedPlan extends HandlerInterface { @@ -74,7 +75,7 @@ export class ReactNativeUnifiedPlan extends HandlerInterface { } get name(): string { - return 'ReactNativeUnifiedPlan'; + return NAME; } close(): void { @@ -88,7 +89,7 @@ export class ReactNativeUnifiedPlan extends HandlerInterface { // Free/dispose native MediaStream but DO NOT free/dispose native // MediaStreamTracks (that is parent's business). - // @ts-ignore (proprietary API in react-native-webrtc). + // @ts-expect-error --- Proprietary API in react-native-webrtc. this._sendStream.release(/* releaseTracks */ false); // Close RTCPeerConnection. @@ -196,8 +197,8 @@ export class ReactNativeUnifiedPlan extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'unified-plan', @@ -388,7 +389,7 @@ export class ReactNativeUnifiedPlan extends HandlerInterface { // Special case for VP9 with SVC. let hackVp9Svc = false; - const layers = parseScalabilityMode((encodings || [{}])[0].scalabilityMode); + const layers = parseScalabilityMode((encodings ?? [{}])[0].scalabilityMode); if ( encodings && @@ -536,7 +537,7 @@ export class ReactNativeUnifiedPlan extends HandlerInterface { throw new Error('associated RTCRtpTransceiver not found'); } - transceiver.sender.replaceTrack(null); + void transceiver.sender.replaceTrack(null); this._pc.removeTrack(transceiver.sender); @@ -868,7 +869,7 @@ export class ReactNativeUnifiedPlan extends HandlerInterface { logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind); - const localId = rtpParameters.mid || String(this._mapMidTransceiver.size); + const localId = rtpParameters.mid ?? String(this._mapMidTransceiver.size); mapLocalId.set(trackId, localId); @@ -876,7 +877,7 @@ export class ReactNativeUnifiedPlan extends HandlerInterface { mid: localId, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } diff --git a/src/handlers/Safari11.ts b/src/handlers/Safari11.ts index 6ef15c13..479ca648 100644 --- a/src/handlers/Safari11.ts +++ b/src/handlers/Safari11.ts @@ -24,6 +24,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('Safari11'); +const NAME = 'Safari11'; const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 }; export class Safari11 extends HandlerInterface { @@ -77,7 +78,7 @@ export class Safari11 extends HandlerInterface { } get name(): string { - return 'Safari11'; + return NAME; } close(): void { @@ -184,8 +185,8 @@ export class Safari11 extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', ...additionalSettings, @@ -705,7 +706,7 @@ export class Safari11 extends HandlerInterface { mid, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } @@ -790,7 +791,7 @@ export class Safari11 extends HandlerInterface { logger.debug('stopReceiving() [localId:%s]', localId); const { mid, rtpParameters } = - this._mapRecvLocalIdInfo.get(localId) || {}; + this._mapRecvLocalIdInfo.get(localId) ?? {}; // Remove from the map. this._mapRecvLocalIdInfo.delete(localId); @@ -823,7 +824,7 @@ export class Safari11 extends HandlerInterface { async getReceiverStats(localId: string): Promise { this.assertRecvDirection(); - const { rtpReceiver } = this._mapRecvLocalIdInfo.get(localId) || {}; + const { rtpReceiver } = this._mapRecvLocalIdInfo.get(localId) ?? {}; if (!rtpReceiver) { throw new Error('associated RTCRtpReceiver not found'); diff --git a/src/handlers/Safari12.ts b/src/handlers/Safari12.ts index 144957e5..5cda7f9d 100644 --- a/src/handlers/Safari12.ts +++ b/src/handlers/Safari12.ts @@ -27,6 +27,7 @@ import { SctpCapabilities, SctpStreamParameters } from '../SctpParameters'; const logger = new Logger('Safari12'); +const NAME = 'Safari12'; const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 }; export class Safari12 extends HandlerInterface { @@ -70,7 +71,7 @@ export class Safari12 extends HandlerInterface { } get name(): string { - return 'Safari12'; + return NAME; } close(): void { @@ -186,8 +187,8 @@ export class Safari12 extends HandlerInterface { this._pc = new (RTCPeerConnection as any)( { - iceServers: iceServers || [], - iceTransportPolicy: iceTransportPolicy || 'all', + iceServers: iceServers ?? [], + iceTransportPolicy: iceTransportPolicy ?? 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', ...additionalSettings, @@ -367,7 +368,7 @@ export class Safari12 extends HandlerInterface { }); } - const layers = parseScalabilityMode((encodings || [{}])[0].scalabilityMode); + const layers = parseScalabilityMode((encodings ?? [{}])[0].scalabilityMode); if (encodings && encodings.length > 1) { logger.debug('send() | enabling legacy simulcast'); @@ -473,7 +474,7 @@ export class Safari12 extends HandlerInterface { throw new Error('associated RTCRtpTransceiver not found'); } - transceiver.sender.replaceTrack(null); + void transceiver.sender.replaceTrack(null); this._pc.removeTrack(transceiver.sender); @@ -508,7 +509,6 @@ export class Safari12 extends HandlerInterface { this._mapMidTransceiver.delete(localId); } - // eslint-disable-next-line @typescript-eslint/no-unused-vars async pauseSending(localId: string): Promise { this.assertNotClosed(); this.assertSendDirection(); @@ -543,7 +543,6 @@ export class Safari12 extends HandlerInterface { await this._pc.setRemoteDescription(answer); } - // eslint-disable-next-line @typescript-eslint/no-unused-vars async resumeSending(localId: string): Promise { this.assertNotClosed(); this.assertSendDirection(); @@ -806,7 +805,7 @@ export class Safari12 extends HandlerInterface { logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind); - const localId = rtpParameters.mid || String(this._mapMidTransceiver.size); + const localId = rtpParameters.mid ?? String(this._mapMidTransceiver.size); mapLocalId.set(trackId, localId); @@ -814,7 +813,7 @@ export class Safari12 extends HandlerInterface { mid: localId, kind, offerRtpParameters: rtpParameters, - streamId: streamId || rtpParameters.rtcp!.cname!, + streamId: streamId ?? rtpParameters.rtcp!.cname!, trackId, }); } diff --git a/src/handlers/ortc/edgeUtils.ts b/src/handlers/ortc/edgeUtils.ts index c32f8c57..baa021b5 100644 --- a/src/handlers/ortc/edgeUtils.ts +++ b/src/handlers/ortc/edgeUtils.ts @@ -11,14 +11,14 @@ export function getCapabilities(): RtpCapabilities { for (const codec of caps.codecs ?? []) { // Rename numChannels to channels. - // @ts-ignore + // @ts-expect-error --- On purpose. codec.channels = codec.numChannels; - // @ts-ignore + // @ts-expect-error --- On purpose. delete codec.numChannels; // Add mimeType. - // @ts-ignore (due to codec.name). - codec.mimeType = codec.mimeType || `${codec.kind}/${codec.name}`; + // @ts-expect-error --- On purpose (due to codec.name). + codec.mimeType = codec.mimeType ?? `${codec.kind}/${codec.name}`; // NOTE: Edge sets some numeric parameters as string rather than number. Fix them. if (codec.parameters) { @@ -36,7 +36,7 @@ export function getCapabilities(): RtpCapabilities { } // Delete emty parameter String in rtcpFeedback. - for (const feedback of codec.rtcpFeedback || []) { + for (const feedback of codec.rtcpFeedback ?? []) { if (!feedback.parameter) { feedback.parameter = ''; } @@ -56,7 +56,7 @@ export function mangleRtpParameters( // Rename mid to muxId. if (params.mid) { - // @ts-ignore (due to muxId). + // @ts-expect-error --- On purpose (due to muxId). params.muxId = params.mid; delete params.mid; } @@ -64,20 +64,20 @@ export function mangleRtpParameters( for (const codec of params.codecs) { // Rename channels to numChannels. if (codec.channels) { - // @ts-ignore. + // @ts-expect-error --- On purpose. codec.numChannels = codec.channels; delete codec.channels; } // Add codec.name (requried by Edge). - // @ts-ignore (due to name). + // @ts-expect-error --- On purpose (due to name). if (codec.mimeType && !codec.name) { - // @ts-ignore (due to name). + // @ts-expect-error --- On purpose (due to name). codec.name = codec.mimeType.split('/')[1]; } // Remove mimeType. - // @ts-ignore + // @ts-expect-error --- On purpose. delete codec.mimeType; } diff --git a/src/handlers/ortc/utils.ts b/src/handlers/ortc/utils.ts index a6366bc1..e9774215 100644 --- a/src/handlers/ortc/utils.ts +++ b/src/handlers/ortc/utils.ts @@ -4,7 +4,7 @@ import { RtpCapabilities } from '../../RtpParameters'; * This function adds RTCP NACK support for OPUS codec in given capabilities. */ export function addNackSuppportForOpus(rtpCapabilities: RtpCapabilities): void { - for (const codec of rtpCapabilities.codecs || []) { + for (const codec of rtpCapabilities.codecs ?? []) { if ( (codec.mimeType.toLowerCase() === 'audio/opus' || codec.mimeType.toLowerCase() === 'audio/multiopus') && diff --git a/src/handlers/sdp/MediaSection.ts b/src/handlers/sdp/MediaSection.ts index 0673db6f..3e806b27 100644 --- a/src/handlers/sdp/MediaSection.ts +++ b/src/handlers/sdp/MediaSection.ts @@ -310,7 +310,7 @@ export class AnswerMediaSection extends MediaSection { for (const ext of answerRtpParameters!.headerExtensions!) { // Don't add a header extension if not present in the offer. - const found = (offerMediaObject.ext || []).some( + const found = (offerMediaObject.ext ?? []).some( (localExt: RtpHeaderExtensionParameters) => localExt.uri === ext.uri ); @@ -341,7 +341,7 @@ export class AnswerMediaSection extends MediaSection { this._mediaObject.rids = []; - for (const rid of offerMediaObject.rids || []) { + for (const rid of offerMediaObject.rids ?? []) { if (rid.direction !== 'send') { continue; } @@ -354,14 +354,13 @@ export class AnswerMediaSection extends MediaSection { } // Simulcast (draft version 03). else if (offerMediaObject.simulcast_03) { - // eslint-disable-next-line camelcase this._mediaObject.simulcast_03 = { value: offerMediaObject.simulcast_03.value.replace(/send/g, 'recv'), }; this._mediaObject.rids = []; - for (const rid of offerMediaObject.rids || []) { + for (const rid of offerMediaObject.rids ?? []) { if (rid.direction !== 'send') { continue; } @@ -432,7 +431,7 @@ export class AnswerMediaSection extends MediaSection { } muxSimulcastStreams(encodings: RTCRtpEncodingParameters[]): void { - if (!this._mediaObject.simulcast || !this._mediaObject.simulcast.list1) { + if (!this._mediaObject.simulcast?.list1) { return; } @@ -523,7 +522,7 @@ export class OfferMediaSection extends MediaSection { this._mediaObject.fmtp = []; if (!this._planB) { - this._mediaObject.msid = `${streamId || '-'} ${trackId}`; + this._mediaObject.msid = `${streamId ?? '-'} ${trackId}`; } for (const codec of offerRtpParameters!.codecs) { @@ -583,8 +582,7 @@ export class OfferMediaSection extends MediaSection { const encoding = offerRtpParameters!.encodings![0]; const ssrc = encoding.ssrc; - const rtxSsrc = - encoding.rtx && encoding.rtx.ssrc ? encoding.rtx.ssrc : undefined; + const rtxSsrc = encoding.rtx?.ssrc; this._mediaObject.ssrcs = []; this._mediaObject.ssrcGroups = []; @@ -601,7 +599,7 @@ export class OfferMediaSection extends MediaSection { this._mediaObject.ssrcs.push({ id: ssrc, attribute: 'msid', - value: `${streamId || '-'} ${trackId}`, + value: `${streamId ?? '-'} ${trackId}`, }); } @@ -618,7 +616,7 @@ export class OfferMediaSection extends MediaSection { this._mediaObject.ssrcs.push({ id: rtxSsrc, attribute: 'msid', - value: `${streamId || '-'} ${trackId}`, + value: `${streamId ?? '-'} ${trackId}`, }); } @@ -675,8 +673,7 @@ export class OfferMediaSection extends MediaSection { }): void { const encoding = offerRtpParameters.encodings![0]; const ssrc = encoding.ssrc; - const rtxSsrc = - encoding.rtx && encoding.rtx.ssrc ? encoding.rtx.ssrc : undefined; + const rtxSsrc = encoding.rtx?.ssrc; const payloads = this._mediaObject.payloads.split(' '); for (const codec of offerRtpParameters.codecs) { @@ -743,7 +740,7 @@ export class OfferMediaSection extends MediaSection { this._mediaObject.ssrcs.push({ id: ssrc, attribute: 'msid', - value: `${streamId || '-'} ${trackId}`, + value: `${streamId ?? '-'} ${trackId}`, }); if (rtxSsrc) { @@ -758,7 +755,7 @@ export class OfferMediaSection extends MediaSection { this._mediaObject.ssrcs.push({ id: rtxSsrc, attribute: 'msid', - value: `${streamId || '-'} ${trackId}`, + value: `${streamId ?? '-'} ${trackId}`, }); // Associate original and retransmission SSRCs. @@ -776,8 +773,7 @@ export class OfferMediaSection extends MediaSection { }): void { const encoding = offerRtpParameters.encodings![0]; const ssrc = encoding.ssrc; - const rtxSsrc = - encoding.rtx && encoding.rtx.ssrc ? encoding.rtx.ssrc : undefined; + const rtxSsrc = encoding.rtx?.ssrc; this._mediaObject.ssrcs = this._mediaObject.ssrcs.filter( (s: any) => s.id !== ssrc && s.id !== rtxSsrc diff --git a/src/handlers/sdp/RemoteSdp.ts b/src/handlers/sdp/RemoteSdp.ts index 16f5ff13..12613320 100644 --- a/src/handlers/sdp/RemoteSdp.ts +++ b/src/handlers/sdp/RemoteSdp.ts @@ -77,7 +77,7 @@ export class RemoteSdp { }; // If ICE parameters are given, add ICE-Lite indicator. - if (iceParameters && iceParameters.iceLite) { + if (iceParameters?.iceLite) { this._sdpObject.icelite = 'ice-lite'; } diff --git a/src/handlers/sdp/commonUtils.ts b/src/handlers/sdp/commonUtils.ts index 4528c559..cc3de998 100644 --- a/src/handlers/sdp/commonUtils.ts +++ b/src/handlers/sdp/commonUtils.ts @@ -79,7 +79,7 @@ export function extractRtpCapabilities({ } // Specials case to convert parameter value to string. - if (parameters && parameters.hasOwnProperty('profile-level-id')) { + if (parameters?.hasOwnProperty('profile-level-id')) { parameters['profile-level-id'] = String(parameters['profile-level-id']); } diff --git a/src/handlers/sdp/planBUtils.ts b/src/handlers/sdp/planBUtils.ts index c8579cf6..9a3c2fac 100644 --- a/src/handlers/sdp/planBUtils.ts +++ b/src/handlers/sdp/planBUtils.ts @@ -172,9 +172,7 @@ export function addLegacySimulcast({ ssrcs: ssrcs.join(' '), }); - for (let i = 0; i < ssrcs.length; ++i) { - const ssrc = ssrcs[i]; - + for (const ssrc of ssrcs) { offerMediaObject.ssrcs.push({ id: ssrc, attribute: 'cname', diff --git a/src/handlers/sdp/unifiedPlanUtils.ts b/src/handlers/sdp/unifiedPlanUtils.ts index 5d16543c..68860b67 100644 --- a/src/handlers/sdp/unifiedPlanUtils.ts +++ b/src/handlers/sdp/unifiedPlanUtils.ts @@ -87,8 +87,8 @@ export function addLegacySimulcast({ } const [streamId, trackId] = ssrcMsidLine.value.split(' '); - const firstSsrc = ssrcMsidLine.id; - let firstRtxSsrc; + const firstSsrc = Number(ssrcMsidLine.id); + let firstRtxSsrc: number | undefined; // Get the SSRC for RTX. (offerMediaObject.ssrcGroups || []).some((line: any) => { @@ -135,9 +135,7 @@ export function addLegacySimulcast({ ssrcs: ssrcs.join(' '), }); - for (let i = 0; i < ssrcs.length; ++i) { - const ssrc = ssrcs[i]; - + for (const ssrc of ssrcs) { offerMediaObject.ssrcs.push({ id: ssrc, attribute: 'cname', diff --git a/src/ortc.ts b/src/ortc.ts index d3c379f1..dc952e1d 100644 --- a/src/ortc.ts +++ b/src/ortc.ts @@ -213,12 +213,12 @@ export function getExtendedRtpCapabilities( }; // Match media codecs and keep the order preferred by remoteCaps. - for (const remoteCodec of remoteCaps.codecs || []) { + for (const remoteCodec of remoteCaps.codecs ?? []) { if (isRtxCodec(remoteCodec)) { continue; } - const matchingLocalCodec = (localCaps.codecs || []).find( + const matchingLocalCodec = (localCaps.codecs ?? []).find( (localCodec: RtpCodecCapability) => matchCodecs(localCodec, remoteCodec, { strict: true, modify: true }) ); @@ -534,7 +534,7 @@ export function getSendingRemoteRtpParameters( ) ) { for (const codec of rtpParameters.codecs) { - codec.rtcpFeedback = (codec.rtcpFeedback || []).filter( + codec.rtcpFeedback = (codec.rtcpFeedback ?? []).filter( (fb: RtcpFeedback) => fb.type !== 'goog-remb' ); } @@ -545,13 +545,13 @@ export function getSendingRemoteRtpParameters( ) ) { for (const codec of rtpParameters.codecs) { - codec.rtcpFeedback = (codec.rtcpFeedback || []).filter( + codec.rtcpFeedback = (codec.rtcpFeedback ?? []).filter( fb => fb.type !== 'transport-cc' ); } } else { for (const codec of rtpParameters.codecs) { - codec.rtcpFeedback = (codec.rtcpFeedback || []).filter( + codec.rtcpFeedback = (codec.rtcpFeedback ?? []).filter( (fb: RtcpFeedback) => fb.type !== 'transport-cc' && fb.type !== 'goog-remb' ); @@ -1135,8 +1135,8 @@ function reduceRtcpFeedback( ): RtcpFeedback[] { const reducedRtcpFeedback: RtcpFeedback[] = []; - for (const aFb of codecA.rtcpFeedback || []) { - const matchingBFb = (codecB.rtcpFeedback || []).find( + for (const aFb of codecA.rtcpFeedback ?? []) { + const matchingBFb = (codecB.rtcpFeedback ?? []).find( (bFb: RtcpFeedback) => bFb.type === aFb.type && (bFb.parameter === aFb.parameter || (!bFb.parameter && !aFb.parameter)) diff --git a/src/scalabilityModes.ts b/src/scalabilityModes.ts index 3f31a1b5..42120320 100644 --- a/src/scalabilityModes.ts +++ b/src/scalabilityModes.ts @@ -6,7 +6,7 @@ export type ScalabilityMode = { }; export function parse(scalabilityMode?: string): ScalabilityMode { - const match = ScalabilityModeRegex.exec(scalabilityMode || ''); + const match = ScalabilityModeRegex.exec(scalabilityMode ?? ''); if (match) { return { diff --git a/src/test/fakeParameters.ts b/src/test/fakeParameters.ts index 9cd05c82..f1a8c5ce 100644 --- a/src/test/fakeParameters.ts +++ b/src/test/fakeParameters.ts @@ -264,19 +264,18 @@ export function generateNativeRtpCapabilities(): mediasoupClient.types.RtpCapabi }, { kind: 'video', - // @ts-ignore uri: 'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay', preferredId: 6, }, { kind: 'video', - // @ts-ignore + // @ts-expect-error --- ON purpose. uri: 'http://www.webrtc.org/experiments/rtp-hdrext/video-content-type', preferredId: 7, }, { kind: 'video', - // @ts-ignore + // @ts-expect-error --- ON purpose. uri: 'http://www.webrtc.org/experiments/rtp-hdrext/video-timing', preferredId: 8, }, @@ -383,7 +382,7 @@ export function generateConsumerRemoteParameters({ switch (codecMimeType) { case 'audio/opus': { return { - id: id || generateFakeUuid(), + id: id ?? generateFakeUuid(), producerId: generateFakeUuid(), kind: 'audio', rtpParameters: utils.deepFreeze({ @@ -430,7 +429,7 @@ export function generateConsumerRemoteParameters({ case 'audio/ISAC': { return { - id: id || generateFakeUuid(), + id: id ?? generateFakeUuid(), producerId: generateFakeUuid(), kind: 'audio', rtpParameters: utils.deepFreeze({ @@ -470,7 +469,7 @@ export function generateConsumerRemoteParameters({ case 'video/VP8': { return { - id: id || generateFakeUuid(), + id: id ?? generateFakeUuid(), producerId: generateFakeUuid(), kind: 'video', rtpParameters: utils.deepFreeze({ @@ -541,7 +540,7 @@ export function generateConsumerRemoteParameters({ case 'video/H264': { return { - id: id || generateFakeUuid(), + id: id ?? generateFakeUuid(), producerId: generateFakeUuid(), kind: 'video', rtpParameters: utils.deepFreeze({ @@ -628,7 +627,7 @@ export function generateDataConsumerRemoteParameters({ id, }: { id?: string } = {}): mediasoupClient.types.DataConsumerOptions { return { - id: id || generateFakeUuid(), + id: id ?? generateFakeUuid(), dataProducerId: generateFakeUuid(), sctpStreamParameters: utils.deepFreeze({ diff --git a/src/test/test.ts b/src/test/test.ts index b63faf63..9b107de2 100644 --- a/src/test/test.ts +++ b/src/test/test.ts @@ -78,7 +78,7 @@ beforeEach(async () => { ctx.connectedSendTransport.on( 'produce', - // eslint-disable-next-line no-shadow, @typescript-eslint/no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars ({ kind, rtpParameters, appData }, callback /* errback */) => { // eslint-disable-next-line no-shadow const id = fakeParameters.generateProducerRemoteParameters().id; @@ -90,7 +90,7 @@ beforeEach(async () => { ctx.connectedSendTransport.on( 'producedata', ( - // eslint-disable-next-line no-shadow, @typescript-eslint/no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars { sctpStreamParameters, label, protocol, appData }, callback /* errback */ ) => { @@ -190,7 +190,7 @@ test('create a Device in Node without custom handlerName/handlerFactory throws U }); test('create a Device with an unknown handlerName string throws TypeError', () => { - // @ts-ignore + // @ts-expect-error --- On purpose. expect(() => new Device({ handlerName: 'FooBrowser666' })).toThrow(TypeError); }); @@ -232,7 +232,7 @@ test('device.createSendTransport() throws InvalidStateError if not loaded', () = }); test('device.load() without routerRtpCapabilities rejects with TypeError', async () => { - // @ts-ignore + // @ts-expect-error --- On purpose. await expect(ctx.device!.load({})).rejects.toThrow(TypeError); expect(ctx.device!.loaded).toBe(false); @@ -245,7 +245,7 @@ test('device.load() with invalid routerRtpCapabilities rejects with TypeError', ); for (const codec of routerRtpCapabilities.codecs!) { - // @ts-ignore + // @ts-expect-error --- On purpose. delete codec!.mimeType; } @@ -291,7 +291,7 @@ test('device.canProduce() with "audio"/"video" kind returns true', () => { }); test('device.canProduce() with invalid kind throws TypeError', () => { - // @ts-ignore + // @ts-expect-error --- On purpose. expect(() => ctx.loadedDevice!.canProduce('chicken')).toThrow(TypeError); }); @@ -343,20 +343,20 @@ test('device.createRecvTransport() for receiving media succeeds', () => { }); test('device.createSendTransport() with missing remote Transport parameters throws TypeError', () => { - // @ts-ignore + // @ts-expect-error --- On purpose. expect(() => ctx.loadedDevice!.createSendTransport({ id: '1234' })).toThrow( TypeError ); expect(() => - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.loadedDevice!.createSendTransport({ id: '1234', iceParameters: {} }) ).toThrow(TypeError); expect(() => ctx.loadedDevice!.createSendTransport({ id: '1234', - // @ts-ignore + // @ts-expect-error --- On purpose. iceParameters: {}, iceCandidates: [], }) @@ -374,7 +374,7 @@ test('device.createRecvTransport() with a non object appData throws TypeError', iceCandidates, dtlsParameters, sctpParameters, - // @ts-ignore + // @ts-expect-error --- On purpose. appData: 1234, }) ).toThrow(TypeError); @@ -622,7 +622,7 @@ test('transport.produce() with a non object appData rejects with TypeError', asy const track = new FakeMediaStreamTrack({ kind: 'audio' }); await expect( - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.sendTransport!.produce({ track, appData: true }) ).rejects.toThrow(TypeError); }, 500); @@ -839,7 +839,7 @@ test('transport.consume() batches consumers created in same macrotask into the s codecMimeType: 'video/VP8', }); - // @ts-ignore + // @ts-expect-error --- On purpose. const pushSpy = jest.spyOn(ctx.connectedRecvTransport!._awaitQueue, 'push'); const waitForConsumer = (id: string | undefined): Promise => { @@ -874,28 +874,28 @@ test('transport.consume() batches consumers created in same macrotask into the s await allConsumersCreated; - expect(pushSpy).toBeCalledTimes(1); + expect(pushSpy).toHaveBeenCalledTimes(1); }, 500); test('transport.consume() without remote Consumer parameters rejects with TypeError', async () => { - // @ts-ignore + // @ts-expect-error --- On purpose. await expect(ctx.recvTransport!.consume({})).rejects.toThrow(TypeError); }, 500); test('transport.consume() with missing remote Consumer parameters rejects with TypeError', async () => { - // @ts-ignore + // @ts-expect-error --- On purpose. await expect(ctx.recvTransport!.consume({ id: '1234' })).rejects.toThrow( TypeError ); await expect( - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.recvTransport!.consume({ id: '1234', producerId: '4444' }) ).rejects.toThrow(TypeError); await expect( ctx.recvTransport!.consume( - // @ts-ignore + // @ts-expect-error --- On purpose. { id: '1234', producerId: '4444', @@ -906,7 +906,7 @@ test('transport.consume() with missing remote Consumer parameters rejects with T await expect( ctx.recvTransport!.consume( - // @ts-ignore + // @ts-expect-error --- On purpose. { id: '1234', producerId: '4444', @@ -955,7 +955,7 @@ test('transport.consume() with a non object appData rejects with TypeError', asy }); await expect( - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.recvTransport!.consume({ consumerRemoteParameters, appData: true }) ).rejects.toThrow(TypeError); }, 500); @@ -998,7 +998,7 @@ test('transport.produceData() in a receiving Transport rejects with UnsupportedE test('transport.produceData() with a non object appData rejects with TypeError', async () => { await expect( - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.sendTransport!.produceData({ appData: true }) ).rejects.toThrow(TypeError); }, 500); @@ -1031,18 +1031,18 @@ test('transport.consumeData() succeeds', async () => { }, 500); test('transport.consumeData() without remote DataConsumer parameters rejects with TypeError', async () => { - // @ts-ignore + // @ts-expect-error --- On purpose. await expect(ctx.recvTransport!.consumeData({})).rejects.toThrow(TypeError); }, 500); test('transport.consumeData() with missing remote DataConsumer parameters rejects with TypeError', async () => { - // @ts-ignore + // @ts-expect-error --- On purpose. await expect(ctx.recvTransport!.consumeData({ id: '1234' })).rejects.toThrow( TypeError ); await expect( - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.recvTransport!.consumeData({ id: '1234', dataProducerId: '4444' }) ).rejects.toThrow(TypeError); }, 500); @@ -1067,7 +1067,7 @@ test('transport.consumeData() with a non object appData rejects with TypeError', await expect( ctx.recvTransport!.consumeData({ dataConsumerRemoteParameters, - // @ts-ignore + // @ts-expect-error --- On purpose. appData: true, }) ).rejects.toThrow(TypeError); @@ -1091,7 +1091,7 @@ test('transport.restartIce() succeeds', async () => { }, 500); test('transport.restartIce() without remote iceParameters rejects with TypeError', async () => { - // @ts-ignore + // @ts-expect-error --- On purpose. await expect(ctx.sendTransport!.restartIce({})).rejects.toThrow(TypeError); }, 500); @@ -1113,9 +1113,9 @@ test('ICE gathering state change fires "icegatheringstatechange" in live Transpo // private setupTransport() method is called (which has happens many times in // tests above already). So here we have to reset it manually to test things. - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.sendTransport!.handler.setIceGatheringState('new'); - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.sendTransport!.handler.setConnectionState('new'); let iceGatheringStateChangeEventNumTimesCalled = 0; @@ -1134,7 +1134,7 @@ test('ICE gathering state change fires "icegatheringstatechange" in live Transpo connectionStateChangeEventNumTimesCalled++; }); - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.sendTransport!.handler.setIceGatheringState('complete'); expect(iceGatheringStateChangeEventNumTimesCalled).toBe(1); @@ -1152,7 +1152,7 @@ test('connection state change fires "connectionstatechange" in live Transport', expect(connectionState).toBe('completed'); }); - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.sendTransport!.handler.setConnectionState('completed'); expect(connectionStateChangeEventNumTimesCalled).toBe(1); @@ -1286,13 +1286,13 @@ test('producer.setMaxSpatialLayer() in an audio Producer rejects with Unsupporte test('producer.setMaxSpatialLayer() with invalid spatialLayer rejects with TypeError', async () => { await expect( - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.videoProducer!.setMaxSpatialLayer('chicken') ).rejects.toThrow(TypeError); }, 500); test('producer.setMaxSpatialLayer() without spatialLayer rejects with TypeError', async () => { - // @ts-ignore + // @ts-expect-error --- On purpose. await expect(ctx.videoProducer!.setMaxSpatialLayer()).rejects.toThrow( TypeError ); @@ -1405,7 +1405,7 @@ test('remotetely stopped track fires "trackended" in live Producers/Consumers', videoConsumerTrackendedEventCalled = true; }); - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.audioProducer!.track.remoteStop(); expect(audioProducerTrackendedEventCalled).toBe(true); @@ -1413,17 +1413,17 @@ test('remotetely stopped track fires "trackended" in live Producers/Consumers', // Let's close the video producer. ctx.videoProducer!.close(); - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.videoProducer!.track.remoteStop(); expect(videoProducerTrackendedEventCalled).toBe(false); - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.audioConsumer!.track.remoteStop(); expect(audiosConsumerTrackendedEventCalled).toBe(true); - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.videoConsumer!.track.remoteStop(); expect(videoConsumerTrackendedEventCalled).toBe(true); @@ -1484,7 +1484,7 @@ test('transport.produce() rejects with InvalidStateError if closed', async () => test('transport.consume() rejects with InvalidStateError if closed', async () => { ctx.connectedRecvTransport!.close(); - // @ts-ignore + // @ts-expect-error --- On purpose. await expect(ctx.connectedRecvTransport!.consume({})).rejects.toThrow( InvalidStateError ); @@ -1501,7 +1501,7 @@ test('transport.produceData() rejects with InvalidStateError if closed', async ( test('transport.consumeData() rejects with InvalidStateError if closed', async () => { ctx.connectedRecvTransport!.close(); - // @ts-ignore + // @ts-expect-error --- On purpose. await expect(ctx.connectedRecvTransport!.consumeData({})).rejects.toThrow( InvalidStateError ); @@ -1519,7 +1519,7 @@ test('transport.restartIce() rejects with InvalidStateError if closed', async () ctx.connectedSendTransport!.close(); await expect( - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.connectedSendTransport!.restartIce({ ieParameters: {} }) ).rejects.toThrow(InvalidStateError); }, 500); @@ -1544,20 +1544,20 @@ test('connection state change does not fire "connectionstatechange" in closed Tr ctx.connectedSendTransport!.close(); - // @ts-ignore + // @ts-expect-error --- On purpose. ctx.connectedSendTransport!.handler.setConnectionState('disconnected'); expect(connectionStateChangeEventNumTimesCalled).toBe(0); expect(ctx.connectedSendTransport!.connectionState).toBe('disconnected'); }); -test('RemoteSdp properly handles multiple streams of the same type in planB', async () => { +test('RemoteSdp properly handles multiple streams of the same type in planB', () => { let sdp = undefined; let sdpObject = undefined; const remoteSdp = new RemoteSdp({ planB: true }); - await remoteSdp.receive({ + remoteSdp.receive({ mid: 'video', kind: 'video', offerRtpParameters: fakeParameters.generateConsumerRemoteParameters({ @@ -1579,7 +1579,7 @@ test('RemoteSdp properly handles multiple streams of the same type in planB', as expect(sdpObject.media[0].rtp[1].codec).toBe('rtx'); expect(sdpObject.media[0].ssrcs?.length).toBe(4); - await remoteSdp.receive({ + remoteSdp.receive({ mid: 'video', kind: 'video', offerRtpParameters: fakeParameters.generateConsumerRemoteParameters({ @@ -1605,7 +1605,7 @@ test('RemoteSdp properly handles multiple streams of the same type in planB', as expect(sdpObject.media[0].rtp[3].codec).toBe('rtx'); expect(sdpObject.media[0].ssrcs?.length).toBe(8); - await remoteSdp.planBStopReceiving({ + remoteSdp.planBStopReceiving({ mid: 'video', offerRtpParameters: fakeParameters.generateConsumerRemoteParameters({ codecMimeType: 'video/H264', @@ -1629,13 +1629,13 @@ test('RemoteSdp properly handles multiple streams of the same type in planB', as expect(sdpObject.media[0].ssrcs?.length).toBe(4); }, 500); -test('RemoteSdp does not duplicate codec descriptions', async () => { +test('RemoteSdp does not duplicate codec descriptions', () => { let sdp = undefined; let sdpObject = undefined; const remoteSdp = new RemoteSdp({ planB: true }); - await remoteSdp.receive({ + remoteSdp.receive({ mid: 'video', kind: 'video', offerRtpParameters: fakeParameters.generateConsumerRemoteParameters({ @@ -1657,7 +1657,7 @@ test('RemoteSdp does not duplicate codec descriptions', async () => { expect(sdpObject.media[0].rtp[1].codec).toBe('rtx'); expect(sdpObject.media[0].ssrcs?.length).toBe(4); - await remoteSdp.receive({ + remoteSdp.receive({ mid: 'video', kind: 'video', offerRtpParameters: fakeParameters.generateConsumerRemoteParameters({ @@ -1724,9 +1724,10 @@ describe('detectDevice() assigns proper handler based on UserAgent', () => { for (const uaTestCase of uaTestCases) { test( + // eslint-disable-next-line jest/valid-title --- Jest is not that smart. uaTestCase.desc, () => { - // @ts-ignore + // @ts-expect-error --- On purpose. global.navigator = { userAgent: uaTestCase.ua, }; diff --git a/tsconfig.json b/tsconfig.json index 173a0078..718772eb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compileOnSave": true, "compilerOptions": { - "lib": ["es2020", "dom"], + "lib": ["es2022", "dom"], "target": "es2020", "module": "commonjs", "moduleResolution": "node",