From 4e4aa45440e95c57e97cda2452f67317cb7135ec Mon Sep 17 00:00:00 2001 From: Jim Gustafson Date: Mon, 1 Jun 2026 14:12:38 -0700 Subject: [PATCH] Desktop: Update node dependencies --- .github/workflows/ringrtc.yml | 2 +- src/node/.eslintignore | 5 - src/node/.eslintrc.js | 145 - src/node/.nvmrc | 2 +- src/node/.oxlintrc.json | 1565 +++++++++ src/node/index.ts | 26 +- src/node/package-lock.json | 5071 ++++------------------------ src/node/package.json | 43 +- src/node/ringrtc/CallLinks.ts | 6 +- src/node/ringrtc/Native.ts | 6 +- src/node/ringrtc/Service.ts | 122 +- src/node/scripts/fetch-prebuild.js | 20 +- src/node/test/CallingClass.ts | 24 +- src/node/test/RingRTC-test.ts | 37 +- src/node/test/Utils.ts | 9 +- src/node/tsconfig.json | 3 +- 16 files changed, 2338 insertions(+), 4748 deletions(-) delete mode 100644 src/node/.eslintignore delete mode 100644 src/node/.eslintrc.js create mode 100644 src/node/.oxlintrc.json diff --git a/.github/workflows/ringrtc.yml b/.github/workflows/ringrtc.yml index 669fc6ec..eeabfa1a 100644 --- a/.github/workflows/ringrtc.yml +++ b/.github/workflows/ringrtc.yml @@ -74,7 +74,7 @@ jobs: run: npm ci working-directory: src/node - name: Check typescript - run: npm run eslint + run: npm run oxlint working-directory: src/node - name: Check package.json for prebuildChecksum run: >- diff --git a/src/node/.eslintignore b/src/node/.eslintignore deleted file mode 100644 index eca249ed..00000000 --- a/src/node/.eslintignore +++ /dev/null @@ -1,5 +0,0 @@ -build/** -dist/** - -# TypeScript generated files -ts/**/*.js diff --git a/src/node/.eslintrc.js b/src/node/.eslintrc.js deleted file mode 100644 index e97de9e4..00000000 --- a/src/node/.eslintrc.js +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2018-2021 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -const rules = { - 'comma-dangle': [ - 'error', - { - arrays: 'always-multiline', - objects: 'always-multiline', - imports: 'always-multiline', - exports: 'always-multiline', - functions: 'never', - }, - ], - - // prevents us from accidentally checking in exclusive tests (`.only`): - 'mocha/no-exclusive-tests': 'error', - - // it helps readability to put public API at top, - 'no-use-before-define': 'off', - - // useful for unused or internal fields - 'no-underscore-dangle': 'off', - - // though we have a logger, we still remap console to log to disk - 'no-console': 'error', - - // consistently place operators at end of line except ternaries - 'operator-linebreak': [ - 'error', - 'after', - { overrides: { '?': 'ignore', ':': 'ignore' } }, - ], - - quotes: [ - 'error', - 'single', - { avoidEscape: true, allowTemplateLiterals: false }, - ], - - 'no-continue': 'off', - 'no-bitwise': 'off', - 'no-plusplus': 'off', - - // Prettier overrides: - 'arrow-parens': 'off', - 'function-paren-newline': 'off', - - // We prefer named exports - 'import/prefer-default-export': 'off', - - 'no-restricted-syntax': [ - 'error', - { - selector: 'ForInStatement', - message: - 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.', - }, - { - selector: 'LabeledStatement', - message: - 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.', - }, - { - selector: 'WithStatement', - message: - '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.', - }, - ], - curly: 'error', - - 'prefer-template': 'error', - - // Things present in our existing code that we may want to be stricter about in the future. - eqeqeq: 'off', - // The RingRTC singleton is used in VideoSupport; maybe we should untangle this. - 'import/no-cycle': 'off', -}; - -const typescriptRules = { - ...rules, - - '@typescript-eslint/array-type': ['error', { default: 'generic' }], - '@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }], - - // Overrides recommended by typescript-eslint - // https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0 - '@typescript-eslint/no-redeclare': 'error', - '@typescript-eslint/no-shadow': ['error', { ignoreOnInitialization: true }], - '@typescript-eslint/no-useless-constructor': ['error'], - 'no-shadow': 'off', - 'no-useless-constructor': 'off', - - // useful for unused parameters - '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], - - // Upgrade from a warning - '@typescript-eslint/explicit-module-boundary-types': 'error', - - // Already enforced by TypeScript - 'consistent-return': 'off', - - // Things present in our existing code that we may want to be stricter about in the future. - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-unsafe-assignment': 'off', - '@typescript-eslint/no-unsafe-argument': 'off', - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/restrict-template-expressions': 'off', - '@typescript-eslint/no-use-before-define': 'off', -}; - -module.exports = { - root: true, - env: { - node: true, - es2018: true, - }, - settings: { - 'import/core-modules': ['electron'], - }, - - extends: ['eslint:recommended', 'prettier'], - - plugins: ['import', 'mocha', 'more'], - - overrides: [ - { - files: ['**/*.ts'], - parser: '@typescript-eslint/parser', - parserOptions: { - project: 'tsconfig.json', - sourceType: 'module', - }, - plugins: ['@typescript-eslint'], - extends: [ - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', - ], - rules: typescriptRules, - }, - ], - - rules, -}; diff --git a/src/node/.nvmrc b/src/node/.nvmrc index 442c7587..5bf4400f 100644 --- a/src/node/.nvmrc +++ b/src/node/.nvmrc @@ -1 +1 @@ -22.20.0 +24.15.0 diff --git a/src/node/.oxlintrc.json b/src/node/.oxlintrc.json new file mode 100644 index 00000000..e23c28d0 --- /dev/null +++ b/src/node/.oxlintrc.json @@ -0,0 +1,1565 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "options": { + "typeAware": true, + "reportUnusedDisableDirectives": "error" + }, + "plugins": [ + "eslint", + "import", + // "jsdoc", + // "jest", + // "jsx-a11y", + // "nextjs", + "node", + "oxc", + "promise", + // "react", + // "react-perf", + "typescript", + "unicorn" + // "vitest", + // "vue" + ], + "categories": { + "correctness": "warn", + "nursery": "warn", + "pedantic": "warn", + "perf": "warn", + "restriction": "warn", + "style": "warn", + "suspicious": "warn" + }, + "rules": { + // ------------------------------------------------------------------------ + // Category: Correctness + // ------------------------------------------------------------------------ + + // [correctness] (✅ recommended) Require super() calls in constructors + "eslint/constructor-super": "error", + // [correctness] (✅ recommended) (⚠️ 🛠️ dangerous autofix) Enforce for loop update clause moving the counter in the right direction + "eslint/for-direction": "error", + // [correctness] (✅ recommended) Disallow using an async function as a Promise executor + "eslint/no-async-promise-executor": "error", + // [correctness] (✅ recommended) Disallow the use of arguments.caller or arguments.callee + "eslint/no-caller": "error", + // [correctness] (✅ recommended) Disallow reassigning class members + "eslint/no-class-assign": "error", + // [correctness] (✅ recommended) (🛠️ autofix) (💡 suggestion) Disallow comparing against -0 + "eslint/no-compare-neg-zero": "error", + // [correctness] (✅ recommended) Disallow assignment operators in conditional expressions + "eslint/no-cond-assign": ["error", "always"], + // [correctness] (✅ recommended) Disallow reassigning const, using, and await using variables + "eslint/no-const-assign": "error", + // [correctness] (✅ recommended) Disallow expressions where the operation doesn't affect the value + "eslint/no-constant-binary-expression": "off", + // [correctness] (✅ recommended) Disallow constant expressions in conditions + "eslint/no-constant-condition": [ + "error", + { + "checkLoops": "all" + } + ], + // [correctness] (✅ recommended) Disallow control characters in regular expressions + "eslint/no-control-regex": "off", + // [correctness] (✅ recommended) (🛠️ autofix) Disallow the use of debugger + "eslint/no-debugger": "error", + // [correctness] (✅ recommended) Disallow deleting variables + "eslint/no-delete-var": "error", + // [correctness] (✅ recommended) Disallow duplicate class members + "eslint/no-dupe-class-members": "error", + // [correctness] (✅ recommended) Disallow duplicate conditions in if-else-if chains + "eslint/no-dupe-else-if": "error", + // [correctness] (✅ recommended) Disallow duplicate keys in object literals + "eslint/no-dupe-keys": "error", + // [correctness] (✅ recommended) Disallow duplicate case labels + "eslint/no-duplicate-case": "error", + // [correctness] (✅ recommended) Disallow empty character classes in regular expressions + "eslint/no-empty-character-class": "error", + // [correctness] (✅ recommended) Disallow empty destructuring patterns + "eslint/no-empty-pattern": "error", + // [correctness] (✅ recommended) (💡 suggestion) Disallow empty static blocks + "eslint/no-empty-static-block": "error", + // [correctness] (✅ recommended) Disallow the use of eval() + "eslint/no-eval": "error", + // [correctness] (✅ recommended) Disallow reassigning exceptions in catch clauses + "eslint/no-ex-assign": "error", + // [correctness] (✅ recommended) (🛠️ autofix) (💡 suggestion) Disallow unnecessary boolean casts + "eslint/no-extra-boolean-cast": "error", + // [correctness] (✅ recommended) Disallow reassigning function declarations + "eslint/no-func-assign": "error", + // [correctness] (✅ recommended) Disallow assignments to native objects or read-only global variables + "eslint/no-global-assign": "error", + // [correctness] (✅ recommended) Disallow assigning to imported bindings + "eslint/no-import-assign": "error", + // [correctness] (✅ recommended) Disallow invalid regular expression strings in RegExp constructors + "eslint/no-invalid-regexp": "error", + // [correctness] (✅ recommended) Disallow irregular whitespace + "eslint/no-irregular-whitespace": "error", + // [correctness] (✅ recommended) (💡 suggestion) Disallow the use of the __iterator__ property + "eslint/no-iterator": "error", + // [correctness] (✅ recommended) Disallow literal numbers that lose precision + "eslint/no-loss-of-precision": "error", + // [correctness] (✅ recommended) (🚧 planned autofix) Disallow characters which are made with multiple code points in character class syntax + "eslint/no-misleading-character-class": "error", + // [correctness] (✅ recommended) Disallow new operators with global non-constructor functions + "eslint/no-new-native-nonconstructor": "error", + // [correctness] (✅ recommended) (💡 suggestion) Disallow \8 and \9 escape sequences in string literals + "eslint/no-nonoctal-decimal-escape": "error", + // [correctness] (✅ recommended) Disallow calling global object properties as functions + "eslint/no-obj-calls": "error", + // [correctness] (✅ recommended) Disallow assignments where both sides are exactly the same + "eslint/no-self-assign": "error", + // [correctness] (✅ recommended) Disallow returning values from setters + "eslint/no-setter-return": "error", + // [correctness] (✅ recommended) Disallow identifiers from shadowing restricted names + "eslint/no-shadow-restricted-names": "error", + // [correctness] (✅ recommended) Disallow sparse arrays + "eslint/no-sparse-arrays": "error", + // [correctness] (✅ recommended) Disallow this/super before calling super() in constructors + "eslint/no-this-before-super": "error", + // [correctness] (✅ recommended) Disallow let or var variables that are read but never assigned + "eslint/no-unassigned-vars": "error", + // [correctness] (✅ recommended) Disallow control flow statements in finally blocks + "eslint/no-unsafe-finally": "error", + // [correctness] (✅ recommended) (🛠️ autofix) Disallow negating the left operand of relational operators + "eslint/no-unsafe-negation": "error", + // [correctness] (✅ recommended) Disallow use of optional chaining in contexts where the undefined value is not allowed + "eslint/no-unsafe-optional-chaining": "error", + // [correctness] (✅ recommended) Disallow unused expressions + "eslint/no-unused-expressions": "error", + // [correctness] (✅ recommended) (🛠️ autofix) Disallow unused labels + "eslint/no-unused-labels": "error", + // [correctness] (✅ recommended) Disallow unused private class members + "eslint/no-unused-private-class-members": "off", + // [correctness] (✅ recommended) ⚠️ 🛠 (💡 suggestion) Disallow unused variables + "eslint/no-unused-vars": [ + "error", // [reason: FILLMEIN] + { "argsIgnorePattern": "^_", "caughtErrors": "none" } + ], + // [correctness] (✅ recommended) Disallow useless backreferences in regular expressions + "eslint/no-useless-backreference": "error", + // [correctness] (✅ recommended) Disallow unnecessary catch clauses + "eslint/no-useless-catch": "error", + // [correctness] (✅ recommended) (🛠️ autofix) Disallow unnecessary escape characters + "eslint/no-useless-escape": "off", + // [correctness] (✅ recommended) (🛠️ autofix) Disallow renaming import, export, and destructured assignments to the same name + "eslint/no-useless-rename": "error", + // [correctness] (✅ recommended) Disallow with statements + "eslint/no-with": "error", + // [correctness] (✅ recommended) Require generator functions to contain yield + "eslint/require-yield": "error", + // [correctness] (✅ recommended) (🛠️ autofix) Require calls to isNaN() when checking for NaN + "eslint/use-isnan": "error", + // [correctness] (✅ recommended) (🛠️ autofix) Enforce comparing typeof expressions against valid strings + "eslint/valid-typeof": [ + "error", + { + "requireStringLiterals": true + } + ], + // [correctness] Ensure a default export is present, given a default import. + "import/default": "error", + // [correctness] Ensure imported namespaces contain dereferenced properties as they are dereferenced. + "import/namespace": "error", + // [correctness] Enforce assertion to be made in a test body + // "jest/expect-expect": "error", + // [correctness] Disallow calling expect conditionally + // "jest/no-conditional-expect": "error", + // [correctness] Disallow disabled tests + // "jest/no-disabled-tests": "error", + // [correctness] Disallow using exports in files containing tests + // "jest/no-export": "error", + // [correctness] (🛠️ autofix) Disallow focused tests + // "jest/no-focused-tests": "error", + // [correctness] Disallow using expect outside of it or test blocks + // "jest/no-standalone-expect": "error", + // [correctness] Require a message for toThrow() + // "jest/require-to-throw-message": "error", + // [correctness] Enforce valid describe() callback + // "jest/valid-describe-callback": "error", + // [correctness] (🚧 planned autofix) Enforce valid expect() usage + // "jest/valid-expect": "error", + // [correctness] (🛠️ autofix) Enforce valid titles + // "jest/valid-title": "error", + // [correctness] (🚧 planned autofix) Ensures that property names in JSDoc are not duplicated on the same block and that nested properties have defined roots. + // "jsdoc/check-property-names": "error", + // [correctness] (🚧 planned autofix) Reports invalid block tag names. + // "jsdoc/check-tag-names": "error", + // [correctness] Prohibits use of @implements on non-constructor functions (to enforce the tag only being used on classes/constructors). + // "jsdoc/implements-on-classes": "error", + // [correctness] (🚧 planned autofix) This rule reports defaults being used on the relevant portion of @param or @default. + // "jsdoc/no-defaults": "error", + // [correctness] (🚧 planned autofix) Requires that all @typedef and @namespace tags have @property when their type is a plain object, Object, or PlainObject. + // "jsdoc/require-property": "error", + // [correctness] Requires that each @property tag has a description value. + // "jsdoc/require-property-description": "error", + // [correctness] Requires that all @property tags have names. + // "jsdoc/require-property-name": "error", + // [correctness] Requires that each @property tag has a type value (in curly brackets). + // "jsdoc/require-property-type": "error", + // [correctness] Requires yields are documented with @yields tags. + // "jsdoc/require-yields": "error", + // [correctness] Enforce all elements that require alternative text have meaningful information to relay back to end user. + "jsx-a11y/alt-text": "error", + // [correctness] (💡 suggestion) Enforce all anchors to contain accessible content. + "jsx-a11y/anchor-has-content": "error", + // [correctness] Enforce all anchors are valid, navigable elements. + "jsx-a11y/anchor-is-valid": "error", + // [correctness] Enforce elements with aria-activedescendant are tabbable. + "jsx-a11y/aria-activedescendant-has-tabindex": "error", + // [correctness] (🛠️ autofix) Enforce all aria-* props are valid. + "jsx-a11y/aria-props": "error", + // [correctness] Enforce ARIA state and property values are valid. + "jsx-a11y/aria-proptypes": "off", + // [correctness] Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role. + "jsx-a11y/aria-role": "error", + // [correctness] (🛠️ autofix) Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes. + "jsx-a11y/aria-unsupported-elements": "error", + // [correctness] Enforce that autocomplete attributes are used correctly. + "jsx-a11y/autocomplete-valid": "error", + // [correctness] Enforce a clickable non-interactive element has at least one keyboard event listener. + "jsx-a11y/click-events-have-key-events": "error", + // [correctness] Enforce that a control (an interactive element) has a text label. + "jsx-a11y/control-has-associated-label": [ + "error", + { + "depth": 3, + "ignoreRoles": ["separator"] + } + ], + // [correctness] Enforce heading (h1, h2, etc) elements contain accessible content. + "jsx-a11y/heading-has-content": "error", + // [correctness] Enforce element has lang prop. + "jsx-a11y/html-has-lang": "error", + // [correctness] Enforce iframe elements have a title attribute. + "jsx-a11y/iframe-has-title": "error", + // [correctness] Enforce alt prop does not contain the word "image", "picture", or "photo". + "jsx-a11y/img-redundant-alt": "error", + // [correctness] (💡 suggestion) Elements with an interactive role and interaction handlers (mouse or key press) must be focusable. + "jsx-a11y/interactive-supports-focus": "error", + // [correctness] Enforce that a label tag has a text label and an associated control. + "jsx-a11y/label-has-associated-control": "error", + // [correctness] Enforce lang attribute has a valid value. + "jsx-a11y/lang": "error", + // [correctness] Enforces that