chore(deps): replace dependency eslint-config-standard-with-typescript with eslint-config-love 43.1.0 (#1228)

* chore(deps): replace dependency eslint-config-standard-with-typescript with eslint-config-love 43.1.0

* actually apply the rules lol

* rebuild

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
This commit is contained in:
renovate[bot]
2024-04-23 00:40:51 +02:00
committed by GitHub
parent 8aacc312cf
commit faa89850d0
53 changed files with 217 additions and 194 deletions
+1 -1
View File
@@ -1 +1 @@
if("__TAURI__"in window){var __TAURI_PLUGIN_NOTIFICATION__=function(e){"use strict";function n(e,n,i,t){if("a"===i&&!t)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?e!==n||!t:!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?t:"a"===i?t.call(e):t?t.value:n.get(e)}function i(e,n,i,t,o){if("m"===t)throw new TypeError("Private method is not writable");if("a"===t&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?e!==n||!o:!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===t?o.call(e,i):o?o.value=i:n.set(e,i),i}var t,o,r,a,c,s;"function"==typeof SuppressedError&&SuppressedError;class l{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,t.set(this,(()=>{})),o.set(this,0),r.set(this,{}),this.id=function(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}((({message:e,id:a})=>{if(a===n(this,o,"f")){i(this,o,a+1,"f"),n(this,t,"f").call(this,e);const c=Object.keys(n(this,r,"f"));if(c.length>0){let e=a+1;for(const i of c.sort()){if(parseInt(i)!==e)break;{const o=n(this,r,"f")[i];delete n(this,r,"f")[i],n(this,t,"f").call(this,o),e+=1}}}}else n(this,r,"f")[a.toString()]=e}))}set onmessage(e){i(this,t,e,"f")}get onmessage(){return n(this,t,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}t=new WeakMap,o=new WeakMap,r=new WeakMap;class u{constructor(e,n,i){this.plugin=e,this.event=n,this.channelId=i}async unregister(){return d(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function f(e,n,i){const t=new l;return t.onmessage=i,d(`plugin:${e}|register_listener`,{event:n,handler:t}).then((()=>new u(e,n,t.id)))}async function d(e,n={},i){return window.__TAURI_INTERNALS__.invoke(e,n,i)}e.ScheduleEvery=void 0,(a=e.ScheduleEvery||(e.ScheduleEvery={})).Year="year",a.Month="month",a.TwoWeeks="twoWeeks",a.Week="week",a.Day="day",a.Hour="hour",a.Minute="minute",a.Second="second";return e.Importance=void 0,(c=e.Importance||(e.Importance={}))[c.None=0]="None",c[c.Min=1]="Min",c[c.Low=2]="Low",c[c.Default=3]="Default",c[c.High=4]="High",e.Visibility=void 0,(s=e.Visibility||(e.Visibility={}))[s.Secret=-1]="Secret",s[s.Private=0]="Private",s[s.Public=1]="Public",e.Schedule=class{static at(e,n=!1,i=!1){return{at:{date:e,repeating:n,allowWhileIdle:i},interval:void 0,every:void 0}}static interval(e,n=!1){return{at:void 0,interval:{interval:e,allowWhileIdle:n},every:void 0}}static every(e,n,i=!1){return{at:void 0,interval:void 0,every:{interval:e,count:n,allowWhileIdle:i}}}},e.active=async function(){return d("plugin:notification|get_active")},e.cancel=async function(e){return d("plugin:notification|cancel",{notifications:e})},e.cancelAll=async function(){return d("plugin:notification|cancel")},e.channels=async function(){return d("plugin:notification|listChannels")},e.createChannel=async function(e){return d("plugin:notification|create_channel",{...e})},e.isPermissionGranted=async function(){return"default"!==window.Notification.permission?Promise.resolve("granted"===window.Notification.permission):d("plugin:notification|is_permission_granted")},e.onAction=async function(e){return f("notification","actionPerformed",e)},e.onNotificationReceived=async function(e){return f("notification","notification",e)},e.pending=async function(){return d("plugin:notification|get_pending")},e.registerActionTypes=async function(e){return d("plugin:notification|register_action_types",{types:e})},e.removeActive=async function(e){return d("plugin:notification|remove_active",{notifications:e})},e.removeAllActive=async function(){return d("plugin:notification|remove_active")},e.removeChannel=async function(e){return d("plugin:notification|delete_channel",{id:e})},e.requestPermission=async function(){return window.Notification.requestPermission()},e.sendNotification=function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},e}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_PLUGIN_NOTIFICATION__})}
if("__TAURI__"in window){var __TAURI_PLUGIN_NOTIFICATION__=function(i){"use strict";function n(i,n,t,e){if("function"==typeof n?i!==n||!e:!n.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n.get(i)}function t(i,n,t,e,o){if("function"==typeof n?i!==n||!o:!n.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n.set(i,t),t}var e,o,a,r,c,s;"function"==typeof SuppressedError&&SuppressedError;class l{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,e.set(this,(()=>{})),o.set(this,0),a.set(this,{}),this.id=function(i,n=!1){return window.__TAURI_INTERNALS__.transformCallback(i,n)}((({message:i,id:r})=>{if(r===n(this,o)){t(this,o,r+1),n(this,e).call(this,i);const c=Object.keys(n(this,a));if(c.length>0){let i=r+1;for(const t of c.sort()){if(parseInt(t)!==i)break;{const o=n(this,a)[t];delete n(this,a)[t],n(this,e).call(this,o),i+=1}}}}else n(this,a)[r.toString()]=i}))}set onmessage(i){t(this,e,i)}get onmessage(){return n(this,e)}toJSON(){return`__CHANNEL__:${this.id}`}}e=new WeakMap,o=new WeakMap,a=new WeakMap;class u{constructor(i,n,t){this.plugin=i,this.event=n,this.channelId=t}async unregister(){return d(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function f(i,n,t){const e=new l;return e.onmessage=t,d(`plugin:${i}|register_listener`,{event:n,handler:e}).then((()=>new u(i,n,e.id)))}async function d(i,n={},t){return window.__TAURI_INTERNALS__.invoke(i,n,t)}i.ScheduleEvery=void 0,(r=i.ScheduleEvery||(i.ScheduleEvery={})).Year="year",r.Month="month",r.TwoWeeks="twoWeeks",r.Week="week",r.Day="day",r.Hour="hour",r.Minute="minute",r.Second="second";return i.Importance=void 0,(c=i.Importance||(i.Importance={}))[c.None=0]="None",c[c.Min=1]="Min",c[c.Low=2]="Low",c[c.Default=3]="Default",c[c.High=4]="High",i.Visibility=void 0,(s=i.Visibility||(i.Visibility={}))[s.Secret=-1]="Secret",s[s.Private=0]="Private",s[s.Public=1]="Public",i.Schedule=class{static at(i,n=!1,t=!1){return{at:{date:i,repeating:n,allowWhileIdle:t},interval:void 0,every:void 0}}static interval(i,n=!1){return{at:void 0,interval:{interval:i,allowWhileIdle:n},every:void 0}}static every(i,n,t=!1){return{at:void 0,interval:void 0,every:{interval:i,count:n,allowWhileIdle:t}}}},i.active=async function(){return await d("plugin:notification|get_active")},i.cancel=async function(i){await d("plugin:notification|cancel",{notifications:i})},i.cancelAll=async function(){await d("plugin:notification|cancel")},i.channels=async function(){return await d("plugin:notification|listChannels")},i.createChannel=async function(i){await d("plugin:notification|create_channel",{...i})},i.isPermissionGranted=async function(){return"default"!==window.Notification.permission?await Promise.resolve("granted"===window.Notification.permission):await d("plugin:notification|is_permission_granted")},i.onAction=async function(i){return await f("notification","actionPerformed",i)},i.onNotificationReceived=async function(i){return await f("notification","notification",i)},i.pending=async function(){return await d("plugin:notification|get_pending")},i.registerActionTypes=async function(i){await d("plugin:notification|register_action_types",{types:i})},i.removeActive=async function(i){await d("plugin:notification|remove_active",{notifications:i})},i.removeAllActive=async function(){await d("plugin:notification|remove_active")},i.removeChannel=async function(i){await d("plugin:notification|delete_channel",{id:i})},i.requestPermission=async function(){return await window.Notification.requestPermission()},i.sendNotification=function(i){"string"==typeof i?new window.Notification(i):new window.Notification(i.title,i)},i}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_PLUGIN_NOTIFICATION__})}
+22 -20
View File
@@ -11,7 +11,7 @@
import {
invoke,
PluginListener,
type PluginListener,
addPluginListener,
} from "@tauri-apps/api/core";
@@ -103,7 +103,7 @@ interface Options {
/**
* Extra payload to store in the notification.
*/
extra?: { [key: string]: unknown };
extra?: Record<string, unknown>;
/**
* If true, the notification cannot be dismissed by the user on Android.
*
@@ -130,7 +130,7 @@ interface Options {
number?: number;
}
type ScheduleInterval = {
interface ScheduleInterval {
year?: number;
month?: number;
day?: number;
@@ -147,7 +147,7 @@ type ScheduleInterval = {
hour?: number;
minute?: number;
second?: number;
};
}
enum ScheduleEvery {
Year = "year",
@@ -171,12 +171,14 @@ class Schedule {
allowWhileIdle: boolean;
}
| undefined;
interval:
| {
interval: ScheduleInterval;
allowWhileIdle: boolean;
}
| undefined;
every:
| {
interval: ScheduleEvery;
@@ -317,9 +319,9 @@ type Permission = "granted" | "denied" | "default";
*/
async function isPermissionGranted(): Promise<boolean> {
if (window.Notification.permission !== "default") {
return Promise.resolve(window.Notification.permission === "granted");
return await Promise.resolve(window.Notification.permission === "granted");
}
return invoke("plugin:notification|is_permission_granted");
return await invoke("plugin:notification|is_permission_granted");
}
/**
@@ -339,7 +341,7 @@ async function isPermissionGranted(): Promise<boolean> {
* @since 2.0.0
*/
async function requestPermission(): Promise<Permission> {
return window.Notification.requestPermission();
return await window.Notification.requestPermission();
}
/**
@@ -390,7 +392,7 @@ function sendNotification(options: Options | string): void {
* @since 2.0.0
*/
async function registerActionTypes(types: ActionType[]): Promise<void> {
return invoke("plugin:notification|register_action_types", { types });
await invoke("plugin:notification|register_action_types", { types });
}
/**
@@ -407,7 +409,7 @@ async function registerActionTypes(types: ActionType[]): Promise<void> {
* @since 2.0.0
*/
async function pending(): Promise<PendingNotification[]> {
return invoke("plugin:notification|get_pending");
return await invoke("plugin:notification|get_pending");
}
/**
@@ -424,7 +426,7 @@ async function pending(): Promise<PendingNotification[]> {
* @since 2.0.0
*/
async function cancel(notifications: number[]): Promise<void> {
return invoke("plugin:notification|cancel", { notifications });
await invoke("plugin:notification|cancel", { notifications });
}
/**
@@ -441,7 +443,7 @@ async function cancel(notifications: number[]): Promise<void> {
* @since 2.0.0
*/
async function cancelAll(): Promise<void> {
return invoke("plugin:notification|cancel");
await invoke("plugin:notification|cancel");
}
/**
@@ -458,7 +460,7 @@ async function cancelAll(): Promise<void> {
* @since 2.0.0
*/
async function active(): Promise<ActiveNotification[]> {
return invoke("plugin:notification|get_active");
return await invoke("plugin:notification|get_active");
}
/**
@@ -475,9 +477,9 @@ async function active(): Promise<ActiveNotification[]> {
* @since 2.0.0
*/
async function removeActive(
notifications: { id: number; tag?: string }[],
notifications: Array<{ id: number; tag?: string }>,
): Promise<void> {
return invoke("plugin:notification|remove_active", { notifications });
await invoke("plugin:notification|remove_active", { notifications });
}
/**
@@ -494,7 +496,7 @@ async function removeActive(
* @since 2.0.0
*/
async function removeAllActive(): Promise<void> {
return invoke("plugin:notification|remove_active");
await invoke("plugin:notification|remove_active");
}
/**
@@ -518,7 +520,7 @@ async function removeAllActive(): Promise<void> {
* @since 2.0.0
*/
async function createChannel(channel: Channel): Promise<void> {
return invoke("plugin:notification|create_channel", { ...channel });
await invoke("plugin:notification|create_channel", { ...channel });
}
/**
@@ -535,7 +537,7 @@ async function createChannel(channel: Channel): Promise<void> {
* @since 2.0.0
*/
async function removeChannel(id: string): Promise<void> {
return invoke("plugin:notification|delete_channel", { id });
await invoke("plugin:notification|delete_channel", { id });
}
/**
@@ -552,19 +554,19 @@ async function removeChannel(id: string): Promise<void> {
* @since 2.0.0
*/
async function channels(): Promise<Channel[]> {
return invoke("plugin:notification|listChannels");
return await invoke("plugin:notification|listChannels");
}
async function onNotificationReceived(
cb: (notification: Options) => void,
): Promise<PluginListener> {
return addPluginListener("notification", "notification", cb);
return await addPluginListener("notification", "notification", cb);
}
async function onAction(
cb: (notification: Options) => void,
): Promise<PluginListener> {
return addPluginListener("notification", "actionPerformed", cb);
return await addPluginListener("notification", "actionPerformed", cb);
}
export type {
+18 -10
View File
@@ -9,22 +9,28 @@ import type { Options } from "./index";
let permissionSettable = false;
let permissionValue = "default";
function isPermissionGranted() {
async function isPermissionGranted(): Promise<boolean> {
if (window.Notification.permission !== "default") {
return Promise.resolve(window.Notification.permission === "granted");
return await Promise.resolve(
window.Notification.permission === "granted",
);
}
return invoke("plugin:notification|is_permission_granted");
return await invoke("plugin:notification|is_permission_granted");
}
function setNotificationPermission(value: "granted" | "denied" | "default") {
function setNotificationPermission(
value: "granted" | "denied" | "default",
): void {
permissionSettable = true;
// @ts-expect-error we can actually set this value on the webview
window.Notification.permission = value;
permissionSettable = false;
}
function requestPermission() {
return invoke<"prompt" | "default" | "granted" | "denied">(
async function requestPermission(): Promise<
"default" | "denied" | "granted" | "prompt"
> {
return await invoke<"prompt" | "default" | "granted" | "denied">(
"plugin:notification|request_permission",
).then((permission) => {
setNotificationPermission(
@@ -34,12 +40,12 @@ import type { Options } from "./index";
});
}
function sendNotification(options: string | Options) {
async function sendNotification(options: string | Options): Promise<void> {
if (typeof options === "object") {
Object.freeze(options);
}
return invoke("plugin:notification|notify", {
await invoke("plugin:notification|notify", {
options:
typeof options === "string"
? {
@@ -51,8 +57,10 @@ import type { Options } from "./index";
// @ts-expect-error unfortunately we can't implement the whole type, so we overwrite it with our own version
window.Notification = function (title, options) {
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
const opts = options || {};
sendNotification(
void sendNotification(
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
Object.assign(opts, {
title,
}),
@@ -73,7 +81,7 @@ import type { Options } from "./index";
},
});
isPermissionGranted().then(function (response) {
void isPermissionGranted().then(function (response) {
if (response === null) {
setNotificationPermission("default");
} else {
+1 -1
View File
@@ -1 +1 @@
!function(){"use strict";async function i(i,n={},t){return window.__TAURI_INTERNALS__.invoke(i,n,t)}"function"==typeof SuppressedError&&SuppressedError,function(){let n=!1,t="default";function o(i){n=!0,window.Notification.permission=i,n=!1}window.Notification=function(n,t){const o=t||{};!function(n){"object"==typeof n&&Object.freeze(n),i("plugin:notification|notify",{options:"string"==typeof n?{title:n}:n})}(Object.assign(o,{title:n}))},window.Notification.requestPermission=function(){return i("plugin:notification|request_permission").then((i=>(o("prompt"===i?"default":i),i)))},Object.defineProperty(window.Notification,"permission",{enumerable:!0,get:()=>t,set:i=>{if(!n)throw new Error("Readonly property");t=i}}),("default"!==window.Notification.permission?Promise.resolve("granted"===window.Notification.permission):i("plugin:notification|is_permission_granted")).then((function(i){o(null===i?"default":i?"granted":"denied")}))}()}();
!function(){"use strict";async function i(i,n={},t){return window.__TAURI_INTERNALS__.invoke(i,n,t)}"function"==typeof SuppressedError&&SuppressedError,function(){let n=!1,t="default";function o(i){n=!0,window.Notification.permission=i,n=!1}window.Notification=function(n,t){const o=t||{};!async function(n){"object"==typeof n&&Object.freeze(n),await i("plugin:notification|notify",{options:"string"==typeof n?{title:n}:n})}(Object.assign(o,{title:n}))},window.Notification.requestPermission=async function(){return await i("plugin:notification|request_permission").then((i=>(o("prompt"===i?"default":i),i)))},Object.defineProperty(window.Notification,"permission",{enumerable:!0,get:()=>t,set:i=>{if(!n)throw new Error("Readonly property");t=i}}),async function(){return"default"!==window.Notification.permission?await Promise.resolve("granted"===window.Notification.permission):await i("plugin:notification|is_permission_granted")}().then((function(i){o(null===i?"default":i?"granted":"denied")}))}()}();