diff --git a/browser/VencordNativeStub.ts b/browser/VencordNativeStub.ts index a489473df..071c90726 100644 --- a/browser/VencordNativeStub.ts +++ b/browser/VencordNativeStub.ts @@ -108,5 +108,5 @@ window.VencordNative = { getSettingsDir: async () => "LocalStorage" }, - pluginHelpers: {} as any, + pluginHelpers: {}, }; diff --git a/eslint.config.mjs b/eslint.config.mjs index 4ae005c20..e50f30bb4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,6 +1,8 @@ import stylistic from "@stylistic/eslint-plugin"; // @ts-expect-error: No types import pathAlias from "eslint-plugin-path-alias"; +// @ts-expect-error: https://github.com/jsx-eslint/eslint-plugin-react/issues/3776 +import eslintPluginReact from "eslint-plugin-react"; // @ts-expect-error: No types import simpleHeader from "eslint-plugin-simple-header"; import simpleImportSort from "eslint-plugin-simple-import-sort"; @@ -24,10 +26,14 @@ export default tseslint.config( "@stylistic": stylistic, "@typescript-eslint": tseslint.plugin, "path-alias": pathAlias, + "react": eslintPluginReact, "simple-header": simpleHeader, "simple-import-sort": simpleImportSort, "unused-imports": unusedImports, }, + settings: { + react: { version: "18.2" }, + }, rules: { // Since it's only been a month and Vencord has already been stolen // by random skids who rebranded it to "AlphaCord" and erased all license @@ -47,7 +53,7 @@ export default tseslint.config( "@stylistic/dot-location": ["error", "property"], "@stylistic/eol-last": "error", "@stylistic/func-call-spacing": "error", - "@stylistic/generator-star-spacing": "error", + "@stylistic/generator-star-spacing": ["error", { before: false, after: true }], "@stylistic/indent": ["error", 4, { SwitchCase: 1, flatTernaryExpressions: true @@ -169,7 +175,6 @@ export default tseslint.config( }] }], "no-restricted-syntax": ["error", - "JSXOpeningElement[name.name=svg] > JSXAttribute[name.name=xmlns]", "SequenceExpression:not(.update):matches(:not(.callee), [expressions.length!=2])", "SequenceExpression:not(.update) > :first-child:not(Literal)", ], @@ -193,6 +198,11 @@ export default tseslint.config( "prefer-object-spread": "error", "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }], "prefer-spread": "error", + "react/forbid-dom-props": ["error", { + forbid: ["version", "xlinkActuate", "xlinkArcrole", "xlinkHref", "xlinkRole", "xlinkShow", "xlinkTitle", "xlinkType", "xmlBase", "xmlLang", "xmlns", "xmlnsXlink", "xmlSpace"] + }], + "react/jsx-fragments": "error", + "react/jsx-no-useless-fragment": "error", "simple-import-sort/exports": "error", "simple-import-sort/imports": "error", "unused-imports/no-unused-imports": "error", diff --git a/package.json b/package.json index a0bc36e3a..3431a8618 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "nanoid": "^5.0.7" }, "devDependencies": { - "@stylistic/eslint-plugin": "^2.6.0", + "@stylistic/eslint-plugin": "^2.6.1", "@stylistic/stylelint-config": "^2.0.0", "@stylistic/stylelint-plugin": "^3.0.0", "@types/chrome": "^0.0.269", @@ -61,6 +61,7 @@ "esbuild": "^0.23.0", "eslint": "^9.8.0", "eslint-plugin-path-alias": "^2.1.0", + "eslint-plugin-react": "^7.35.0", "eslint-plugin-simple-header": "^1.1.1", "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-unused-imports": "^4.0.1", @@ -72,7 +73,7 @@ "stylelint": "^16.8.1", "stylelint-config-standard": "^36.0.1", "ts-patch": "^3.2.1", - "tsx": "^4.16.3", + "tsx": "^4.16.5", "type-fest": "^4.23.0", "typescript": "^5.5.4", "typescript-eslint": "^8.0.0", @@ -82,7 +83,7 @@ "packageManager": "pnpm@9.6.0", "pnpm": { "patchedDependencies": { - "@stylistic/eslint-plugin-js@2.6.0": "patches/@stylistic__eslint-plugin-js@2.6.0.patch", + "@stylistic/eslint-plugin-js@2.6.1": "patches/@stylistic__eslint-plugin-js@2.6.1.patch", "eslint-plugin-path-alias@2.1.0": "patches/eslint-plugin-path-alias@2.1.0.patch", "eslint@9.8.0": "patches/eslint@9.8.0.patch", "standalone-electron-types@1.0.0": "patches/standalone-electron-types@1.0.0.patch" @@ -97,6 +98,23 @@ "resolve-url": "*", "source-map-url": "*", "urix": "*" + }, + "overrides": { + "array-includes": "npm:@nolyfill/array-includes@^1", + "array.prototype.findlast": "npm:@nolyfill/array.prototype.findlast@^1", + "array.prototype.flat": "npm:@nolyfill/array.prototype.flat@^1", + "array.prototype.flatmap": "npm:@nolyfill/array.prototype.flatmap@^1", + "array.prototype.tosorted": "npm:@nolyfill/array.prototype.tosorted@^1", + "es-iterator-helpers": "npm:@nolyfill/es-iterator-helpers@^1", + "hasown": "npm:@nolyfill/hasown@^1", + "is-core-module": "npm:@nolyfill/is-core-module@^1", + "isarray": "npm:@nolyfill/isarray@^1", + "object.assign": "npm:@nolyfill/object.assign@^1", + "object.entries": "npm:@nolyfill/object.entries@^1", + "object.fromentries": "npm:@nolyfill/object.fromentries@^1", + "object.values": "npm:@nolyfill/object.values@^1", + "string.prototype.matchall": "npm:@nolyfill/string.prototype.matchall@^1", + "string.prototype.repeat": "npm:@nolyfill/string.prototype.repeat@^1" } }, "webExt": { diff --git a/packages/discord-types/package.json b/packages/discord-types/package.json index ce1ee6413..698fbcc74 100644 --- a/packages/discord-types/package.json +++ b/packages/discord-types/package.json @@ -30,7 +30,7 @@ "type-fest": "^4.23.0" }, "devDependencies": { - "@stylistic/eslint-plugin": "^2.6.0", + "@stylistic/eslint-plugin": "^2.6.1", "@types/node": "^20.14.13", "@types/semver": "^7.5.8", "@typescript-eslint/typescript-estree": "^8.0.0", @@ -43,7 +43,7 @@ "eslint-plugin-unused-imports": "^4.0.1", "puppeteer-core": "^22.15.0", "semver": "^7.6.3", - "tsx": "^4.16.3", + "tsx": "^4.16.5", "typescript": "^5.5.4", "typescript-eslint": "^8.0.0" } diff --git a/packages/discord-types/scripts/changeReporter/config.mts b/packages/discord-types/scripts/changeReporter/config.mts index 8637b020d..37658d1d9 100644 --- a/packages/discord-types/scripts/changeReporter/config.mts +++ b/packages/discord-types/scripts/changeReporter/config.mts @@ -297,6 +297,9 @@ export default { // From the API documentation ignoredRemovals: [["SPECTATE"]], }, + MessageReferenceType: { + type: "enum", + }, PollLayoutType: { type: "enum", }, diff --git a/packages/vencord-types/package.json b/packages/vencord-types/package.json index 0234f154b..dc4127cbf 100644 --- a/packages/vencord-types/package.json +++ b/packages/vencord-types/package.json @@ -28,7 +28,7 @@ "devDependencies": { "@types/fs-extra": "^11.0.4", "fs-extra": "^11.2.0", - "tsx": "^4.16.3", + "tsx": "^4.16.5", "typescript": "^5.5.4" } } diff --git a/patches/@stylistic__eslint-plugin-js@2.6.0.patch b/patches/@stylistic__eslint-plugin-js@2.6.1.patch similarity index 100% rename from patches/@stylistic__eslint-plugin-js@2.6.0.patch rename to patches/@stylistic__eslint-plugin-js@2.6.1.patch diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 06d564fb4..c0beffe56 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,10 +4,27 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +overrides: + array-includes: npm:@nolyfill/array-includes@^1 + array.prototype.findlast: npm:@nolyfill/array.prototype.findlast@^1 + array.prototype.flat: npm:@nolyfill/array.prototype.flat@^1 + array.prototype.flatmap: npm:@nolyfill/array.prototype.flatmap@^1 + array.prototype.tosorted: npm:@nolyfill/array.prototype.tosorted@^1 + es-iterator-helpers: npm:@nolyfill/es-iterator-helpers@^1 + hasown: npm:@nolyfill/hasown@^1 + is-core-module: npm:@nolyfill/is-core-module@^1 + isarray: npm:@nolyfill/isarray@^1 + object.assign: npm:@nolyfill/object.assign@^1 + object.entries: npm:@nolyfill/object.entries@^1 + object.fromentries: npm:@nolyfill/object.fromentries@^1 + object.values: npm:@nolyfill/object.values@^1 + string.prototype.matchall: npm:@nolyfill/string.prototype.matchall@^1 + string.prototype.repeat: npm:@nolyfill/string.prototype.repeat@^1 + patchedDependencies: - '@stylistic/eslint-plugin-js@2.6.0': + '@stylistic/eslint-plugin-js@2.6.1': hash: svxcf2j6uikn7di5a4erf5bw5y - path: patches/@stylistic__eslint-plugin-js@2.6.0.patch + path: patches/@stylistic__eslint-plugin-js@2.6.1.patch eslint-plugin-path-alias@2.1.0: hash: japuwsqfkulviwgkm4kd2oi3ky path: patches/eslint-plugin-path-alias@2.1.0.patch @@ -45,8 +62,8 @@ importers: version: 5.0.7 devDependencies: '@stylistic/eslint-plugin': - specifier: ^2.6.0 - version: 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) + specifier: ^2.6.1 + version: 2.6.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) '@stylistic/stylelint-config': specifier: ^2.0.0 version: 2.0.0(stylelint@16.8.1(typescript@5.5.4)) @@ -95,6 +112,9 @@ importers: eslint-plugin-path-alias: specifier: ^2.1.0 version: 2.1.0(patch_hash=japuwsqfkulviwgkm4kd2oi3ky)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) + eslint-plugin-react: + specifier: ^7.35.0 + version: 7.35.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) eslint-plugin-simple-header: specifier: ^1.1.1 version: 1.1.1 @@ -129,8 +149,8 @@ importers: specifier: ^3.2.1 version: 3.2.1 tsx: - specifier: ^4.16.3 - version: 4.16.3 + specifier: ^4.16.5 + version: 4.16.5 type-fest: specifier: ^4.23.0 version: 4.23.0 @@ -175,8 +195,8 @@ importers: version: 4.23.0 devDependencies: '@stylistic/eslint-plugin': - specifier: ^2.6.0 - version: 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) + specifier: ^2.6.1 + version: 2.6.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) '@types/node': specifier: ^20.14.13 version: 20.14.13 @@ -214,8 +234,8 @@ importers: specifier: ^7.6.3 version: 7.6.3 tsx: - specifier: ^4.16.3 - version: 4.16.3 + specifier: ^4.16.5 + version: 4.16.5 typescript: specifier: ^5.5.4 version: 5.5.4 @@ -257,8 +277,8 @@ importers: specifier: ^11.2.0 version: 11.2.0 tsx: - specifier: ^4.16.3 - version: 4.16.3 + specifier: ^4.16.5 + version: 4.16.5 typescript: specifier: ^5.5.4 version: 5.5.4 @@ -656,6 +676,75 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@nolyfill/array-includes@1.0.28': + resolution: {integrity: sha512-3LFZArKSQTQu//UvQXb4lBHWvhxmiZ5h2v50WIXfWb5UPNgeLpeGP8WgsfTePCpZgNlxt5JVFDdv5zLRa7cQXw==} + engines: {node: '>=12.4.0'} + + '@nolyfill/array.prototype.findlast@1.0.24': + resolution: {integrity: sha512-yFCyZLs0iNNubzYnBINcOCJAiGtusxiR2F1DnwkOB1HQbWXl/zltkDIWIXO3cJxhQdngDlmM4ysTfyAfoB297g==} + engines: {node: '>=12.4.0'} + + '@nolyfill/array.prototype.flat@1.0.28': + resolution: {integrity: sha512-bvBWaZDCWV7+jD70tJCy3Olp03Qx9svHN2KmC2j0CYvqfYRet5+iOb09nzb6QULqGrj7O8DQJ03ZQk6gih9J3g==} + engines: {node: '>=12.4.0'} + + '@nolyfill/array.prototype.flatmap@1.0.28': + resolution: {integrity: sha512-Ui/aMijqnYISchzIG0MbRiRh2DKWORJW2s//nw6rJ5jFp6x+nmFCQ5U2be3+id36VsmTxXiv+qLAHxdfXz8g8g==} + engines: {node: '>=12.4.0'} + + '@nolyfill/array.prototype.tosorted@1.0.24': + resolution: {integrity: sha512-lVo8TVDqaslOaOvEH7iL7glu/WdlX7ZrB+7FZY4BL25hg8TLHvg3e9pxafCp8vAQ96IOL+tdgBdfeoC7qLeQYg==} + engines: {node: '>=12.4.0'} + + '@nolyfill/es-iterator-helpers@1.0.21': + resolution: {integrity: sha512-i326KeE0nhW4STobcUhkxpXzZUddedCmfh7b/IyXR9kW0CFHiNNT80C3JSEy33mUlhZtk/ezX47nymcFxyBigg==} + engines: {node: '>=12.4.0'} + + '@nolyfill/hasown@1.0.29': + resolution: {integrity: sha512-9h/nxZqmCy26r9VXGUz+Q77vq3eINXOYgE4st3dj6DoE7tulfJueCLw5d4hfDy3S8mKg4cFXaP+KxYQ+txvMzw==} + engines: {node: '>=12.4.0'} + + '@nolyfill/is-core-module@1.0.39': + resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==} + engines: {node: '>=12.4.0'} + + '@nolyfill/isarray@1.0.29': + resolution: {integrity: sha512-YXk/GW1mquC9LpdjrwhY/RjGWp3ud4JZopFjU0XDHHOCy1h1lzMaiUzH8cjLDrbgSDe3yuk2wL4DNPgpkypulA==} + engines: {node: '>=12.4.0'} + + '@nolyfill/object.assign@1.0.28': + resolution: {integrity: sha512-rrtnXgU2XJvUF9jFMwRbyvLdAlCIJOKtecflza4xWDom6u8UPliTOS0OQ6kvhql7/hpv9b8x9p0s467BVY58xg==} + engines: {node: '>=12.4.0'} + + '@nolyfill/object.entries@1.0.28': + resolution: {integrity: sha512-2t4PayP6Sx7Z20HJjcf8XhhPBO8/H31bwMdP0yEdDcxSXeEhl90Ibb9E3XKzSlcsGf43nXyfabHNrnfvdWE4Ng==} + engines: {node: '>=12.4.0'} + + '@nolyfill/object.fromentries@1.0.28': + resolution: {integrity: sha512-EUt70p38p+xdHDi2i8pIgw6HjrI3y9zndVhAZdEQsAvatKGKRpe3XWZRleEwYRZjkbeAG53Pz30j4tE1IJjvQQ==} + engines: {node: '>=12.4.0'} + + '@nolyfill/object.values@1.0.28': + resolution: {integrity: sha512-W6CdQv4Y/19aA5tenUhRELqlBoD92D4Uh1TDp5uHXD7s9zEHgcDCPCdA8ak6y4I66fR//Fir6C1mAQWv1QLnXw==} + engines: {node: '>=12.4.0'} + + '@nolyfill/shared@1.0.21': + resolution: {integrity: sha512-qDc/NoaFU23E0hhiDPeUrvWzTXIPE+RbvRQtRWSeHHNmCIgYI9HS1jKzNYNJxv4jvZ/1VmM3L6rNVxbj+LBMNA==} + + '@nolyfill/shared@1.0.24': + resolution: {integrity: sha512-TGCpg3k5N7jj9AgU/1xFw9K1g4AC1vEE5ZFkW77oPNNLzprxT17PvFaNr/lr3BkkT5fJ5LNMntaTIq+pyWaeEA==} + + '@nolyfill/shared@1.0.28': + resolution: {integrity: sha512-UJTshFMDgugBcYXGLopbL1enYpGREOEfjUMQKLPLeJqWfbfElGtYbGbUcucCENa7cicGo3M5u/DnPiZe/PYQyw==} + + '@nolyfill/string.prototype.matchall@1.0.28': + resolution: {integrity: sha512-k74WKi7WmtRV847QWlY1ndg6XU1loeAyO9+NVoXrd7RL5lEjBtovp4CPZkifipBMBrZrZu2WwrQqkGrvLNZYpw==} + engines: {node: '>=12.4.0'} + + '@nolyfill/string.prototype.repeat@1.0.28': + resolution: {integrity: sha512-8ww39xe0r4qki8HwAaXTRamO0KpkHHyYoG+PCOFGaBZ8rrlAKcGQcJhu5aB2axauggqsnUfU25j5snEC0aJvYg==} + engines: {node: '>=12.4.0'} + '@puppeteer/browsers@2.3.0': resolution: {integrity: sha512-ioXoq9gPxkss4MYhD+SFaU9p1IHFUX0ILAWFPyjGaBdjLsYAlZw6j1iLA0N/m12uVHLFDfSYNF7EQccjinIMDA==} engines: {node: '>=18'} @@ -664,31 +753,31 @@ packages: '@sapphi-red/web-noise-suppressor@0.3.5': resolution: {integrity: sha512-jh3+V9yM+zxLriQexoGm0GatoPaJWjs6ypFIbFYwQp+AoUb55eUXrjKtKQyuC5zShzzeAQUl0M5JzqB7SSrsRA==} - '@stylistic/eslint-plugin-js@2.6.0': - resolution: {integrity: sha512-6oN0Djdy8gTRhx2qS1m4P+CeDKqmZZwc4ibgzzJS+8iBW3Ts1c2mAvi+OH6TN4bt0AHm0FnDv2+KtTqqueMATw==} + '@stylistic/eslint-plugin-js@2.6.1': + resolution: {integrity: sha512-iLOiVzcvqzDGD9U0EuVOX680v+XOPiPAjkxWj+Q6iV2GLOM5NB27tKVOpJY7AzBhidwpRbaLTgg3T4UzYx09jw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '>=8.40.0' - '@stylistic/eslint-plugin-jsx@2.6.0': - resolution: {integrity: sha512-Hm7YODwBwAsYtacY9hR5ONiBS7K9og4YZFjBr8mfqsmlCYVFje1HsOKG+tylePkwcu0Qhi+lY86cP3rlV4PhAA==} + '@stylistic/eslint-plugin-jsx@2.6.1': + resolution: {integrity: sha512-5qHLXqxfY6jubAQfDqrifv41fx7gaqA9svDaChxMI6JiHpEBfh+PXxmm3g+B8gJCYVBTC62Rjl0Ny5QabK58bw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '>=8.40.0' - '@stylistic/eslint-plugin-plus@2.6.0': - resolution: {integrity: sha512-9GfLF08zx/pNFpQQlNMz6f4IixoS8zdSBFdJLWLTorMilNUjd4dDuA5ej4Z32+mTZf4u6lduzQcUrAYiGKTLTg==} + '@stylistic/eslint-plugin-plus@2.6.1': + resolution: {integrity: sha512-z/IYu/q8ipApzNam5utSU+BrXg4pK/Gv9xNbr4eWv/bZppvTWJU62xCO4nw/6r2dHNPnqc7uCHEC7GMlBnPY0A==} peerDependencies: eslint: '*' - '@stylistic/eslint-plugin-ts@2.6.0': - resolution: {integrity: sha512-9ooVm+BRNqdyI/p10eKGAdbdLKU5lllc7mX4Xqp76hKDsh5cCxmZM6zMgK3CLKkYrW0RUunFORkg8dAnmc1qIA==} + '@stylistic/eslint-plugin-ts@2.6.1': + resolution: {integrity: sha512-Mxl1VMorEG1Hc6oBYPD0+KIJOWkjEF1R0liL7wWgKfwpqOkgmnh5lVdZBrYyfRKOE4RlGcwEFTNai1IW6orgVg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '>=8.40.0' - '@stylistic/eslint-plugin@2.6.0': - resolution: {integrity: sha512-BYzdgwz/4WgDTGmkPMKXFLRBKnYNVnmgD4NDsDCGJulqLFLF6sW1gr6gAJSFnkxwsdhEg+GApF4m5e3OMDpd6g==} + '@stylistic/eslint-plugin@2.6.1': + resolution: {integrity: sha512-UT0f4t+3sQ/GKW7875NiIIjZJ1Bh4gd7JNfoIkwIQyWqO7wGd0Pqzu0Ho30Ka8MNF5lm++SkVeqAk26vGxoUpg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '>=8.40.0' @@ -1194,6 +1283,10 @@ packages: discord-types@1.3.3: resolution: {integrity: sha512-6LGLIw8RBWKdio7FoIfwExSZQuej2XXDKgT7mfR3qMOpEspknVDFQJcfhPuiD1iy2NdcAygvvVfJMliYwiUwqw==} + doctrine@2.1.0: + resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} + engines: {node: '>=0.10.0'} + doctrine@3.0.0: resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} engines: {node: '>=6.0.0'} @@ -1268,6 +1361,12 @@ packages: peerDependencies: eslint: ^8.0.0 + eslint-plugin-react@7.35.0: + resolution: {integrity: sha512-v501SSMOWv8gerHkk+IIQBkcGRGrO2nfybfj5pLxuJNFTPxxA3PSryhXTK+9pNbtkggheDdsC0E9Q8CuPk6JKA==} + engines: {node: '>=4'} + peerDependencies: + eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7 + eslint-plugin-simple-header@1.1.1: resolution: {integrity: sha512-xFK54pYcSEC2uULHTeo2aEgmTmdhZ9ry3zIV9OspLaEPb/Xg1oaFmOcmoNhk9WNJPwzUKrAmYyA8s4YDBfbD+g==} @@ -1443,9 +1542,6 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] - function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - get-caller-file@2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} @@ -1538,10 +1634,6 @@ packages: resolution: {integrity: sha512-ODYZC64uqzmtfGMEAX/FvZiRyWLpAC3vYnNunURUnkGVTS+mI0smVsWaPydRBsE3g+ok7h960jChO8mFcWlHaQ==} engines: {node: '>=0.10.0'} - hasown@2.0.2: - resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} - engines: {node: '>= 0.4'} - highlight.js@11.8.0: resolution: {integrity: sha512-MedQhoqVdr0U6SSnWPzfiadUcDHfN/Wzq25AkXiQv9oiOO/sG0S7XkvpFIqWBl9Yq1UYyYOOVORs5UW2XlPyzg==} engines: {node: '>=12.0.0'} @@ -1616,10 +1708,6 @@ packages: resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} engines: {node: '>=6'} - is-core-module@2.14.0: - resolution: {integrity: sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==} - engines: {node: '>= 0.4'} - is-data-descriptor@0.1.4: resolution: {integrity: sha512-+w9D5ulSoBNlmw9OHn3U2v51SyoCd0he+bB3xMl62oijhrspxowjU+AIcDY0N3iEJbUEkB15IlMASQsxYigvXg==} engines: {node: '>=0.10.0'} @@ -1682,9 +1770,6 @@ packages: resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} engines: {node: '>=0.10.0'} - isarray@1.0.0: - resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} - isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -1736,6 +1821,10 @@ packages: jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} + jsx-ast-utils@3.3.5: + resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==} + engines: {node: '>=4.0'} + jszip@2.7.0: resolution: {integrity: sha512-JIsRKRVC3gTRo2vM4Wy9WBC3TRcfnIZU8k65Phi3izkvPH975FowRYtKGT6PxevA0XnJ/yO8b0QwV0ydVyQwfw==} @@ -1782,6 +1871,10 @@ packages: lodash.truncate@4.4.2: resolution: {integrity: sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==} + loose-envify@1.4.0: + resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} + hasBin: true + lower-case@2.0.2: resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} @@ -1888,6 +1981,10 @@ packages: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + object-copy@0.1.0: resolution: {integrity: sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ==} engines: {node: '>=0.10.0'} @@ -2021,6 +2118,9 @@ packages: resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} engines: {node: '>=0.4.0'} + prop-types@15.8.1: + resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} + proxy-agent@6.4.0: resolution: {integrity: sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==} engines: {node: '>= 14'} @@ -2053,6 +2153,9 @@ packages: queue-tick@1.0.1: resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} + react-is@16.13.1: + resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} + read-pkg-up@7.0.1: resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==} engines: {node: '>=8'} @@ -2108,6 +2211,10 @@ packages: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true + resolve@2.0.0-next.5: + resolution: {integrity: sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==} + hasBin: true + ret@0.1.15: resolution: {integrity: sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==} engines: {node: '>=0.12'} @@ -2126,6 +2233,10 @@ packages: resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} hasBin: true + semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + semver@7.6.3: resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} engines: {node: '>=10'} @@ -2337,8 +2448,8 @@ packages: tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - tsx@4.16.3: - resolution: {integrity: sha512-MP8AEUxVnboD2rCC6kDLxnpDBNWN9k3BSVU/0/nNxgm70bPBnfn+yCKcnOsIVPQwdkbKYoFOlKjjWZWJ2XCXUg==} + tsx@4.16.5: + resolution: {integrity: sha512-ArsiAQHEW2iGaqZ8fTA1nX0a+lN5mNTyuGRRO6OW3H/Yno1y9/t1f9YOI1Cfoqz63VAthn++ZYcbDP7jPflc+A==} engines: {node: '>=18.0.0'} hasBin: true @@ -2729,6 +2840,66 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.13.0 + '@nolyfill/array-includes@1.0.28': + dependencies: + '@nolyfill/shared': 1.0.28 + + '@nolyfill/array.prototype.findlast@1.0.24': + dependencies: + '@nolyfill/shared': 1.0.24 + + '@nolyfill/array.prototype.flat@1.0.28': + dependencies: + '@nolyfill/shared': 1.0.28 + + '@nolyfill/array.prototype.flatmap@1.0.28': + dependencies: + '@nolyfill/shared': 1.0.28 + + '@nolyfill/array.prototype.tosorted@1.0.24': + dependencies: + '@nolyfill/shared': 1.0.24 + + '@nolyfill/es-iterator-helpers@1.0.21': + dependencies: + '@nolyfill/shared': 1.0.21 + + '@nolyfill/hasown@1.0.29': {} + + '@nolyfill/is-core-module@1.0.39': {} + + '@nolyfill/isarray@1.0.29': {} + + '@nolyfill/object.assign@1.0.28': + dependencies: + '@nolyfill/shared': 1.0.28 + + '@nolyfill/object.entries@1.0.28': + dependencies: + '@nolyfill/shared': 1.0.28 + + '@nolyfill/object.fromentries@1.0.28': + dependencies: + '@nolyfill/shared': 1.0.28 + + '@nolyfill/object.values@1.0.28': + dependencies: + '@nolyfill/shared': 1.0.28 + + '@nolyfill/shared@1.0.21': {} + + '@nolyfill/shared@1.0.24': {} + + '@nolyfill/shared@1.0.28': {} + + '@nolyfill/string.prototype.matchall@1.0.28': + dependencies: + '@nolyfill/shared': 1.0.28 + + '@nolyfill/string.prototype.repeat@1.0.28': + dependencies: + '@nolyfill/shared': 1.0.28 + '@puppeteer/browsers@2.3.0': dependencies: debug: 4.3.6 @@ -2744,7 +2915,7 @@ snapshots: '@sapphi-red/web-noise-suppressor@0.3.5': {} - '@stylistic/eslint-plugin-js@2.6.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))': + '@stylistic/eslint-plugin-js@2.6.1(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))': dependencies: '@types/eslint': 9.6.0 acorn: 8.12.1 @@ -2752,15 +2923,15 @@ snapshots: eslint-visitor-keys: 4.0.0 espree: 10.1.0 - '@stylistic/eslint-plugin-jsx@2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))': + '@stylistic/eslint-plugin-jsx@2.6.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))': dependencies: - '@stylistic/eslint-plugin-js': 2.6.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) + '@stylistic/eslint-plugin-js': 2.6.1(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) '@types/eslint': 9.6.0 eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi) estraverse: 5.3.0 picomatch: 4.0.2 - '@stylistic/eslint-plugin-plus@2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)': + '@stylistic/eslint-plugin-plus@2.6.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)': dependencies: '@types/eslint': 9.6.0 '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) @@ -2769,9 +2940,9 @@ snapshots: - supports-color - typescript - '@stylistic/eslint-plugin-ts@2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)': + '@stylistic/eslint-plugin-ts@2.6.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)': dependencies: - '@stylistic/eslint-plugin-js': 2.6.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) + '@stylistic/eslint-plugin-js': 2.6.1(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) '@types/eslint': 9.6.0 '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi) @@ -2779,12 +2950,12 @@ snapshots: - supports-color - typescript - '@stylistic/eslint-plugin@2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)': + '@stylistic/eslint-plugin@2.6.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)': dependencies: - '@stylistic/eslint-plugin-js': 2.6.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) - '@stylistic/eslint-plugin-jsx': 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) - '@stylistic/eslint-plugin-plus': 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) - '@stylistic/eslint-plugin-ts': 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) + '@stylistic/eslint-plugin-js': 2.6.1(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) + '@stylistic/eslint-plugin-jsx': 2.6.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)) + '@stylistic/eslint-plugin-plus': 2.6.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) + '@stylistic/eslint-plugin-ts': 2.6.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4) '@types/eslint': 9.6.0 eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi) transitivePeerDependencies: @@ -3323,6 +3494,10 @@ snapshots: '@types/react': 17.0.2 moment: 2.29.4 + doctrine@2.1.0: + dependencies: + esutils: 2.0.3 + doctrine@3.0.0: dependencies: esutils: 2.0.3 @@ -3418,7 +3593,7 @@ snapshots: eslint-import-resolver-node@0.3.9: dependencies: debug: 3.2.7 - is-core-module: 2.14.0 + is-core-module: '@nolyfill/is-core-module@1.0.39' resolve: 1.22.8 transitivePeerDependencies: - supports-color @@ -3455,6 +3630,28 @@ snapshots: transitivePeerDependencies: - supports-color + eslint-plugin-react@7.35.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)): + dependencies: + array-includes: '@nolyfill/array-includes@1.0.28' + array.prototype.findlast: '@nolyfill/array.prototype.findlast@1.0.24' + array.prototype.flatmap: '@nolyfill/array.prototype.flatmap@1.0.28' + array.prototype.tosorted: '@nolyfill/array.prototype.tosorted@1.0.24' + doctrine: 2.1.0 + es-iterator-helpers: '@nolyfill/es-iterator-helpers@1.0.21' + eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi) + estraverse: 5.3.0 + hasown: '@nolyfill/hasown@1.0.29' + jsx-ast-utils: 3.3.5 + minimatch: 3.1.2 + object.entries: '@nolyfill/object.entries@1.0.28' + object.fromentries: '@nolyfill/object.fromentries@1.0.28' + object.values: '@nolyfill/object.values@1.0.28' + prop-types: 15.8.1 + resolve: 2.0.0-next.5 + semver: 6.3.1 + string.prototype.matchall: '@nolyfill/string.prototype.matchall@1.0.28' + string.prototype.repeat: '@nolyfill/string.prototype.repeat@1.0.28' + eslint-plugin-simple-header@1.1.1: {} eslint-plugin-simple-import-sort@12.1.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)): @@ -3668,8 +3865,6 @@ snapshots: fsevents@2.3.3: optional: true - function-bind@1.1.2: {} - get-caller-file@2.0.5: {} get-stream@5.2.0: @@ -3767,10 +3962,6 @@ snapshots: is-number: 3.0.0 kind-of: 4.0.0 - hasown@2.0.2: - dependencies: - function-bind: 1.1.2 - highlight.js@11.8.0: {} homedir-polyfill@1.0.3: @@ -3841,10 +4032,6 @@ snapshots: dependencies: builtin-modules: 3.3.0 - is-core-module@2.14.0: - dependencies: - hasown: 2.0.2 - is-data-descriptor@0.1.4: dependencies: kind-of: 3.2.2 @@ -3895,13 +4082,11 @@ snapshots: is-windows@1.0.2: {} - isarray@1.0.0: {} - isexe@2.0.0: {} isobject@2.1.0: dependencies: - isarray: 1.0.0 + isarray: '@nolyfill/isarray@1.0.29' isobject@3.0.1: {} @@ -3935,6 +4120,13 @@ snapshots: optionalDependencies: graceful-fs: 4.2.11 + jsx-ast-utils@3.3.5: + dependencies: + array-includes: '@nolyfill/array-includes@1.0.28' + array.prototype.flat: '@nolyfill/array.prototype.flat@1.0.28' + object.assign: '@nolyfill/object.assign@1.0.28' + object.values: '@nolyfill/object.values@1.0.28' + jszip@2.7.0: dependencies: pako: 1.0.11 @@ -3976,6 +4168,10 @@ snapshots: lodash.truncate@4.4.2: {} + loose-envify@1.4.0: + dependencies: + js-tokens: 4.0.0 + lower-case@2.0.2: dependencies: tslib: 2.6.2 @@ -4072,6 +4268,8 @@ snapshots: normalize-path@3.0.0: {} + object-assign@4.1.1: {} + object-copy@0.1.0: dependencies: copy-descriptor: 0.1.1 @@ -4203,6 +4401,12 @@ snapshots: progress@2.0.3: {} + prop-types@15.8.1: + dependencies: + loose-envify: 1.4.0 + object-assign: 4.1.1 + react-is: 16.13.1 + proxy-agent@6.4.0: dependencies: agent-base: 7.1.1 @@ -4243,6 +4447,8 @@ snapshots: queue-tick@1.0.1: {} + react-is@16.13.1: {} + read-pkg-up@7.0.1: dependencies: find-up: 4.1.0 @@ -4288,7 +4494,13 @@ snapshots: resolve@1.22.8: dependencies: - is-core-module: 2.14.0 + is-core-module: '@nolyfill/is-core-module@1.0.39' + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + + resolve@2.0.0-next.5: + dependencies: + is-core-module: '@nolyfill/is-core-module@1.0.39' path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 @@ -4306,6 +4518,8 @@ snapshots: semver@5.7.1: {} + semver@6.3.1: {} + semver@7.6.3: {} set-value@2.0.1: @@ -4583,7 +4797,7 @@ snapshots: tslib@2.6.2: {} - tsx@4.16.3: + tsx@4.16.5: dependencies: esbuild: 0.21.5 get-tsconfig: 4.7.5 diff --git a/src/api/ChatButtons.tsx b/src/api/ChatButtons.tsx index 8af6f3aa8..d1bc759cb 100644 --- a/src/api/ChatButtons.tsx +++ b/src/api/ChatButtons.tsx @@ -11,7 +11,7 @@ import { Logger } from "@utils/Logger"; import type { ChannelRecord } from "@vencord/discord-types"; import { waitFor } from "@webpack"; import { Button, ButtonLooks, ButtonWrapperClasses, Tooltip } from "@webpack/common"; -import type { HTMLProps, JSX, MouseEventHandler, ReactNode } from "react"; +import type { ComponentType, HTMLProps, MouseEventHandler, ReactNode } from "react"; let ChannelTextAreaClasses: Record<"button" | "buttonContainer", string> | undefined; waitFor(["buttonContainer", "channelTextArea"], m => { ChannelTextAreaClasses = m; }); @@ -74,7 +74,7 @@ export interface ChatBarProps { }; } -export type ChatBarButton = (props: ChatBarProps & { isMainChat: boolean; }) => JSX.Element | null; +export type ChatBarButton = ComponentType; const buttonFactories = new Map(); const logger = new Logger("ChatButtons"); diff --git a/src/api/MemberListDecorators.ts b/src/api/MemberListDecorators.ts index 4c0b65548..0159b7f28 100644 --- a/src/api/MemberListDecorators.ts +++ b/src/api/MemberListDecorators.ts @@ -17,7 +17,7 @@ */ import type { ChannelRecord, UserRecord } from "@vencord/discord-types"; -import type { JSX } from "react"; +import type { FunctionComponent } from "react"; interface DecoratorProps { activities: any[]; @@ -39,7 +39,7 @@ interface DecoratorProps { user: UserRecord; [key: string]: any; } -export type Decorator = (props: DecoratorProps) => JSX.Element | null; +export type Decorator = FunctionComponent; type OnlyIn = "guilds" | "dms"; export const decorators = new Map(); diff --git a/src/api/MessageAccessories.ts b/src/api/MessageAccessories.ts index 9533700c7..32c5eab20 100644 --- a/src/api/MessageAccessories.ts +++ b/src/api/MessageAccessories.ts @@ -16,9 +16,9 @@ * along with this program. If not, see . */ -import type { JSX } from "react"; +import type { ReactNode } from "react"; -export type AccessoryCallback = (props: Record) => (JSX.Element | null)[] | JSX.Element | null; +export type AccessoryCallback = (props: Record) => ReactNode; export type Accessory = { callback: AccessoryCallback; position?: number; @@ -42,17 +42,13 @@ export function removeAccessory(identifier: string) { } export function _modifyAccessories( - elements: JSX.Element[], + elements: ReactNode[], props: Record ) { for (const accessory of accessories.values()) { - let accessories = accessory.callback(props); - if (accessories == null) - continue; - - if (!Array.isArray(accessories)) - accessories = [accessories]; - else if (accessories.length === 0) + const accessories = accessory.callback(props); + // Exclude accessories that won't be rendered + if (accessories == null || typeof accessories === "boolean") continue; elements.splice( @@ -62,9 +58,23 @@ export function _modifyAccessories( : accessory.position : elements.length, 0, - ...accessories.filter(e => e != null) + // Don't iterate over strings + ...typeof accessories === "object" && Symbol.iterator in accessories + // Exclude accessories that won't be rendered + ? filterIterable(accessories, a => a != null && typeof a !== "boolean") + : [accessories] ); } return elements; } + +type Values> = T extends Iterable ? U : never; + +function filterIterable, S extends Values>(iterable: T, predicate: (value: Values) => value is S): T & Iterable; +function filterIterable>(iterable: T, predicate: (value: Values) => unknown): T; +function* filterIterable(iterable: Iterable, predicate: (value: T) => unknown) { + for (const value of iterable) + if (predicate(value)) + yield value; +} diff --git a/src/api/MessageDecorations.ts b/src/api/MessageDecorations.ts index 17dc19d91..3cb89a059 100644 --- a/src/api/MessageDecorations.ts +++ b/src/api/MessageDecorations.ts @@ -17,7 +17,7 @@ */ import type { ChannelRecord, MessageRecord } from "@vencord/discord-types"; -import type { JSX } from "react"; +import type { FunctionComponent, ReactNode } from "react"; interface DecorationProps { author: { @@ -36,16 +36,16 @@ interface DecorationProps { /** * Element for the [BOT] tag if there is one */ - 0: JSX.Element | null; + 0: ReactNode; /** * Other decorations (including ones added with this api) */ - 1: JSX.Element[]; + 1: ReactNode[]; }; message: MessageRecord; [key: string]: any; } -export type Decoration = (props: DecorationProps) => JSX.Element | null; +export type Decoration = FunctionComponent; export const decorations = new Map(); diff --git a/src/api/ServerList.ts b/src/api/ServerList.ts index 80b83af52..62c7de2b2 100644 --- a/src/api/ServerList.ts +++ b/src/api/ServerList.ts @@ -17,7 +17,7 @@ */ import { Logger } from "@utils/Logger"; -import type { JSX } from "react"; +import type { ReactNode } from "react"; const logger = new Logger("ServerListAPI"); @@ -26,23 +26,23 @@ export const enum ServerListRenderPosition { In, } -const renderFunctionsAbove = new Set<(...args: unknown[]) => any>(); -const renderFunctionsIn = new Set<(...args: unknown[]) => any>(); +const renderFunctionsAbove = new Set<(...args: any[]) => ReactNode>(); +const renderFunctionsIn = new Set<(...args: any[]) => ReactNode>(); function getRenderFunctions(position: ServerListRenderPosition) { return position === ServerListRenderPosition.Above ? renderFunctionsAbove : renderFunctionsIn; } -export function addServerListElement(position: ServerListRenderPosition, renderFunction: (...args: unknown[]) => any) { +export function addServerListElement(position: ServerListRenderPosition, renderFunction: (...args: any[]) => ReactNode) { getRenderFunctions(position).add(renderFunction); } -export function removeServerListElement(position: ServerListRenderPosition, renderFunction: (...args: unknown[]) => any) { +export function removeServerListElement(position: ServerListRenderPosition, renderFunction: (...args: any[]) => ReactNode) { getRenderFunctions(position).delete(renderFunction); } export const renderAll = (position: ServerListRenderPosition) => { - const ret: JSX.Element[] = []; + const ret: ReactNode[] = []; for (const renderFunction of getRenderFunctions(position)) { try { diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index 9718ccd09..5c4e2b091 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -35,7 +35,7 @@ import { useAwaiter } from "@utils/react"; import type { Plugin } from "@utils/types"; import { findByPropsLazy } from "@webpack"; import { AlertActionCreators, Button, Card, Forms, lodash, MarkupUtils, Select, Text, TextInput, Toasts, Tooltip, useEffect, useMemo, useState } from "@webpack/common"; -import type { HTMLProps, JSX } from "react"; +import type { HTMLProps, ReactElement } from "react"; import Plugins, { ExcludedPlugins } from "~plugins"; @@ -287,8 +287,8 @@ export default function PluginSettings() { return lodash.isEqual(newPlugins, sortedPluginNames) ? [] : newPlugins; })); - const plugins: JSX.Element[] = []; - const requiredPlugins: JSX.Element[] = []; + const plugins: ReactElement[] = []; + const requiredPlugins: ReactElement[] = []; const showApi = searchValue.value.includes("API"); for (const p of sortedPlugins) { diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index 792a6a2f4..cce91565f 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -34,7 +34,7 @@ import { makeCodeblock } from "@utils/text"; import definePlugin from "@utils/types"; import { checkForUpdates, isOutdated, update } from "@utils/updater"; import { AlertActionCreators, Button, Card, ChannelStore, Forms, GuildMemberStore, MarkupUtils, RelationshipStore, showToast, Text, Toasts, UserStore } from "@webpack/common"; -import type { JSX } from "react"; +import type { ReactElement } from "react"; import gitHash from "~git-hash"; import plugins, { PluginMeta } from "~plugins"; @@ -260,7 +260,7 @@ export default definePlugin({ start() { addAccessory("vencord-debug", props => { - const buttons: JSX.Element[] = []; + const buttons: ReactElement[] = []; const shouldAddUpdateButton = !IS_UPDATER_DISABLED diff --git a/src/plugins/appleMusic.desktop/index.tsx b/src/plugins/appleMusic.desktop/index.tsx index 903517895..31325be78 100644 --- a/src/plugins/appleMusic.desktop/index.tsx +++ b/src/plugins/appleMusic.desktop/index.tsx @@ -148,12 +148,10 @@ export default definePlugin({ reporterTestable: ReporterTestable.None, settingsAboutComponent: () => ( - <> - - For the customizable activity format strings, you can use several special strings to include track data in activities!{" "} - {"{name}"} is replaced with the track name; {"{artist}"} is replaced with the artist(s)' name(s); and {"{album}"} is replaced with the album name. - - + + For the customizable activity format strings, you can use several special strings to include track data in activities!{" "} + {"{name}"} is replaced with the track name; {"{artist}"} is replaced with the artist(s)' name(s); and {"{album}"} is replaced with the album name. + ), settings, diff --git a/src/plugins/decor/lib/stores/UsersDecorationsStore.ts b/src/plugins/decor/lib/stores/UsersDecorationsStore.ts index 18f378635..30b0f6cc1 100644 --- a/src/plugins/decor/lib/stores/UsersDecorationsStore.ts +++ b/src/plugins/decor/lib/stores/UsersDecorationsStore.ts @@ -20,7 +20,7 @@ interface UserDecorationData { interface UsersDecorationsState { usersDecorations: Map; fetchQueue: Set; - bulkFetch: () => Promise; + bulkFetch: () => void; fetch: (userId: string, force?: boolean) => void; fetchMany: (userIds: string[]) => void; get: (userId: string) => UserDecorationData | undefined; diff --git a/src/plugins/decor/ui/components/Grid.tsx b/src/plugins/decor/ui/components/Grid.tsx index c2e43d5c9..4e3e5b130 100644 --- a/src/plugins/decor/ui/components/Grid.tsx +++ b/src/plugins/decor/ui/components/Grid.tsx @@ -5,12 +5,12 @@ */ import { React } from "@webpack/common"; -import type { JSX } from "react"; +import type { ReactElement } from "react"; import { cl } from "../"; export interface GridProps { - renderItem: (item: ItemT) => JSX.Element; + renderItem: (item: ItemT) => ReactElement; getItemKey: (item: ItemT) => string; itemKeyPrefix?: string; items: ItemT[]; diff --git a/src/plugins/decor/ui/components/SectionedGridList.tsx b/src/plugins/decor/ui/components/SectionedGridList.tsx index d13dff068..f065c646b 100644 --- a/src/plugins/decor/ui/components/SectionedGridList.tsx +++ b/src/plugins/decor/ui/components/SectionedGridList.tsx @@ -6,7 +6,7 @@ import { classes } from "@utils/misc"; import { findByPropsLazy } from "@webpack"; -import type { JSX } from "react"; +import type { ReactElement } from "react"; import { cl } from "../"; import Grid, { type GridProps } from "./Grid"; @@ -18,7 +18,7 @@ type Section = SectionT & { }; interface SectionedGridListProps> extends Omit, "items"> { - renderSectionHeader: (section: SectionU) => JSX.Element; + renderSectionHeader: (section: SectionU) => ReactElement; getSectionKey: (section: SectionU) => string; sections: SectionU[]; } diff --git a/src/plugins/devCompanion.dev/index.tsx b/src/plugins/devCompanion.dev/index.tsx index 6ee20b381..bfcd88842 100644 --- a/src/plugins/devCompanion.dev/index.tsx +++ b/src/plugins/devCompanion.dev/index.tsx @@ -176,9 +176,9 @@ function initWs(isManual = false) { try { const matcher = canonicalizeMatch(parseNode(match)); - const replacement = canonicalizeReplace(parseNode(replace), "PlaceHolderPluginName"); + const replacement = canonicalizeReplace(parseNode(replace), "PlaceHolderPluginName"); - const newSource = src.replace(matcher, replacement as string); + const newSource = src.replace(matcher, replacement); if (src === newSource) throw "Had no effect"; Function(newSource); @@ -195,7 +195,7 @@ function initWs(isManual = false) { } case "testFind": { const { type, args } = data as FindData; - let parsedArgs: any; + let parsedArgs: any[]; try { parsedArgs = args.map(parseNode); } catch (err) { diff --git a/src/plugins/messageLatency/index.tsx b/src/plugins/messageLatency/index.tsx index 96403b11c..aee062883 100644 --- a/src/plugins/messageLatency/index.tsx +++ b/src/plugins/messageLatency/index.tsx @@ -76,7 +76,7 @@ export default definePlugin({ const s = str(k); return prev + ( - s !== null + s != null ? (prev !== "" ? (showMillis ? k === "milliseconds" : k === "seconds") ? " and " diff --git a/src/plugins/messageLinkEmbeds/index.tsx b/src/plugins/messageLinkEmbeds/index.tsx index 25c9a5c7a..3f73f8e53 100644 --- a/src/plugins/messageLinkEmbeds/index.tsx +++ b/src/plugins/messageLinkEmbeds/index.tsx @@ -41,7 +41,7 @@ import { Text, UserStore } from "@webpack/common"; -import type { JSX } from "react"; +import type { ReactElement } from "react"; const messageCache = new Map["get"] & {}>); } }); } @@ -230,7 +230,7 @@ function withEmbeddedBy(message: MessageRecord, embeddedBy: string[]) { function MessageEmbedAccessory({ message }: { message: MessageRecord & { vencordEmbeddedBy?: string[]; }; }) { const embeddedBy: string[] = message.vencordEmbeddedBy ?? []; - const accessories: (JSX.Element | null)[] = []; + const accessories: ReactElement[] = []; for (const [_, channelId, messageId] of message.content.matchAll(messageLinkRegex)) { if (embeddedBy.includes(messageId!) || embeddedBy.length > 2) { @@ -276,7 +276,7 @@ function MessageEmbedAccessory({ message }: { message: MessageRecord & { vencord ); } - return accessories.length ? <>{accessories} : null; + return accessories; } function getChannelLabelAndIconUrl(channel: ChannelRecord) { diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index 7af9fae06..2067359d6 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -176,22 +176,18 @@ export default definePlugin({ (oldMsg, newMsg) => oldMsg?.editHistory === newMsg?.editHistory )!; - return Settings.plugins.MessageLogger!.inlineEdits && ( - <> - {message.editHistory?.map(edit => ( -
- {parseEditContent(edit.content, message)} - - {" "}({i18n.Messages.MESSAGE_EDITED}) - -
- ))} - - ); + return Settings.plugins.MessageLogger!.inlineEdits && message.editHistory?.map(edit => ( +
+ {parseEditContent(edit.content, message)} + + {" "}({i18n.Messages.MESSAGE_EDITED}) + +
+ )); }, { noop: true }), makeEdit: (newMessage: MessageJSON, oldMessage: MessageJSON) => ({ diff --git a/src/plugins/shikiCodeblocks.desktop/components/ButtonRow.tsx b/src/plugins/shikiCodeblocks.desktop/components/ButtonRow.tsx index 4dfe63aa4..ec1faaf93 100644 --- a/src/plugins/shikiCodeblocks.desktop/components/ButtonRow.tsx +++ b/src/plugins/shikiCodeblocks.desktop/components/ButtonRow.tsx @@ -17,7 +17,7 @@ */ import { ClipboardUtils } from "@webpack/common"; -import type { JSX } from "react"; +import type { ReactElement } from "react"; import { cl } from "../utils/misc"; import { CopyButton } from "./CopyButton"; @@ -28,7 +28,7 @@ export interface ButtonRowProps { } export function ButtonRow({ content, theme }: ButtonRowProps) { - const buttons: JSX.Element[] = []; + const buttons: ReactElement[] = []; if (ClipboardUtils.SUPPORTS_COPY) { buttons.push( diff --git a/src/plugins/shikiCodeblocks.desktop/components/Code.tsx b/src/plugins/shikiCodeblocks.desktop/components/Code.tsx index b4a4fb359..909687dfe 100644 --- a/src/plugins/shikiCodeblocks.desktop/components/Code.tsx +++ b/src/plugins/shikiCodeblocks.desktop/components/Code.tsx @@ -18,7 +18,7 @@ import type { IThemedToken } from "@vap/shiki"; import { hljs } from "@webpack/common"; -import type { JSX } from "react"; +import type { ReactElement } from "react"; import { cl } from "../utils/misc"; import type { ThemeBase } from "./Highlighter"; @@ -38,7 +38,7 @@ export function Code({ content, tokens, }: CodeProps) { - let lines: JSX.Element[]; + let lines: ReactElement[]; if (useHljs) { try { diff --git a/src/plugins/translate/TranslateIcon.tsx b/src/plugins/translate/TranslateIcon.tsx index 8005b3fbe..ff482c79f 100644 --- a/src/plugins/translate/TranslateIcon.tsx +++ b/src/plugins/translate/TranslateIcon.tsx @@ -45,7 +45,7 @@ export const TranslateChatBarIcon: ChatBarButton = ({ isMainChat }) => { const [showTooltip, $setShowTooltip] = useState(false); useEffect(() => { setShowTooltip = $setShowTooltip; - return () => setShowTooltip = undefined; + return () => { setShowTooltip = undefined; }; }, []); if (!isMainChat || !showChatBarButton) return null; diff --git a/src/plugins/validUser/index.tsx b/src/plugins/validUser/index.tsx index 8575e1cc7..946a26d26 100644 --- a/src/plugins/validUser/index.tsx +++ b/src/plugins/validUser/index.tsx @@ -124,8 +124,7 @@ function MentionWrapper({ data, UserMention, RoleMention, parse, props }: Mentio > { - // @ts-expect-error - const mention = children?.[0]?.props?.children; + const mention = (children as any)?.[0]?.props?.children; if (typeof mention !== "string") return; const id = mention.match(/<@!?(\d+)>/)?.[1]; diff --git a/src/plugins/vencordToolbox/index.tsx b/src/plugins/vencordToolbox/index.tsx index 4753b0082..c22bd8e0a 100644 --- a/src/plugins/vencordToolbox/index.tsx +++ b/src/plugins/vencordToolbox/index.tsx @@ -134,7 +134,7 @@ function ToolboxFragmentWrapper({ children }: { children: ReactNode[]; }) { ); - return <>{children}; + return children; } export default definePlugin({ diff --git a/src/shared/debounce.ts b/src/shared/debounce.ts index 788b01263..63f923d58 100644 --- a/src/shared/debounce.ts +++ b/src/shared/debounce.ts @@ -23,11 +23,11 @@ * @param func The function to wrap * @param delay The delay in milliseconds */ -export function debounce unknown>(func: T, delay = 300): T { +export function debounce unknown>(func: T, delay = 300) { // is number when this runs in the render process let timeout: NodeJS.Timeout; - return function (...args: any[]) { + return function (...args: Parameters) { clearTimeout(timeout); timeout = setTimeout(() => { func(...args); }, delay); - } as any; + }; } diff --git a/src/utils/types.ts b/src/utils/types.ts index 184b86387..5a4c69a93 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -19,7 +19,7 @@ import type { Command } from "@api/Commands"; import type { NavContextMenuPatchCallback } from "@api/ContextMenu"; import type { FluxActionHandlerMap } from "@vencord/discord-types"; -import type { ComponentType, JSX } from "react"; +import type { ComponentType, FunctionComponent } from "react"; import type Electron from "standalone-electron-types"; import type { Promisable } from "type-fest"; @@ -284,7 +284,7 @@ export interface IPluginOptionComponentProps { export interface PluginSettingComponentDef { type: OptionType.COMPONENT; - component: (props: IPluginOptionComponentProps) => JSX.Element; + component: FunctionComponent; } /** Maps a `PluginSettingDef` to its value type */ diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index 2add7d5fe..25d92bf56 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -51,8 +51,7 @@ Object.defineProperty(window, WEBPACK_CHUNK, { logger.info(`Patching ${WEBPACK_CHUNK}.push`); patchPush(v); - // @ts-expect-error - delete window[WEBPACK_CHUNK]; + delete (window as any)[WEBPACK_CHUNK]; window[WEBPACK_CHUNK] = v; } }