From 83f30379920d8dc0edb5c364d63adfc445d1c0fe Mon Sep 17 00:00:00 2001 From: ghostflyby Date: Wed, 13 Mar 2024 19:06:41 +0800 Subject: [PATCH] Chore: change eslint rule --- .eslintrc.json | 31 ++++--- package.json | 3 +- pnpm-lock.yaml | 228 ++++++------------------------------------------ src/preload.ts | 18 ++-- src/renderer.ts | 2 +- 5 files changed, 59 insertions(+), 223 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e9fdf49..f29cb09 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,22 +3,31 @@ "browser": true, "es2021": true }, - "plugins": [ - "@stylistic" - ], "extends": [ - "standard-with-typescript", - "plugin:@stylistic/disable-legacy" + "standard-with-typescript" ], "parserOptions": { "ecmaVersion": "latest" }, - "rules": { - "@stylistic/comma-dangle": [ - "error", - "always-multiline" - ] - }, + "overrides": [ + { + "files": [ + "*.ts", + "*.js" + ], + "rules": { + "comma-dangle": [ + "error", + "always-multiline" + ], + "@typescript-eslint/comma-dangle": [ + "error", + "always-multiline" + ] + } + } + ], + "rules": {}, "ignorePatterns": [ "build.mjs" ] diff --git a/package.json b/package.json index e4b9794..ccf3797 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,7 @@ "author": "ghostflyby", "license": "GPL-3.0-only", "devDependencies": { - "@stylistic/eslint-plugin": "^1.6.3", - "@typescript-eslint/eslint-plugin": "^7.2.0", + "@typescript-eslint/eslint-plugin": "^6.8.0", "esbuild": "^0.20.1", "eslint": "^8.0.1", "eslint-config-standard-with-typescript": "^43.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c7ab4b5..364a714 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,12 +10,9 @@ dependencies: version: 29.0.1 devDependencies: - '@stylistic/eslint-plugin': - specifier: ^1.6.3 - version: 1.6.3(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/eslint-plugin': - specifier: ^7.2.0 - version: 7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.56.0)(typescript@5.3.3) + specifier: ^6.8.0 + version: 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.3.3) esbuild: specifier: ^0.20.1 version: 0.20.1 @@ -24,10 +21,10 @@ devDependencies: version: 8.56.0 eslint-config-standard-with-typescript: specifier: ^43.0.1 - version: 43.0.1(@typescript-eslint/eslint-plugin@7.2.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.56.0)(typescript@5.3.3) + version: 43.0.1(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.56.0)(typescript@5.3.3) eslint-plugin-import: specifier: ^2.25.2 - version: 2.29.1(@typescript-eslint/parser@7.2.0)(eslint@8.56.0) + version: 2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.56.0) eslint-plugin-n: specifier: '^15.0.0 || ^16.0.0 ' version: 16.6.2(eslint@8.56.0) @@ -355,78 +352,6 @@ packages: engines: {node: '>=10'} dev: false - /@stylistic/eslint-plugin-js@1.6.3(eslint@8.56.0): - resolution: {integrity: sha512-ckdz51oHxD2FaxgY2piJWJVJiwgp8Uu96s+as2yB3RMwavn3nHBrpliVukXY9S/DmMicPRB2+H8nBk23GDG+qA==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: '>=8.40.0' - dependencies: - '@types/eslint': 8.56.5 - acorn: 8.11.3 - escape-string-regexp: 4.0.0 - eslint: 8.56.0 - eslint-visitor-keys: 3.4.3 - espree: 9.6.1 - dev: true - - /@stylistic/eslint-plugin-jsx@1.6.3(eslint@8.56.0): - resolution: {integrity: sha512-SRysCIg59Zvn3dJPqHziiHwuni4NNj1et5stAmivmyQ3Cdp2ULCB7tGxCF1OxpkwRlZQue3ZgdiM7EXfJKaf9w==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: '>=8.40.0' - dependencies: - '@stylistic/eslint-plugin-js': 1.6.3(eslint@8.56.0) - '@types/eslint': 8.56.5 - eslint: 8.56.0 - estraverse: 5.3.0 - picomatch: 4.0.1 - dev: true - - /@stylistic/eslint-plugin-plus@1.6.3(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-TuwQOdyVGycDPw5XeF7W4f3ZonAVzOAzORSaD2yGAJ0fRAbJ+l/v3CkKzIAqBBwWkc+c2aRMsWtLP2+viBnmlQ==} - peerDependencies: - eslint: '*' - dependencies: - '@types/eslint': 8.56.5 - '@typescript-eslint/utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) - eslint: 8.56.0 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - - /@stylistic/eslint-plugin-ts@1.6.3(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-v5GwZsPLblWM9uAIdaSi31Sed3XBWlTFQJ3b5upEmj6QsKYivA5nmIYutwqqL133QdVWjmC86pINlx2Muq3uNQ==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: '>=8.40.0' - dependencies: - '@stylistic/eslint-plugin-js': 1.6.3(eslint@8.56.0) - '@types/eslint': 8.56.5 - '@typescript-eslint/utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) - eslint: 8.56.0 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - - /@stylistic/eslint-plugin@1.6.3(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-WDa4FjhImp7YcztRaMG09svhKYYhi2Hc4p9ltQRSqyB4fsUUFm+GKzStqqH7xfjHnxacMJaOnaMGRTUqIIZDLA==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: '>=8.40.0' - dependencies: - '@stylistic/eslint-plugin-js': 1.6.3(eslint@8.56.0) - '@stylistic/eslint-plugin-jsx': 1.6.3(eslint@8.56.0) - '@stylistic/eslint-plugin-plus': 1.6.3(eslint@8.56.0)(typescript@5.3.3) - '@stylistic/eslint-plugin-ts': 1.6.3(eslint@8.56.0)(typescript@5.3.3) - '@types/eslint': 8.56.5 - eslint: 8.56.0 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - /@szmarczak/http-timer@4.0.6: resolution: {integrity: sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==} engines: {node: '>=10'} @@ -443,17 +368,6 @@ packages: '@types/responselike': 1.0.3 dev: false - /@types/eslint@8.56.5: - resolution: {integrity: sha512-u5/YPJHo1tvkSF2CE0USEkxon82Z5DBy2xR+qfyYNszpX9qcs4sT6uq2kBbj4BXY1+DBGDPnrhMZV3pKWGNukw==} - dependencies: - '@types/estree': 1.0.5 - '@types/json-schema': 7.0.15 - dev: true - - /@types/estree@1.0.5: - resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} - dev: true - /@types/http-cache-semantics@4.0.4: resolution: {integrity: sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==} dev: false @@ -496,23 +410,23 @@ packages: dev: false optional: true - /@typescript-eslint/eslint-plugin@7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-mdekAHOqS9UjlmyF/LSs6AIEvfceV749GFxoBAjwAv0nkevfKHWQFDMcBZWUiIC5ft6ePWivXoS36aKQ0Cy3sw==} + /@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - '@typescript-eslint/parser': ^7.0.0 - eslint: ^8.56.0 + '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.2.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/scope-manager': 7.2.0 - '@typescript-eslint/type-utils': 7.2.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/utils': 7.2.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/visitor-keys': 7.2.0 + '@typescript-eslint/parser': 6.21.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/scope-manager': 6.21.0 + '@typescript-eslint/type-utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/visitor-keys': 6.21.0 debug: 4.3.4 eslint: 8.56.0 graphemer: 1.4.0 @@ -546,27 +460,6 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@7.2.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-5FKsVcHTk6TafQKQbuIVkXq58Fnbkd2wDL4LB7AURN7RUOu1utVP+G8+6u3ZhEroW3DF6hyo3ZEXxgKgp4KeCg==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/scope-manager': 7.2.0 - '@typescript-eslint/types': 7.2.0 - '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.3.3) - '@typescript-eslint/visitor-keys': 7.2.0 - debug: 4.3.4 - eslint: 8.56.0 - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/scope-manager@6.21.0: resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==} engines: {node: ^16.0.0 || >=18.0.0} @@ -575,26 +468,18 @@ packages: '@typescript-eslint/visitor-keys': 6.21.0 dev: true - /@typescript-eslint/scope-manager@7.2.0: - resolution: {integrity: sha512-Qh976RbQM/fYtjx9hs4XkayYujB/aPwglw2choHmf3zBjB4qOywWSdt9+KLRdHubGcoSwBnXUH2sR3hkyaERRg==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 7.2.0 - '@typescript-eslint/visitor-keys': 7.2.0 - dev: true - - /@typescript-eslint/type-utils@7.2.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-xHi51adBHo9O9330J8GQYQwrKBqbIPJGZZVQTHHmy200hvkLZFWJIFtAG/7IYTWUyun6DE6w5InDReePJYJlJA==} + /@typescript-eslint/type-utils@6.21.0(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - eslint: ^8.56.0 + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.3.3) - '@typescript-eslint/utils': 7.2.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.3.3) + '@typescript-eslint/utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) debug: 4.3.4 eslint: 8.56.0 ts-api-utils: 1.2.1(typescript@5.3.3) @@ -608,11 +493,6 @@ packages: engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/types@7.2.0: - resolution: {integrity: sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA==} - engines: {node: ^16.0.0 || >=18.0.0} - dev: true - /@typescript-eslint/typescript-estree@6.21.0(typescript@5.3.3): resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -635,28 +515,6 @@ packages: - supports-color dev: true - /@typescript-eslint/typescript-estree@7.2.0(typescript@5.3.3): - resolution: {integrity: sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 7.2.0 - '@typescript-eslint/visitor-keys': 7.2.0 - debug: 4.3.4 - globby: 11.1.0 - is-glob: 4.0.3 - minimatch: 9.0.3 - semver: 7.5.4 - ts-api-utils: 1.2.1(typescript@5.3.3) - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/utils@6.21.0(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -676,25 +534,6 @@ packages: - typescript dev: true - /@typescript-eslint/utils@7.2.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-YfHpnMAGb1Eekpm3XRK8hcMwGLGsnT6L+7b2XyRv6ouDuJU1tZir1GS2i0+VXRatMwSI1/UfcyPe53ADkU+IuA==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^8.56.0 - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) - '@types/json-schema': 7.0.15 - '@types/semver': 7.5.7 - '@typescript-eslint/scope-manager': 7.2.0 - '@typescript-eslint/types': 7.2.0 - '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.3.3) - eslint: 8.56.0 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - /@typescript-eslint/visitor-keys@6.21.0: resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} engines: {node: ^16.0.0 || >=18.0.0} @@ -703,14 +542,6 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@typescript-eslint/visitor-keys@7.2.0: - resolution: {integrity: sha512-c6EIQRHhcpl6+tO8EMR+kjkkV+ugUNXOmeASA1rlzkd8EPIriavpWoiEz1HR/VLhbVIdhqnV6E7JZm00cBDx2A==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 7.2.0 - eslint-visitor-keys: 3.4.3 - dev: true - /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true @@ -1212,7 +1043,7 @@ packages: eslint: 8.56.0 dev: true - /eslint-config-standard-with-typescript@43.0.1(@typescript-eslint/eslint-plugin@7.2.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.56.0)(typescript@5.3.3): + /eslint-config-standard-with-typescript@43.0.1(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-WfZ986+qzIzX6dcr4yGUyVb/l9N3Z8wPXCc5z/70fljs3UbWhhV+WxrfgsqMToRzuuyX9MqZ974pq2UPhDTOcA==} peerDependencies: '@typescript-eslint/eslint-plugin': ^6.4.0 @@ -1222,11 +1053,11 @@ packages: eslint-plugin-promise: ^6.0.0 typescript: '*' dependencies: - '@typescript-eslint/eslint-plugin': 7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/parser': 6.21.0(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 eslint-config-standard: 17.1.0(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.56.0) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0)(eslint@8.56.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.56.0) eslint-plugin-n: 16.6.2(eslint@8.56.0) eslint-plugin-promise: 6.1.1(eslint@8.56.0) typescript: 5.3.3 @@ -1244,7 +1075,7 @@ packages: eslint-plugin-promise: ^6.0.0 dependencies: eslint: 8.56.0 - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0)(eslint@8.56.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.56.0) eslint-plugin-n: 16.6.2(eslint@8.56.0) eslint-plugin-promise: 6.1.1(eslint@8.56.0) dev: true @@ -1259,7 +1090,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.1(@typescript-eslint/parser@7.2.0)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0): + /eslint-module-utils@2.8.1(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0): resolution: {integrity: sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==} engines: {node: '>=4'} peerDependencies: @@ -1280,7 +1111,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 7.2.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/parser': 6.21.0(eslint@8.56.0)(typescript@5.3.3) debug: 3.2.7 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 @@ -1300,7 +1131,7 @@ packages: eslint-compat-utils: 0.1.2(eslint@8.56.0) dev: true - /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.2.0)(eslint@8.56.0): + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.56.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} peerDependencies: @@ -1310,7 +1141,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 7.2.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/parser': 6.21.0(eslint@8.56.0)(typescript@5.3.3) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.4 array.prototype.flat: 1.3.2 @@ -1319,7 +1150,7 @@ packages: doctrine: 2.1.0 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.2.0)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0) hasown: 2.0.0 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -2206,11 +2037,6 @@ packages: engines: {node: '>=8.6'} dev: true - /picomatch@4.0.1: - resolution: {integrity: sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg==} - engines: {node: '>=12'} - dev: true - /possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} diff --git a/src/preload.ts b/src/preload.ts index c26929c..1ed08be 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -1,14 +1,16 @@ import { ipcRenderer, contextBridge } from 'electron' import { createMenuTemplate, handleContextMenuCommand } from './preload/menu' +import { type INativeContextMenu } from './all/NativeContextMenu' -contextBridge.exposeInMainWorld('NativeContextMenu', - { - show: () => { - createMenuTemplate() - .then((template) => { ipcRenderer.send('native-context-menu', template) }) - .catch(console.error) - }, - }) +const obj: INativeContextMenu = { + show: () => { + createMenuTemplate() + .then((template) => { ipcRenderer.send('native-context-menu', template) }) + .catch(console.error) + }, +} + +contextBridge.exposeInMainWorld('NativeContextMenu', obj) ipcRenderer.on('context-menu-command', (e, parentLabel: string | undefined, command: string) => { handleContextMenuCommand(parentLabel, command).catch(console.error) diff --git a/src/renderer.ts b/src/renderer.ts index 5832b5a..a16b6bb 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -3,7 +3,7 @@ const observer = new MutationObserver(NativeContextMenu.show) observer.observe(document.body, { - childList: true + childList: true, }) const style = document.createElement('style')