mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: update eslint rules
This commit is contained in:
1 parent
0e07c64cad
commit
5e8d2b1286
30 files changed
+73
-72
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user