Reduce lint errors
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
FileEncoding,
|
||||
SpacePrimitives,
|
||||
} from "../../common/spaces/space_primitives.ts";
|
||||
import { AttachmentMeta, FileMeta, PageMeta } from "../../common/types.ts";
|
||||
import { FileMeta } from "../../common/types.ts";
|
||||
import { NamespaceOperation, PageNamespaceHook } from "./page_namespace.ts";
|
||||
|
||||
export class PlugSpacePrimitives implements SpacePrimitives {
|
||||
@@ -18,7 +18,7 @@ export class PlugSpacePrimitives implements SpacePrimitives {
|
||||
pageName: string,
|
||||
...args: any[]
|
||||
): Promise<any> | false {
|
||||
for (let { operation, pattern, plug, name } of this.hook.spaceFunctions) {
|
||||
for (const { operation, pattern, plug, name } of this.hook.spaceFunctions) {
|
||||
if (operation === type && pageName.match(pattern)) {
|
||||
return plug.invoke(name, [pageName, ...args]);
|
||||
}
|
||||
@@ -27,11 +27,11 @@ export class PlugSpacePrimitives implements SpacePrimitives {
|
||||
}
|
||||
|
||||
async fetchFileList(): Promise<FileMeta[]> {
|
||||
let allFiles: FileMeta[] = [];
|
||||
for (let { plug, name, operation } of this.hook.spaceFunctions) {
|
||||
const allFiles: FileMeta[] = [];
|
||||
for (const { plug, name, operation } of this.hook.spaceFunctions) {
|
||||
if (operation === "listFiles") {
|
||||
try {
|
||||
for (let pm of await plug.invoke(name, [])) {
|
||||
for (const pm of await plug.invoke(name, [])) {
|
||||
allFiles.push(pm);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -39,8 +39,8 @@ export class PlugSpacePrimitives implements SpacePrimitives {
|
||||
}
|
||||
}
|
||||
}
|
||||
let result = await this.wrapped.fetchFileList();
|
||||
for (let pm of result) {
|
||||
const result = await this.wrapped.fetchFileList();
|
||||
for (const pm of result) {
|
||||
allFiles.push(pm);
|
||||
}
|
||||
return allFiles;
|
||||
@@ -58,7 +58,7 @@ export class PlugSpacePrimitives implements SpacePrimitives {
|
||||
}
|
||||
|
||||
getFileMeta(name: string): Promise<FileMeta> {
|
||||
let result = this.performOperation("getFileMeta", name);
|
||||
const result = this.performOperation("getFileMeta", name);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export class PlugSpacePrimitives implements SpacePrimitives {
|
||||
data: FileData,
|
||||
selfUpdate?: boolean,
|
||||
): Promise<FileMeta> {
|
||||
let result = this.performOperation(
|
||||
const result = this.performOperation(
|
||||
"writeFile",
|
||||
name,
|
||||
encoding,
|
||||
@@ -86,7 +86,7 @@ export class PlugSpacePrimitives implements SpacePrimitives {
|
||||
}
|
||||
|
||||
deleteFile(name: string): Promise<void> {
|
||||
let result = this.performOperation("deleteFile", name);
|
||||
const result = this.performOperation("deleteFile", name);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export function ensureTable(db: SQLite): Promise<void> {
|
||||
|
||||
export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
||||
const apiObj: SysCallMapping = {
|
||||
"index.set": async (ctx, page: string, key: string, value: any) => {
|
||||
"index.set": async (_ctx, page: string, key: string, value: any) => {
|
||||
await asyncExecute(
|
||||
db,
|
||||
`UPDATE ${tableName} SET value = ? WHERE key = ? AND page = ?`,
|
||||
@@ -59,11 +59,11 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
||||
}
|
||||
},
|
||||
"index.batchSet": async (ctx, page: string, kvs: KV[]) => {
|
||||
for (let { key, value } of kvs) {
|
||||
for (const { key, value } of kvs) {
|
||||
await apiObj["index.set"](ctx, page, key, value);
|
||||
}
|
||||
},
|
||||
"index.delete": async (ctx, page: string, key: string) => {
|
||||
"index.delete": async (_ctx, page: string, key: string) => {
|
||||
await asyncExecute(
|
||||
db,
|
||||
`DELETE FROM ${tableName} WHERE key = ? AND page = ?`,
|
||||
@@ -71,7 +71,7 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
||||
page,
|
||||
);
|
||||
},
|
||||
"index.get": async (ctx, page: string, key: string) => {
|
||||
"index.get": async (_ctx, page: string, key: string) => {
|
||||
const result = await asyncQuery<Item>(
|
||||
db,
|
||||
`SELECT value FROM ${tableName} WHERE key = ? AND page = ?`,
|
||||
@@ -84,7 +84,7 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
"index.queryPrefix": async (ctx, prefix: string) => {
|
||||
"index.queryPrefix": async (_ctx, prefix: string) => {
|
||||
return (
|
||||
await asyncQuery<Item>(
|
||||
db,
|
||||
@@ -97,7 +97,7 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
||||
value: JSON.parse(value),
|
||||
}));
|
||||
},
|
||||
"index.query": async (ctx, query: Query) => {
|
||||
"index.query": async (_ctx, query: Query) => {
|
||||
const { sql, params } = queryToSql(query);
|
||||
return (
|
||||
await asyncQuery<Item>(
|
||||
@@ -114,7 +114,7 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
||||
"index.clearPageIndexForPage": async (ctx, page: string) => {
|
||||
await apiObj["index.deletePrefixForPage"](ctx, page, "");
|
||||
},
|
||||
"index.deletePrefixForPage": async (ctx, page: string, prefix: string) => {
|
||||
"index.deletePrefixForPage": async (_ctx, page: string, prefix: string) => {
|
||||
await asyncExecute(
|
||||
db,
|
||||
`DELETE FROM ${tableName} WHERE key LIKE ? AND page = ?`,
|
||||
|
||||
Reference in New Issue
Block a user