ui: update eslint rules

This commit is contained in:
undefined committed 2022-09-03 14:28:18 +08:00
1 parent 0e07c64cad
commit 5e8d2b1286
30 files changed
+73 -72

No files matched your search

+10 -13
View File
@@ -1,12 +1,12 @@
type callback = (pagename: string, loadPage: (name: string) => Promise<any>) => any;
type Callback = (pagename: string, loadPage: (name: string) => Promise<any>) => any;
export class Page {
moduleName?: string;
autoload = false;
afterLoading?: callback;
beforeLoading?: callback;
constructor(pagename: string | string[], afterLoading?: callback, beforeLoading?: callback);
constructor(pagename: string | string[], moduleName: string, afterLoading?: callback, beforeLoading?: callback);
afterLoading?: Callback;
beforeLoading?: Callback;
constructor(pagename: string | string[], afterLoading?: Callback, beforeLoading?: Callback);
constructor(pagename: string | string[], moduleName: string, afterLoading?: Callback, beforeLoading?: Callback);
constructor(pagename: string | string[], ...args: any[]);
constructor(public name: string | string[], ...args: any[]) {
if (typeof args[0] === 'string') {
@@ -16,16 +16,13 @@ export class Page {
}
if (process.env.NODE_ENV !== 'production') {
if (typeof name !== 'string' && !(name instanceof Array)) {
// eslint-disable-next-line quotes
throw new Error(`'name' should be a string or string[]`);
throw new Error("'name' should be a string or string[]");
}
if (typeof this.afterLoading !== 'function' && this.afterLoading != null) {
// eslint-disable-next-line quotes
throw new Error(`'afterLoading' should be a function`);
throw new Error("'afterLoading' should be a function");
}
if (typeof this.beforeLoading !== 'function' && this.beforeLoading != null) {
// eslint-disable-next-line quotes
throw new Error(`'beforeLoading' should be a function`);
throw new Error("'beforeLoading' should be a function");
}
}
}
@@ -40,8 +37,8 @@ export class Page {
export class NamedPage extends Page { }
export class AutoloadPage extends Page {
constructor(pagename: string | string[], afterLoading?: callback, beforeLoading?: callback);
constructor(pagename: string | string[], moduleName: string, afterLoading?: callback, beforeLoading?: callback);
constructor(pagename: string | string[], afterLoading?: Callback, beforeLoading?: Callback);
constructor(pagename: string | string[], moduleName: string, afterLoading?: Callback, beforeLoading?: Callback);
constructor(pagename: string | string[], ...args: any[]) {
super(pagename, ...args);
this.autoload = true;